INQUIRING LINE

Why does training AI to copy one 'correct' answer code backfire, while training it to match a picture works better?

What makes code-matching training brittle compared to image-matching training?

This explores why training a model to reproduce exact reference code (for example, chart-to-code or image-to-code tasks) generalizes poorly, while training it to produce code whose rendered output looks like the target image holds up better on new data.


This explores why training a model to copy the exact 'correct' code is fragile, while rewarding it for code whose rendered picture matches the target transfers better. The central reason is that many different programs can draw the same image. If you train on one reference program, every valid alternative counts as wrong, so the model learns the surface habits of particular code samples instead of the skill of producing the right picture. RRVF drops text and code targets entirely and scores the model only on how closely its rendered output matches the source image. This works because checking a picture is much easier than writing the code that makes it Can visual matching alone train image-to-code models without text?. The payoff shows up on an unseen chart benchmark: RRVF-trained models kept 96% of their code running, down only 2 points, while supervised code-matching fell from 69% to 49% Does visual reward training generalize better than code matching?.

The second weakness is that matching code mostly teaches syntax, not meaning. CAD generation makes this split easy to see. Supervised fine-tuning alone got 91% of the generated CAD code to run, but the resulting shapes overlapped the targets only about 50% of the time. Chain-of-thought reasoning and then RL against a geometric score were needed to push that overlap to 72% Can CAD code be syntactically correct yet geometrically wrong?. Code can be perfectly valid and still draw the wrong thing, and token-level imitation can't tell those two cases apart. Chart-to-code shows a similar ceiling: supervised training levels off, and only adding visual-similarity rewards on top of cheap rule checks breaks through, by 6–10% on standard benchmarks Can visual similarity rewards break the chart-to-code learning plateau?.

The comparison isn't quite apples to apples, though. 'Code matching' here usually means supervised fine-tuning (SFT), and 'image matching' usually means reinforcement learning (RL). Part of the gap may come from SFT versus RL rather than from code versus pixels. Separate work finds that RL generalizes better mainly because it quietly gives less weight to the hardest training examples, and those hard examples cause most of SFT's overfitting Why does RL generalize better than SFT to new domains?. A related result in function calling points the same way: SFT struggles with rigid output formats, and training that shows the model explicit wrong answers fixes what plain imitation misses Can small models match large models on function calling?.

Image-matching rewards have their own risk. RL tends to latch onto one dominant output format from pretraining and suppress the alternatives, often within the first epoch Does RL training collapse format diversity in pretrained models?. Escaping code-matching's rigidity doesn't guarantee diversity. The honest summary is that code-matching is brittle because it rewards the wrong target, while image-matching is sturdier but can still narrow the model in other ways. The corpus doesn't yet have a direct head-to-head that separates the reward signal from the training method.


Sources 7 notes

Can visual matching alone train image-to-code models without text?

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.

Does visual reward training generalize better than code matching?

On an unseen chart benchmark, RRVF-trained models maintained 96% code execution accuracy (down only 2 points from training data), while supervised fine-tuning dropped from 69% to 49%. The difference suggests rewarding visual match rather than exact code teaches more transferable principles.

Can CAD code be syntactically correct yet geometrically wrong?

Supervised fine-tuning alone produces 91% executable CAD code but only 50% geometric IoU. Chain-of-thought reasoning raises IoU to 61%, while RL post-training pushes it to 72%, showing the two capabilities decouple during early training.

Can visual similarity rewards break the chart-to-code learning plateau?

MSRL pairs cheap rule-based textual rewards with costly MLLM-judged visual rewards comparing rendered code to ground-truth charts, improving ChartMimic and ReachQA scores by 6–10% beyond supervised-learning baselines. A two-stage curriculum applies textual rewards first, then adds visual feedback.

Why does RL generalize better than SFT to new domains?

RL achieves better OOD generalization not through algorithmic superiority but by implicitly down-weighting hard samples that drive gradient dominance and overfitting in SFT. Hard samples alone account for most of SFT's OOD degradation.

Show all 7 sources
Can small models match large models on function calling?

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.

Does RL training collapse format diversity in pretrained models?

Controlled experiments show RL consistently amplifies one format distribution from pretraining within the first epoch while collapsing alternatives. The winning format depends on model scale, not necessarily performance, and is largely hidden when starting from proprietary pretrained models.

Papers this line draws on 8

The research behind the notes this line reads — ranked by how closely each paper relates.