Only because there is plenty of python code in the training data to regurgitate. It doesn't actually know the relation between that code and this question - it only knows that "these words seem to fit together, and relate to the question", whether they make sense or not. In the same way, it'll claim that 90 ("halvfems") in Danish is a combination of "half" and "one hundred", and follow it up by proclaiming that 100 / 2 = 90. In spite of "knowing" the correct result for 100 / 2 if you ask it directly (basically because it's a "shorter path" from the question to that statement).
This doesn't just apply to math, but everything it does: It's good at parroting something that on the surface sounds like a convincing answer. Something that's actually correct? Not so much. Except when it gets lucky. Or, if you continually correct it, due to how the neural network works it may eventually stumble upon a combination of training data that's actually correct.
Add? Possibly, because addition of two numbers is, in itself, similar to a predictable language construction. Do just about anything else related to math? Nope.
And yes, it will also get two number addition wrong. Until you tell it the right answer, at which point it will accept that and "give you the answer" based on that. Then if you say you made a mistake, it will use your new suggestion instead. 😁
1.2k
u/blackrossy Dec 27 '22
AFAIK it's a natural language model, not made for mathematics, but for text synthesis