GPT-4 的实际体验如何?和之前相比有哪些明显提升?

GPT-4 的实际体验如何?和之前相比有哪些明显提升?

原标题:GPT-4 的实际体验如何?和之前相比有哪些明显提升?

关键字:人工智能,GPT,OpenAI,GPT-4,ChatGPT

最佳回答:许哲

回答字数:18889字

终于搞定了GPT-4 的付费,在使用体验上是比 GPT-3.5 强的。但还是经常遇到问题,且响应速度会慢一些。我用了完全一样的要求让GPT给我写代码,4写的明显比3.5要完善一点,但依然需要不断的自己去找漏洞和不足的地方。所谓未来会有 prompt engineer 感觉是顺理成章的事情。GPT不会直接按照你的要求就能完成复杂的任务。更像是一个自然语言到高级语言的编译器。

过去只有少数专业人士在纸带上打孔才能让计算机干活,后来有了助记符 MOVE JUMP 之后门槛降低了很多,再之后有了高级计算机语言了更加降低了门槛,每一次都相当于把人机交互又“向上抽象了一层”,每一次抽象都把信息革命的力量在数量级上产生飞跃

GPT让计算机干活给我一种类似的感觉,它又抽象了一层。

但它并不能真的让你不思考,只提需求,未来也许可能,目前做不到。

下面是我用 GPT-4 “开发”的过程,我使用体验依然是在开发,而不是坐享其成

我的测试用例的目标是用智能合约做一个完全去中心化的看涨期权合约。

直接把这个要求扔给GPT,给我产生了一坨根本不能用的东西。它的理解力是有局限的。

我必须把流程给它说个明白,相当于用自然语言搞了一套伪代码。

Implement a decentralized call option using the Solidity language.
There are two roles in the smart contract: option buyers and option sellers. The workflow is as follows:
(1) The seller deposits a certain amount of ETH as collateral into the contract and sets the expiration date and strike price. At this point, the contract is established.
(2) Buyers bid and deposit an equivalent amount of ETH as the option fee guarantee into the contract. All buyer bids are visible.
(3) If the highest price observed by the seller is deemed high enough, the seller announces the end of the bidding and the contract status becomes completed. If no buyer places a bid before the expiration date or if none of the prices are satisfactory to the seller, the contract status becomes expired. All buyers (if any) can retrieve their bidding funds, and the seller can get back the collateral.
(4) If the contract status is completed and the contract expires, the buyer has the right to exchange the sellers collateral with the agreed-upon strike price after the expiration date. If the buyer pays the funds equal to or greater than the strike price as agreed, the seller receives the option premium and the cost of purchasing

大概的意思是

实现一个去中心化的看涨期权,使用Solidity语言。
在智能合约里有两类角色:期权买家和期权卖家
工作流程如下:
(1)卖家向合约里存入若干数量的ETH作为抵押物,并且设定到期日和执行价。此时合约的状态为已设立。
(2)买家竞价,并且向合约里打入自己申报的期权价格等额的ETH作为期权费的保证金。所有买家的竞价都是可查的。
(3)卖家观察到的价格里最高的一个如果使得卖家觉得足够高,那么卖家宣布竞价结束,此时合约的状态为已成交。如果在到期日前依然没有任何一个买家出价或者没有让卖家满意的价格,那么合约的状态为已过期。所有的买家(如果有)能拿回自己竞价的资金,而卖家能收回抵押物。
(4)如果合约状态为已成交,且合约到期,那么买家有权在到期后用约定的执行价交换走卖家的抵押物,此时买家如果如约支付大于等于执行价的资金,那么卖家提走期权费和购买抵押物的费用,而买家拿走抵押物。如果合约成交且到期后买家没有任何操作,那么24小时后合约状态为已失效。卖家能取回自己的质押物,且拿走买家支付的期权费。

必须要喂到这种程度,流程如下 1 2 3

有点类似大学里上课给出的编程题目之后画流程图的阶段,GPT-4 给我的输出

