Can a variable name make max() look like min()?
Changing one variable name made a small coding model predict the opposite extreme, even in programs that explicitly called min() or max().
Download the research PDFWhat does this Python program print?
values = [7, -4, 8, 5, -1, -8, 6]
lowest_value = max(values)
print(lowest_value)
Python prints 8. Qwen2.5-Coder answered −8, the smallest number in the list. When the variable was named result, the same model answered 8.
Testing the same code under three names
A 48-program pilot suggested that names mattered most on loops that find a minimum or maximum. The follow-up fixed the scoring rule in advance and tested fresh programs on Qwen2.5-Coder-1.5B-Instruct and SmolLM2-1.7B-Instruct. Each model answered 200 programs under three names, for 1,200 predictions in all.
For a loop that computes a maximum, the accurate name was highest_value, the neutral name was result, and the misleading name was lowest_value. Python checked that renaming the variable left the output unchanged. The experiment tracked one particular error across all three versions. It counted cases returning the minimum when the code computes the maximum, or the maximum when it computes the minimum.
| Model | Neutral name | Misleading name |
|---|---|---|
| Qwen2.5-Coder | 1 of 64 | 43 of 64 |
| SmolLM2 | 0 of 64 | 4 of 64 |
Qwen moved toward the opposite extreme on 42 loops. Seventeen of those predictions had been correct. The other 25 had already been wrong. SmolLM2’s four switches all started from another wrong answer, and it solved only one loop correctly with a neutral name.
What if the code literally says max()?
The same lists were also tested with explicit min() and max() calls. Under neutral naming, Qwen returned the opposite extreme zero times. Under misleading naming it did so 29 times. On 26 of those 64 programs, the rename turned a correct answer into the exact opposite. SmolLM2 went from zero to 19, all of which had already been wrong.

How far the finding travels
On the primary loop test, the increase was 65.6 percentage points for Qwen and 6.3 points for SmolLM2. Resampling the 32 input lists gave descriptive 95% intervals of 51.6 to 78.1 and 1.6 to 12.5 points. The smaller effect rests on four changed lists.
On parity counts, signed sums, and first or last positive values, the changes were much smaller. These results describe two small quantized models, one prompt, and short Python programs. Whether the same pattern appears in longer code or with larger models remains open.
Study materials
The ZIP contains the protocol, the Python scripts, and all 1,344 pilot and replication responses. To reproduce the replication results, extract the ZIP and run python -B analyze.py.