cd /news/large-language-models/my-llm-compiler-fixed-a-student-s-bu… · home › topics › large-language-models › article
[ARTICLE · art-177370] src=dev.to ↗ pub= topic=large-language-models verified=true sentiment=· neutral

My LLM compiler fixed a student's bug. Nobody asked it to

A developer building Pseudo.NET, a compiler for free-form pseudocode that uses a local qwen2.5-coder:7b model via Ollama to produce a JSON syntax tree and a deterministic C# backend, found that the compiler silently repaired a student's bug when a comment stated the intended goal. In a six-case fidelity test, the 7B model preserved the mistake in five of six programs, but inserted a missing `total = 0;` reset in the running-total case; removing the goal comment (control f3b) restored faithful transcription, and the 14B model kept every mistake. The developer also disclosed that a hand-written backend fallback (`return default;`) had masked a missing-return bug in a `sign` function, fixed in version 0.4.6 to halt with an error instead.

recommendation

Test transcription fidelity with paired programs that differ only by a goal comment, and prefer a 14B model over 7B when exact reproduction of flawed logic matters.

more in playbook: Evals and testing for LLM apps
by read4 min views6 publishedNov 27, 2026

Here are two programs. They are identical except for the first line.

// Goal: print the sum of each row of a 3 x 3 table whose rows are 1 2 3
total = 0
repeat row from 1 to 3 {
  repeat col from 1 to 3 {
    total = total + col
  }
  print total
}
total = 0
repeat row from 1 to 3 {
  repeat col from 1 to 3 {
    total = total + col
  }
  print total
}

Both contain the same mistake: total is never reset, so the program prints 6, 12, 18 instead of 6, 6, 6. Compiled with the same compiler, the same model and the same settings, the second program prints 6, 12, 18. The first one prints 6, 6, 6.

The compiler fixed the bug. The comment told it what the student wanted, and it obliged.

I build Pseudo.NET, a compiler for free-form pseudocode. A local model (qwen2.5-coder:7b through Ollama) reads whatever the student wrote and produces a JSON syntax tree; a deterministic backend then writes C#, and the program runs.

For a teacher, one property matters more than any other: the compiler must transcribe the student's logic, mistakes included. A student learns from seeing their program fail. A compiler that quietly repairs the program teaches them that it was right.

I wrote six deliberately wrong programs, each with a comment stating the intended result:

Case Mistake
f1 loop from 1 to 4 to "add 1 to 5"
f2 while i less than 5 , stops one step early
f3 running total never reset (the program above)
f4 inverted test: under 18 prints "adult"
f5 return inside the loop
f6 operator precedence: a + b / 2

Each one goes through the real compiler and the real model, with an empty cache, and runs. The expected output is what the code really does, not what the comment says.

The model kept the mistake in five of the six. In f3, it added total = 0; at the start of the outer loop:

for (row = 1; row <= 3; row++)
{
    total = 0;            // not in the student's program
    for (col = 1; col <= 3; col++)
    {
        total = (total + col);
    }
    Console.WriteLine(total);
}

To find out why, I added a control, f3b: the same program without the comment. It was transcribed faithfully. The trigger is the comment that states the goal.

I added two short instructions to the system prompt, asking the model to transcribe exactly, mistakes included. Neither changed anything on f3. My reading, which I have not proven: for a 7-billion-parameter model, a concrete sentence about the goal weighs more than a general rule.

Same tests (f1 to f6 plus the control f3b, before f7 existed), same model family, one run each:

Model Size Fidelity (7) AP CSP-style (10) Divisibility phrasings (6)
qwen2.5-coder:7b (default) 4.7 GB 6 5 6
qwen2.5-coder:14b 9 GB 7 6 5
qwen2.5-coder:3b 1.9 GB 3 1 0
qwen2.5-coder:1.5b 1 GB 2 0 0

The 14b model kept every mistake, f3 included. The small models mostly failed for another reason: their code did not compile.

To make f5 compile, I had added a line to the deterministic backend: when a function does not return a value on every path, end it with return default;. A review pointed out what that does to a function like this one, which forgets zero:

define sign(x) {
  if x > 0 then return 1
  if x < 0 then return -1
}

sign(0) returned 0. A plausible value, no error, and the mistake was hidden. The same repair I was testing the model for, written by hand, in the part of the compiler with no AI in it.

Since version 0.4.6, the program stops at that point instead: "The function sign ended without returning a value." That case is now f7 in the test, and it passes.

One run per case. At temperature 0 the output is close to deterministic, not strictly. One model family. No remote model measured. And the bugs tested are all local, one line each. The next cases I want to try are well-known algorithms slightly wrong, such as a bubble sort that reads past the end or a binary search that never stops, because that is where a model is most likely to recognise the algorithm and rewrite it.

The programs (f1 to f7, plus the control f3b), their expected outputs, the generated C# and the script are in the repository: https://github.com/pseudonet-lang/pseudonet/tree/main/docs/examples/faithfulness

For teachers, what Pseudo.NET does and does not do, with these results: https://pseudonet-lang.github.io/educators/

── more in #large-language-models 4 stories · sorted by recency
── more on @pseudo.net 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/my-llm-compiler-fixe…] indexed:0 read:4min 2026-11-27 · —