Table of Contents
1. The JavaScript function accepts a variable number of arrays and returns the intersection
Reference link:
Home Technology peripherals AI Three PK games exposed the level of ChatGPT!

Three PK games exposed the level of ChatGPT!

Apr 12, 2023 am 10:37 AM
chatgpt Microsoft code

​Author|Xu Jiecheng

Reviewer|Yan Zheng

While Google and Microsoft are fiercely competing to seize the AI ​​search engine market, some programmers are Not interested in eating melon. Because they have realized in advance that when this search war comes to an end, the software giants will continue to carry ChatGPT or other artificial intelligence generation tools and stride towards the blue ocean of automatic coding. By then, not to mention being a loser, even your own job may be threatened.

In today's automatic coding field, the two most mature and well-known AIs are ChatGPT, which has been in the limelight recently, and Copilot, the AI ​​programming tool launched by Microsoft in June last year. , and these "two" are also the popular stars who are most expected to replace programmers at this stage. So for now, what are the coding capabilities of ChatGPT and Copilot? Will they really replace all junior and even some intermediate developers in the short term as rumored?

Recently, an American technical expert used multiple JavaScript function requirements to test the capabilities of ChatGPT and Copilot in data processing and algorithm generation. Next, let us use these results to understand the current real level of AI in coding, and then ask ourselves, will we really be replaced?

1. The JavaScript function accepts a variable number of arrays and returns the intersection

In the first test, the tester first asked ChatGPT and Copilot to generate a JavaScript function, with specific conditions For: Need to be able to accept a variable number of arrays and return their intersection.

OpenAI ChatGPT:

Three PK games exposed the level of ChatGPT!

##Microsoft Copilot:

Three PK games exposed the level of ChatGPT!

The function generated by ChatGPT assumes that providing less than an array is invalid. By using Set, ChatGPT ensures that there are no duplicates in the results. Intersection should be a set operation and duplicates should be removed. The Copilot code returns an array that may contain duplicates.

Neither ChatGPT nor Copilot sorts the original parameters in ascending order according to length. This is a trivial optimization, but it can bring about huge changes. If any argument has length 0, there is no intersection; it shortens the loop anyway because the maximum intersection is the same as the shortest array argument.

Subsequently, the testers asked ChatGPT and Copilot to improve the execution efficiency of the function.

OpenAI ChatGPT:

Three PK games exposed the level of ChatGPT!

##Microsoft Copilot:

Three PK games exposed the level of ChatGPT!

Faced with the above problem, Copilot generated the same code as the previous request. ChatGPT gave a different answer and added a comment saying that the function does not work on objects as expected, but this description is not accurate.

Then, the testers used the same method to check the operating efficiency and memory consumption of the code generated by the two fastest intersection libraries provided by ChatGPT and Copilt.

Three PK games exposed the level of ChatGPT!

The code generated by ChatGPT takes up less CPU when executed, but the running efficiency is not ideal, and the code generated by Copilot Although the code uses less heap, its CPU usage and operating efficiency are poor.

In short, in this test, neither ChatGPT nor Copilot can generate efficient enough code; ChatGPT made wrong assumptions in this question; and the function generated by Copilot has parameters When duplicate values ​​are included, code is generated that does not produce a collection.

2. JavaScript function: Cartesian product

The second test requires ChatGPT and Copilot to complete a Cartesian product JavaScript function.

OpenAI ChatGPT:

Three PK games exposed the level of ChatGPT!

##Microsoft Copilot:

Three PK games exposed the level of ChatGPT!

Anyone familiar with Cartesian products will know that from the perspective of memory utilization and performance, the results generated by ChatGPT and Copilot are explosive. A simple implementation would consume a lot of RAM to store all combinations and not return the result until all combinations have been generated. The functions generated by ChatGPT and Copilot both have these shortcomings.

Subsequently, testers once again asked ChatGPT and Copilot to improve function efficiency.

OpenAI ChatGPT:

Three PK games exposed the level of ChatGPT!

##Microsoft Copilot :

Three PK games exposed the level of ChatGPT!

In response to this demand, ChatGPT’s performance is surprising. But in the overall function, ChatGPT made a serious mistake. yield [item,...result] is not inside the generator, but in a recursion. Copilot simply ignored the change in demand and returned the same results as before.

In terms of code running efficiency and memory consumption, the performance of ChatGPT and Copilot is as shown in the table below.

Three PK games exposed the level of ChatGPT!

Overall, neither ChatGPT nor Copilot can generate the correct code for the Cartesian product function; ChatGPT will make a code that may be invalid. Assumptions, such as requiring two parameters; although the detection results show that the code generated by ChatGPT is more memory efficient, it does not run smoothly at all.

