GPT-4 is not only able to write code, more reliably than GPT-3.5, it writes code that writes code; see the example below (GPT-3.5 was not able to do this). But first, let me say:
2) Everyone else: many companies and projects will not be this open about their shortcomings and safety issues. Time to regulate, please!
Okay, here's the example... GPT3.5 wasn't able to do this, but GPT-4 nailed it on the first try:
PROMPT:
Can you write me a python script that does the following three things? 1) When you run it with no argument, it prints "Hello world" to standard out. 2) When you run it with an argument "-s", it prints its own source code. As a constraint, I do not want the script to read or write to disk at all (so it can't get its source code by just reading the file that it's in).
Thanks if you can help with this! I'm curious to see how you do it.
BEGIN RESULT (works perfectly):
Sure! Here's a Python script that should do what you're looking for. This script uses a feature called quines, which are programs that can print their own source code:
import sys
def main():
source_code = 'import sys\n\ndef main():\n source_code = {!r}\n if len(sys.argv) > 1 and sys.argv[1] == "-s":\n print(source_code.format(source_code))\n else:\n print("Hello world")\n\nif __name__ == "__main__":\n main()'
if len(sys.argv) > 1 and sys.argv[1] == "-s":
print(source_code.format(source_code))
else:
print("Hello world")
if __name__ == "__main__":
main()
When you run this script without any arguments, it will print "Hello world". When you run it with the "-s" argument, it will print its own source code without reading or writing to disk.
END RESULT
I'm not sure how hard they tried specifically to train this, but it's worth knowing about for lots of reasons I probably don't have to explain at length right here.
Their training objective is just to minimize next token prediction error, so there is no incentive for them to gain the ability to truly reason about the abstractions of code logic the way that we do. Their convincing ability to write code may nevertheless indicate that the underlying neural networks have learned representations that reflect the hierarchical structure of code and such. Under some forgiving definition of "understanding" we can perhaps claim that it understands the code logic. Personally I think that the reason GPT-4 can write quines is because there are countless examples of it on the internet, not because it has learned generally about code and is now able to leap into some new qualitatively different abstraction by itself. Personally, I have used GPT-3 as an assistant in a lot of machine learning projects and I always find that it breaks down whenever it is outside the dense clouds of data points it was trained on. If the project relates to the implementation of something quite simple but unique, performance suffers dramatically. All of my interactions with it on the code front indicate that it does very little in terms of generalisation and understanding of coding as a tool, and does everything in terms of superpowered autocompletion from a ridiculously large corpus of code.
GPT-4 is not only able to write code, more reliably than GPT-3.5, it writes code that writes code; see the example below (GPT-3.5 was not able to do this). But first, let me say:
1) @OpenAI: Thank for your openness to the world about your capabilities and shortcomings! Specifically, thanks for this:
https://cdn.openai.com/papers/gpt-4-system-card.pdf
2) Everyone else: many companies and projects will not be this open about their shortcomings and safety issues. Time to regulate, please!
Okay, here's the example... GPT3.5 wasn't able to do this, but GPT-4 nailed it on the first try:
PROMPT:
Can you write me a python script that does the following three things?
1) When you run it with no argument, it prints "Hello world" to standard out.
2) When you run it with an argument "-s", it prints its own source code.
As a constraint, I do not want the script to read or write to disk at all (so it can't get its source code by just reading the file that it's in).
Thanks if you can help with this! I'm curious to see how you do it.
BEGIN RESULT (works perfectly):
Sure! Here's a Python script that should do what you're looking for. This script uses a feature called quines, which are programs that can print their own source code:
When you run this script without any arguments, it will print "Hello world". When you run it with the "-s" argument, it will print its own source code without reading or writing to disk.
END RESULT
I'm not sure how hard they tried specifically to train this, but it's worth knowing about for lots of reasons I probably don't have to explain at length right here.