Ask HN: How is ChatGPT able to run code?
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)?
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)?
Outputting code and poems is one thing (there is no "correct" poem nor piece of code). Executing code is another: there is only one correct execution output for a given piece of code.
I don't know if rigorous CS proofs of "Turing Machine-Emulation" also hold for a Language model.
It gave me the correct code (which shows all 120 permutations when ran in Python) :
import itertools
word = "safer"
# Get all permutations of the word
permutations = itertools.permutations(word)
# Print each permutation
for permutation in permutations:
print(permutation)
It then showed the output, but got it wrong. It listed 24 permutations, then said ‘As you can see, there are 24 possible permutations of the word "safer".‘Interestingly, if you ask it how many permutations “safer” has, not asking about code, it invents some maths that produces 24 (see my reply in another post), so I guess it’s the understanding of permutations which is off.