3. JavaScript function stores objects and original parameters

In the third round, the testers asked the two to generate JavaScript functions that can store objects and original parameters.

OpenAI ChatGPT:

Three PK games exposed the level of ChatGPT!

##Microsoft Copilot:

Three PK games exposed the level of ChatGPT!

In this regard, both ChatGPT and Copilot generated relatively inefficient codes. It is very efficient to convert strings first and then compare strings. Poor and consumes a lot of memory.

Although there are some JavaScript values ​​that cannot be converted to strings, such as Infinity and NaN. Unfortunately, the JavaScript JSON specification was defined before the era of data science and microservices, and these values ​​exist mainly so that when certain error conditions occur in the code, the program can also use specific values ​​to represent the results produced.

Finally, in order to verify the function efficiency, the tester compared the code generated by ChatGPT and Copilot with the commonly used caching tools nano-memoize and micro-memoize, and used the following code to generate the first 12 Fibonacci numbers.

Three PK games exposed the level of ChatGPT!

Three PK games exposed the level of ChatGPT!

# Among them, nano-memoize is the most efficient one , which is almost twice as efficient as the code generated by ChatGPT and Copilot, and the memory used is also the lowest, while the performance of micro-memoize can be said to be closely followed. Although Copilot performs well in terms of CPU utilization, overall, the performance of ChatGPT and Copilot in this test is still not enough to defeat a mature programmer.

4. Summary and prediction

Through these three tests, we can easily find that although the code generated using ChatGPT and Copilot is definitely Has a certain value. But for now, neither ChatGPT nor Copilot can generate sufficiently accurate and efficient code from simple task descriptions, and even in some cases, they make some very bad mistakes. After learning about this result, many developers also expressed that they felt that they could persist for a few more years.

For today's enterprises or programmers, if you want to use ChatGPT, Copilot or other code generation tools to help you complete some simple auxiliary coding tasks to speed up the build, then You can definitely get enough support. But if you want to rely on them to completely liberate R&D, then you may need to spend a lot of money to equip it with a strong debugging team.

However, even if this is the result, today we still cannot ignore the potential of AI in the field of automatic coding and the powerful software companies behind these systems. What is certain is that as the amount of training and technology maturity increases, future automatic coding tools will continue to expand their business data in different scenarios, and gradually try to solve some more professional and scenario-based practical tasks.

Finally, as to the question "Can AI replace programmers in the future?", perhaps the most reliable answer at present is the former head of Alibaba Israel Machine Vision Laboratory Itamar Friedman once said The prediction made in the interview - "In the next 10 to 20 years, artificial intelligence systems will make it possible for non-programmer creators to use natural language instructions to develop without errors, and our world will still need a lot of programmer, but his role may change in unpredictable ways."

https://medium.com/@anywhichway/chatgpt- vs-copilot-vs-programmers

https://github.com/anywhichway/nano-memoize

https://github.com/planttheidea/micro-memoize

The above is the detailed content of Three PK games exposed the level of ChatGPT!. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1666
14
PHP Tutorial
1273
29
C# Tutorial
1252
24
ChatGPT now allows free users to generate images by using DALL-E 3 with a daily limit ChatGPT now allows free users to generate images by using DALL-E 3 with a daily limit Aug 09, 2024 pm 09:37 PM

DALL-E 3 was officially introduced in September of 2023 as a vastly improved model than its predecessor. It is considered one of the best AI image generators to date, capable of creating images with intricate detail. However, at launch, it was exclus

Microsoft releases Win11 August cumulative update: improving security, optimizing lock screen, etc. Microsoft releases Win11 August cumulative update: improving security, optimizing lock screen, etc. Aug 14, 2024 am 10:39 AM

According to news from this site on August 14, during today’s August Patch Tuesday event day, Microsoft released cumulative updates for Windows 11 systems, including the KB5041585 update for 22H2 and 23H2, and the KB5041592 update for 21H2. After the above-mentioned equipment is installed with the August cumulative update, the version number changes attached to this site are as follows: After the installation of the 21H2 equipment, the version number increased to Build22000.314722H2. After the installation of the equipment, the version number increased to Build22621.403723H2. After the installation of the equipment, the version number increased to Build22631.4037. The main contents of the KB5041585 update for Windows 1121H2 are as follows: Improvement: Improved

Microsoft Win11's function of compressing 7z and TAR files has been downgraded from 24H2 to 23H2/22H2 versions Microsoft Win11's function of compressing 7z and TAR files has been downgraded from 24H2 to 23H2/22H2 versions Apr 28, 2024 am 09:19 AM