pragma solidity ^0.8.0;

contract DecentralizedCallOption {
    address public seller;
    uint256 public collateral;
    uint256 public strikePrice;
    uint256 public expirationDate;

    enum Status { Open, Completed, Expired }
    Status public status;

    struct Bid {
        address buyer;
        uint256 amount;
    }
    Bid[] public bids;

    constructor(
        uint256 _strikePrice,
        uint256 _expirationDate
    ) payable {
        require(msg.value > 0, Collateral required);

        seller = msg.sender;
        collateral = msg.value;
        strikePrice = _strikePrice;
        expirationDate = _expirationDate;

        status = Status.Open;
    }

    function bid() external payable {
        require(status == Status.Open, Contract not open for bidding);
        require(msg.value > 0, Option fee guarantee required);

        bids.push(Bid({buyer: msg.sender, amount: msg.value}));
    }

    function endBidding() external {
        require(msg.sender == seller, Only the seller can end bidding);
        require(status == Status.Open, Contract not open for bidding);

        status = Status.Completed;
    }

    function claimRefund() external {
        require(status == Status.Expired, Contract not expired);

        for (uint256 i = 0; i < bids.length; i++) {
            if (bids[i].buyer == msg.sender) {
                payable(msg.sender).transfer(bids[i].amount);
                bids[i].amount = 0;
            }
        }
    }

    function exerciseOption() external payable {
        require(status == Status.Completed, Contract not completed);
        require(block.timestamp >= expirationDate, Contract not expired);

        for (uint256 i = 0; i < bids.length; i++) {
            if (bids[i].buyer == msg.sender) {
                require(msg.value >= strikePrice, Incorrect strike price);

                // Transfer collateral to buyer and option premium to seller
                payable(msg.sender).transfer(collateral);
                payable(seller).transfer(bids[i].amount + strikePrice);

                // Reset contract state
                collateral = 0;
                bids[i].amount = 0;
                status = Status.Expired;

                break;
            }
        }
    }

    function expire() external {
        require(status == Status.Open || status == Status.Completed, Contract not open or completed);
        require(block.timestamp >= expirationDate, Contract not expired);

        status = Status.Expired;
    }
}

这是GPT-4 给我输出的代码,乍一看,妈啊这是已经做成了。

但经不起推敲,经常给你搞一个一本正经的乱炖

我要设计的这个竞价模式,让最高出价的人成交,整个代码里连最高价的概念都没。所以GPT写代码的逻辑依然是相关性一通乱炖。但你说程序写的没逻辑吧,冤枉。

in the endBidding() method, seller should point the highest bidder be the winner and only the winner can exerciseOption not all of the bidders.

所以一下子完成时不现实的,必须跟它说哪里做的不对。

GPT 回复我:

I understand the requirements, and I have modified the contract accordingly. Now, the endBidding() method selects the highest bidder, and only the highest bidder can exercise the option.

它说它 understand 了,我还是很怀疑

然后给我扔了修正过的代码

pragma solidity ^0.8.0;

