Extrapolation extends a learned pattern beyond the examples that support it. For language models, familiar or structurally similar tasks often produce useful results, but reliability decreases as a task becomes more unique. section 4.3
From Python to Modula-3
A model correctly writes Python code to calculate pi because many similar examples exist online. Translating that function to obscure Modula-3 requires a larger leap, so the result contains three errors. The model confidently imports conventions from other languages, including an exponentiation operator that Modula-3 may not support. section 4.3
Listing 4.2 ChatGPT calculates pi in Modula-3
MODULE CalculatePi; #1
IMPORT IO, Real;
PROCEDURE CalculatePi(terms: INTEGER): REAL;
VAR
pi: REAL := 0.0;
i: INTEGER;
BEGIN
FOR i := 0 TO terms - 1 DO
pi := pi + ((-1.0) ** FLOAT(i)) / (2.0 * FLOAT(i) + 1.0); #2
END;
RETURN 4.0 * pi;
END CalculatePi;
BEGIN
IO.PutReal(CalculatePi(1000000), 0, 15); #3
END CalculatePi.
Inspect the Modula-3 translation to see how familiar coding patterns can look plausible while producing nonworking code. section 4.3
Treat extrapolated output as a plausible starting point, not automatic evidence of correctness:
- Expect stronger results for common tasks with abundant examples. section 4.3
- Increase scrutiny when the language, problem, or combination is unusual. section 4.3
- Watch for confident assumptions borrowed from related languages or patterns. section 4.3