According to news from this site on April 27, Microsoft released the Windows 11 Build 26100 preview version update to the Canary and Dev channels earlier this month, which is expected to become a candidate RTM version of the Windows 1124H2 update. The main changes in the new version are the file explorer, Copilot integration, editing PNG file metadata, creating TAR and 7z compressed files, etc. @PhantomOfEarth discovered that Microsoft has devolved some functions of the 24H2 version (Germanium) to the 23H2/22H2 (Nickel) version, such as creating TAR and 7z compressed files. As shown in the diagram, Windows 11 will support native creation of TAR

Microsoft's full-screen pop-up urges Windows 10 users to hurry up and upgrade to Windows 11 Microsoft's full-screen pop-up urges Windows 10 users to hurry up and upgrade to Windows 11 Jun 06, 2024 am 11:35 AM

According to news on June 3, Microsoft is actively sending full-screen notifications to all Windows 10 users to encourage them to upgrade to the Windows 11 operating system. This move involves devices whose hardware configurations do not support the new system. Since 2015, Windows 10 has occupied nearly 70% of the market share, firmly establishing its dominance as the Windows operating system. However, the market share far exceeds the 82% market share, and the market share far exceeds that of Windows 11, which will be released in 2021. Although Windows 11 has been launched for nearly three years, its market penetration is still slow. Microsoft has announced that it will terminate technical support for Windows 10 after October 14, 2025 in order to focus more on

Microsoft launches new version of Outlook for Windows: comprehensive upgrade of calendar functions Microsoft launches new version of Outlook for Windows: comprehensive upgrade of calendar functions Apr 27, 2024 pm 03:44 PM

In news on April 27, Microsoft announced that it will soon release a test of a new version of Outlook for Windows client. This update mainly focuses on optimizing the calendar function, aiming to improve users’ work efficiency and further simplify daily workflow. The improvement of the new version of Outlook for Windows client lies in its more powerful calendar management function. Now, users can more easily share personal working time and location information, making meeting planning more efficient. In addition, Outlook has also added user-friendly settings, allowing users to set meetings to automatically end early or start later, providing users with more flexibility, whether they want to change meeting rooms, take a break or enjoy a cup of coffee. arrange. according to

Microsoft plans to phase out NTLM in Windows 11 in the second half of 2024 and fully shift to Kerberos authentication Microsoft plans to phase out NTLM in Windows 11 in the second half of 2024 and fully shift to Kerberos authentication Jun 09, 2024 pm 04:17 PM

In the second half of 2024, the official Microsoft Security Blog published a message in response to the call from the security community. The company plans to eliminate the NTLAN Manager (NTLM) authentication protocol in Windows 11, released in the second half of 2024, to improve security. According to previous explanations, Microsoft has already made similar moves before. On October 12 last year, Microsoft proposed a transition plan in an official press release aimed at phasing out NTLM authentication methods and pushing more enterprises and users to switch to Kerberos. To help enterprises that may be experiencing issues with hardwired applications and services after turning off NTLM authentication, Microsoft provides IAKerb and

Microsoft Edge Android version now provides Copilot translation function, and the Windows version is under small-scale testing Microsoft Edge Android version now provides Copilot translation function, and the Windows version is under small-scale testing Apr 27, 2024 am 08:40 AM

According to news from this site on April 26, as we all know, Microsoft is currently trying its best to promote its AI assistant Copilot. In addition to the Copilot that comes with Windows 10/11, the Copilot function is also integrated in the Edge browser and Office. At present, Copilot still has weaknesses compared to AI tools such as GPT, but some of the functions it provides are also very practical for Windows users and Edge users, such as its own translation function. As discovered by @Leopeva64, Microsoft has added this feature to the Android version of the EdgeDev browser and is also testing it for a small number of desktop Edge users. This site points out that C

Tsinghua University and Zhipu AI open source GLM-4: launching a new revolution in natural language processing Tsinghua University and Zhipu AI open source GLM-4: launching a new revolution in natural language processing Jun 12, 2024 pm 08:38 PM

Since the launch of ChatGLM-6B on March 14, 2023, the GLM series models have received widespread attention and recognition. Especially after ChatGLM3-6B was open sourced, developers are full of expectations for the fourth-generation model launched by Zhipu AI. This expectation has finally been fully satisfied with the release of GLM-4-9B. The birth of GLM-4-9B In order to give small models (10B and below) more powerful capabilities, the GLM technical team launched this new fourth-generation GLM series open source model: GLM-4-9B after nearly half a year of exploration. This model greatly compresses the model size while ensuring accuracy, and has faster inference speed and higher efficiency. The GLM technical team’s exploration has not

See all articles