Training code-writing AI to match reference code line-by-line misses what really matters: does the code actually work?
What other code generation tasks face similar uniform loss limitations?
This explores which kinds of code generation suffer when training scores every token of the output equally against reference code, when what actually matters is whether the code renders correctly, runs correctly, or meets constraints that a handful of tokens decide.
This explores which code generation tasks suffer when training treats every token of the output as equally important, even though a few tokens decide whether the code works. The corpus has no note that names 'uniform loss' directly. It does have a group of papers on tasks where matching reference code token by token is the wrong target, and each one replaces that target with something else.
The clearest group is visual code: code whose correctness only shows up once it is rendered. Two programs can differ in almost every token and draw the same chart, or differ in one CSS value and break a page layout. Can visual matching alone train image-to-code models without text? drops text matching entirely for image-to-code tasks. It renders the model's code and rewards how closely the picture matches the source image. This works because checking a match is much easier than writing the code. Can multimodal LLMs judge front-end code quality better than tests? does the same for front-end web code, using a multimodal judge that scores screenshots. It adds a hard rule: code that fails to render gets zero reward, so the model can't earn points for broken output. The lesson that carries across: if the output is something a person looks at, train on what they will see.
Accessibility is a second case, and a less obvious one. Whether a page is accessible often comes down to a few small attributes, such as ARIA labels, focus order, and keyboard handling. Those are a tiny share of the tokens, but they decide whether a screen-reader user can use the page. Can feeding accessibility violations back into code generation improve results? feeds an accessibility checker's error reports back into generation, and that beats every prompting strategy it was tested against. Yet the hardest ARIA problems still go unsolved, which suggests that pointing at the important tokens doesn't teach the model the knowledge needed to get them right.
Function calling is the third case. A single misplaced bracket or wrong argument name makes the whole call fail. Can small models match large models on function calling? finds that plain fine-tuning on correct examples falls short here. Training that also shows the model wrong examples (DPO) targets these strict format failures directly, because it puts extra pressure on exactly the tokens that separate a working call from a broken one.
The less expected part: some limits that look like training-loss problems are really about how the model generates. Why does autoregressive generation fail at constraint satisfaction? argues that code-like tasks with hard constraints, such as scheduling or puzzle solving, hit a ceiling because the model can't take back a token once it has written it. Reweighting the loss can't fix that. Adding a solver can. Similarly, Do large language models actually perform iterative optimization? shows models writing out plausible-looking numbers instead of actually running the steps of an optimization method. Even after you switch to rewards, Why do language models collapse into generic templates? warns of another trap: if most attempts get similar scores, the model drifts toward generic boilerplate. So the practical map has three parts. Rendered, accessible, and format-strict code all benefit from outcome-based rewards. Constraint-heavy and iterative-computation tasks probably need help from outside the model itself.
Sources 7 notes
RRVF rewards MLLMs for how closely rendered code output matches the source image, not for matching ground-truth text or code. This leverages asymmetry-of-verification: checking if rendered output matches is easier than generating code, making visual similarity a tractable RL reward signal.
ReLook trains a reward model on visual screenshots rather than unit tests, using a strict zero-reward rule for invalid renders to prevent reward hacking. It outperformed baselines across three benchmarks by embedding pixel-level visual judgment into the policy training loop.
FeedA11y's ReAct-based feedback loop significantly outperforms zero-shot, few-shot, and self-criticism prompting by iteratively feeding evaluator results back into generation. However, it still struggles with nuanced ARIA constraints like keyboard navigation and focus management, suggesting evaluator feedback alone cannot substitute for domain expertise.
Small models fine-tuned via DPO on correct and incorrect function-calling examples from a large teacher model achieve high accuracy on logical and mathematical tasks. DPO's explicit negative examples directly target the rigid output format failures where SFT alone underperforms.
The performance ceiling on constraint satisfaction problems is not a model-quality issue but an architectural limitation: autoregressive transformers cannot retract emitted tokens, while CSP solvers fundamentally depend on discarding invalid partial assignments. Symbolic solver integration works because it supplies what the architecture lacks.
Show all 7 sources
Research shows LLMs cannot perform iterative procedures in latent space. They recognize optimization problems as template-similar and emit plausible-looking but incorrect values, a failure mode that persists across model scale and training approaches.
When within-prompt reward variance is low, task gradients weaken and regularization dominates, pushing policies toward generic outputs. SNR-Aware Filtering—selecting high-variance prompts before updates—recovers performance across tasks and scales.
Papers this line draws on 8
The research behind the notes this line reads — ranked by how closely each paper relates.
- ReLook: Vision-Grounded RL with a Multimodal LLM Critic for Agentic Web Coding
- Learning Only with Images: Visual Reinforcement Learning with Reasoning, Rendering, and Visual Feedback
- Rendering-Aware Reinforcement Learning for Vector Graphics Generation
- Echo Chamber: RL Post-training Amplifies Behaviors Learned in Pretraining
- Code Aesthetics with Agentic Reward Feedback
- Can Large Language Models Reason and Optimize Under Constraints?
- LIMO: Less is More for Reasoning
- Improving Small-Scale Large Language Models Function Calling for Reasoning Tasks