contract DecentralizedCallOption {
    address public seller;
    uint256 public collateral;
    uint256 public strikePrice;
    uint256 public expirationDate;

    enum Status { Open, Completed, Expired }
    Status public status;

    address public highestBidder;
    uint256 public highestBid;

    constructor(
        uint256 _strikePrice,
        uint256 _expirationDate
    ) payable {
        require(msg.value > 0, Collateral required);

        seller = msg.sender;
        collateral = msg.value;
        strikePrice = _strikePrice;
        expirationDate = _expirationDate;

        status = Status.Open;
    }

    function bid() external payable {
        require(status == Status.Open, Contract not open for bidding);
        require(msg.value > highestBid, Bid must be higher than the current highest bid);

        // Refund the previous highest bidder
        if (highestBidder != address(0)) {
            payable(highestBidder).transfer(highestBid);
        }

        highestBidder = msg.sender;
        highestBid = msg.value;
    }

    function endBidding() external {
        require(msg.sender == seller, Only the seller can end bidding);
        require(status == Status.Open, Contract not open for bidding);

        status = Status.Completed;
    }

    function claimRefund() external {
        require(status == Status.Expired, Contract not expired);
        require(msg.sender == highestBidder, Only the highest bidder can claim a refund);

        payable(highest

是的,它没写完就挂了,经常出现 network error。

但看出来,它似乎是真的理解了我的修改意见。

但逻辑上的问题依然存在,如果 bid() 方法里已经退了该退的款,那么 calimRefund() 就不用存在了。但因为这个要求退款是我一开始提的要求,所以它一直保留着。

作为一个 prompt 的“编码者”,需要明白自己的需求会影响代码的逻辑性。

时时刻刻,逻辑的弦始终绷紧。

if in the bid() method,the bidder who failed already got the refund, then the calimRefund() method should not exists anymore

GTP回复我:

Youre correct. Since the failed bidders are already refunded in the bid() method, theres no need for the claimRefund() method. Heres the updated contract without the claimRefund() method:

它这里似乎又有对程序逻辑的判断了,还说我说的对。真不知道它是真明白了,还是对我客气。毕竟我是付费用户~

然后咔咔一顿代码修改:

pragma solidity ^0.8.0;

contract DecentralizedCallOption {
    address public seller;
    uint256 public collateral;
    uint256 public strikePrice;
    uint256 public expirationDate;

    enum Status { Open, Completed, Expired }
    Status public status;

    address public highestBidder;
    uint256 public highestBid;

    constructor(
        uint256 _strikePrice,
        uint256 _expirationDate
    ) payable {
        require(msg.value > 0, Collateral required);

        seller = msg.sender;
        collateral = msg.value;
        strikePrice = _strikePrice;
        expirationDate = _expirationDate;

        status = Status.Open;
    }

    function bid() external payable {
        require(status == Status.Open, Contract not open for bidding);
        require(msg.value > highestBid, Bid must be higher than the current highest bid);

        // Refund the previous highest bidder
        if (highestBidder != address(0)) {
            payable(highestBidder).transfer(highestBid);
        }

        highestBidder = msg.sender;
        highestBid = msg.value;
    }

    function endBidding() external {
        require(msg.sender == seller, Only the seller can end bidding);
        require(status == Status.Open, Contract not open for bidding);

        status = Status.Completed;
    }

    function exerciseOption() external payable {
        require(status == Status.Completed, Contract not completed);
        require(block.timestamp >= expirationDate, Contract not expired);
        require(msg.sender == highestBidder, Only the highest bidder can exercise the option);
        require(msg.value >= strikePrice, Incorrect strike price);

        // Transfer collateral to highest bidder and option premium to seller
        payable(highestBidder).transfer(collateral);
        payable(seller).transfer(highestBid + strikePrice);

        // Reset contract state
        collateral = 0;
        highestBid = 0;
        status = Status.Expired;
    }

    function expire() external {
        require(status == Status.Open || status == Status.Completed, Contract not open or completed);
        require(block.timestamp >= expirationDate, Contract not expired);

        status = Status.Expired;
    }
}

这次吐出来了完整的代码,风格很完整,还有注释。

我检查了之后发现我最初给的流程里少了一个如果期权是虚的最后过期了,应该各自退还的。这个是我流程里的逻辑缺失。GTP-4 并没有发现。

但从它的代码里它似乎又是知道期权是个啥的。

另外还有一种情况,如果竞价一个都没让卖家满意,那么到期后应该自动失效,所有人拿回自己的资金。

这些都是我流程给的里面就没主义到的,GPT-4不会给你分析,它的逻辑是弱的

If the option is not exercised by highest bidder after 24 hours of the expiration date, it will be considered forfeited. not all of the call worth be exercised. if it be forfeited,then the premium still need paid to the seller and the seller can got back all of the collateral.
In addition, there is another situation whereby if all the bid sellers are not satisfied, all the bids will be voided upon expiration, and each buyer will receive their own funds back while the sellers will recover their own option premium http://margin.in this situation,the seller nerver call the endBidding() method.

这个是我继续给的 prompt ,GPT-4 按照我的需求又修改了代码

Thank you for the clarification. Based on the new requirements, I have updated the smart contract to include the 24-hour exercise window after the expiration date and the new condition to allow the seller to recover their collateral if no satisfactory bids are received.

GPT 有点好,认错快又客气,作为一个乙方,态度总是很良好。

pragma solidity ^0.8.0;

contract DecentralizedCallOption {
    address public seller;
    uint256 public collateral;
    uint256 public strikePrice;
    uint256 public expirationDate;
    uint256 public exerciseWindow = 24 hours;

    enum Status { Open, Completed, Expired }
    Status public status;

    address public highestBidder;
    uint256 public highestBid;

    constructor(
        uint256 _strikePrice,
        uint256 _expirationDate
    ) payable {
        require(msg.value > 0, Collateral required);

        seller = msg.sender;
        collateral = msg.value;
        strikePrice = _strikePrice;
        expirationDate = _expirationDate;

        status = Status.Open;
    }

    function bid() external payable {
        require(status == Status.Open, Contract not open for bidding);
        require(msg.value > highestBid, Bid must be higher than the current highest bid);

        // Refund the previous highest bidder
        if (highestBidder != address(0)) {
            payable(highestBidder).transfer(highestBid);
        }

        highestBidder = msg.sender;
        highestBid = msg.value;
    }

    function endBidding() external {
        require(msg.sender == seller, Only the seller can end bidding);
        require(status == Status.Open, Contract not open for bidding);

        status = Status.Completed;
    }

    function exerciseOption() external payable {
        require(status == Status.Completed, Contract not completed);
        require(block.timestamp >= expirationDate && block.timestamp <= expirationDate + exerciseWindow, Outside exercise window);
        require(msg.sender == highestBidder, Only the highest bidder can exercise the option);
        require(msg.value >= strikePrice, Incorrect strike price);

        // Transfer collateral to highest bidder and option premium to seller
        payable(highestBidder).transfer(collateral);
        payable(seller).transfer(highestBid + strikePrice);

        // Reset contract state
        collateral = 0;
        highestBid = 0;
        status = Status.Expired;
    }

    function claimPremiumAndCollateral() external {
        require(msg.sender == seller, Only the seller can claim premium and collateral);
        require(status == Status.Expired, Contract not expired);

        // If no satisfactory bids, the seller can claim back the collateral
        if (block.timestamp >= expirationDate && highestBidder == address(0)) {
            payable(seller).transfer(collateral);
            collateral = 0;
            return;
        }

        // If the option is forfeited, the seller can claim back the collateral and premium
        if (block.timestamp > expirationDate + exerciseWindow) {
            payable(seller).transfer(collateral + highestBid);
            collateral = 0;
            highestBid = 0;
            return;
        }
    }

    function expire() external {
        require(status == Status.Open || status == Status.Completed, Contract not open or completed);
        require(block.timestamp >= expirationDate, Contract not expired);

        status = Status.Expired;
    }
}

咔咔咔代码写很快,但又又又犯逻辑错误

如果期权没被成交,那么最高报价的人没收回保证金。

in the situation there are no satisfactory bids,the highest bidderss money still be locked in contract.it should pay back to the highest bidder even his/her bid is not taken.

所以 GPT 的逻辑方面是真的很欠缺。

Youre right, I missed returning the highest bidders funds in that situation. I have now updated the claimPremiumAndCollateral() method to return the highest bidders funds if their bid is not satisfactory.

冗余重复的部分就不贴了

function claimPremiumAndCollateral() external {
        require(msg.sender == seller, Only the seller can claim premium and collateral);
        require(status == Status.Expired, Contract not expired);

        // If no satisfactory bids, the seller can claim back the collateral and return highest bidders funds
        if (block.timestamp >= expirationDate && highestBidder == address(0)) {
            payable(seller).transfer(collateral);
            collateral = 0;
            return;
        }

        // If the option is forfeited, the seller can claim back the collateral and premium
        if (block.timestamp > expirationDate + exerciseWindow) {
            payable(seller).transfer(collateral + highestBid);
            collateral = 0;
            highestBid = 0;
            return;
        }

        // If there are no satisfactory bids, return the highest bidders funds
        if (block.timestamp >= expirationDate && highestBidder != address(0)) {
            payable(highestBidder).transfer(highestBid);
            highestBid = 0;
            return;
        }
    }

这次基本算对了,但总让人感觉很心虚,不知道还有啥逻辑上的伤。

总结一下,用 GPT 做开发的过程其实和用高级程序语言是类似的。关于程序的业务逻辑和代码的实现逻辑方面,GPT 没有做到自动驾驶的水平,它只能是一个“提示器”。

它相当于 IDE 自动补足的一个非常非常非常智能的版本,但它目前不能给你实现我提需求,它直接给方案的地步,还有很长的路要走。

当你给的业务逻辑本身有毛病的时候,千万别指望它能给你指出来。哪怕你要求到比较细的地方,它依然可能在实现逻辑和严谨性上出问题。

但话说回来,这些我们手动用高级程序语言写一样要做的,它已经给你省力很多很多了不是吗?

我不用查文档,不用关心特殊的语法,不用关心API的名字和参数的位置等等,这个超级提示器还是极大的提升了效率的,那些逻辑问题本来也要处理的。不要抱有不切和实际的期望就好。

它直接给了你一个毛胚的房子,你得仔细检查一下水电,然后得自己装璜一下。它做不到拎包入住,但说是一个革命性的飞跃一点不为过。

未来会有 prompt engineer 的职位吧,但可能并不长寿,说不定AI 未来直接能给你拎包入住了。

这是一个从打孔纸带到助记符级别的飞跃,会带动产业的洗牌是毋庸置疑的。

要走的路还很长,但这一步飞跃的着实惊艳。

本文链接:

联系作者

回答作者:许哲

0

评论0

  1. 刚刚玩了一会儿GPT-4,现阶段必须得是Plus会员可以用,你可以看到现在有3个模型可以选。

    并且提问是有限制的,每四个小时内不能超过100条消息。

    同样的问题,问GPT3.5和GPT-4有两个区别

    第一个是速度,3.5的速度很快,而GPT-4的生成速度相对来说很慢

    第二是内容,前者生成的是那种一看就没什么营养的。

    这是GPT-4生成的。

    给我的感觉是它是真的知道问题的边界,以及给我更优质的回答。

    再用GPT-4一个衍生的问题:

    然后问GPT-3.5的话,我感觉它像个急性子的熊孩子

    问一个不安全的问题

    在ChatGPT刚出来的时候还可以问出来,现在基本上都不行了。

    总之,GPT-4在内容的深度,广度都有明显的提升,同时还有着更强的边界感,知道什么该回答什么不该回答。

    其实更好玩的用法是图像输入,但是现在开始实验阶段,但是仅从公布的资料中就可以看到它的强大之处了。

    这个人用笔在本子上随便画了个自己网站的草图

    然后用手机把这个草图拍下来

    发送给GPT-4

    它识别出了这是一个网站的草图

    然后顺便生成了要建成这个网页的代码

    好了,你的网站建好了

    相比之下,这是原始的图

    它强就强在可以接受图片为输入,并且能准确理解图片中的含义。

    更多的例子可以看下面的详细介绍:

    平凡:GPT-4多模态模型最新最全介绍-下一代语言模型的力量与潜力

    OpenAI 发布多模态 GPT-4 模型,会开创哪些新的研究方向?

    hjl4am 2023-10-09 0 回复
没有账号?注册  忘记密码?