HACKER Q&A
📣 dakiol

How is ChatGPT able to run code?


In https://news.ycombinator.com/item?id=33847479 it seems that ChatGPT was able to "execute" Python code (https://www.engraved.blog/content/images/2022/12/image-10.png). I somehow understand how ChatGPT can generate code (it has been trained on billions of lines of code)... but I don't fully understand how it can execute code. Execution of code requires 100% emulation of a given compiler. If X can emulate 100% a compiler, then effectively X is a compiler. Now, perhaps ChatGPT cannot execute 100% ANY Python snippet of code, but only some subset?

Or is it "just" that the AI has been trained on so much code (and the output of the code executed) that it effectively can replace a Python compiler (or any other compiler)?


  👤 neximo64 Accepted Answer ✓
Its not executing code, its guessing what the answer is, the same way you would do mentally.