>_ Code-with-Image
Self-Evolving Visual Reasoning

Self-Evolving Code-with-Image Reasoning

Some visual questions can't be answered by looking. A frozen model must write and run a real visual algorithm — the program becomes the reasoning — and it teaches itself which algorithm to write.

Tianze Yang1,2, Liang Wu1, Ruitong Sun2, Yucheng Shi2, Yanqiao Wang2, Mayank Darbari1, Ninghao Liu3, Jin Sun2, Liangjie Hong1
1Nokia  ·  2University of Georgia  ·  3The Hong Kong Polytechnic University
12.9→66.6
GPT-5.6-luna: tool-free CoT → self-evolved skills
8.6→55.9
Qwen3.5-27B (open): CoT → self-evolved skills
30
task families, every target beyond inspection
∞
constructively-labeled instances, no collection cap
01 Abstract

When code carries the reasoning

Thinking-with-images uses tools to expose visual evidence, then reasons in language. Some questions leave no gap a better view can fill — they require running an algorithm over the pixels.

Some visual questions have exact answers that no amount of looking reveals — you have to run an algorithm over the pixels. Give a frozen model only a Python interpreter and the program becomes the reasoning. Then let it teach itself which program to write: a training-free loop turns its own failed code into portable skills.

01 · BENCHMARK

CwI-Bench

30 task families, answers beyond inspection, labeled by construction — no cap, no human annotation.

02 · METHOD

Self-evolving skills

The model reads (and re-runs) its own failed programs to grow a small library of portable skills. No gradients.

03 · RESULT

Code > thinking

An interpreter beats extended thinking; skills add 19–24 more points; they transfer across scale and family.

02 How it works

The program is the reasoning; the loop finds the program

A frozen model solves each task by Code-with-Image. Failed trajectories drive two reflection modes, and a delivered skill ships only if it beats the bare solver on a held-out split.

01

Code-with-Image

The image enters a Python sandbox as data. The model writes a program that computes the answer — running it is the reasoning.

02

Self-reflection

It reads its own failed attempts and edits a skill library; when stuck, it re-runs the failures in the sandbox and checks repairs against gold.

03

Gated delivery

A skill ships only if it beats the bare solver on a held-out split, then rides along in the frozen model's prompt — plain, transferable text.

03 The benchmark

30 task families, four abilities

Each family is a program that constructs an image from a known latent target, so the label is correct by construction and instances can be generated without bound. No reference toolchain exists to imitate.

Transformation
12
task families
Cyclic shifts, rotate/scale recovery, jigsaw & unshuffle, transform chains, restore-then-count.
Perception
6
task families
Grating period, anomaly grids, faint-blob counting, congruent pairs, trace length, scan moiré.
Localization
7
task families
Crop provenance, brightest blob, swapped rectangles, retouch region, circle fit, print misreg, gain centers.
Color
5
task families
Film color under a translucent strip, swatch RGB, patch means, color counting, channel mixing.
04 Beyond inspection

Answers no amount of looking determines

The wheel lists all 30 families; the cards around it are real instances with their exact answers.

CwI-Bench overview: 30 tasks across four families with example instances, questions, and exact answers
05 Results

One ladder, six executors, portable skills

An interpreter lifts accuracy where thinking barely moves it; self-evolved skills add another large step; and the skills are plain text that transfers across scale and family.

The ladder Skill transfer

CoT → Code-with-Image → + self-evolved skills

Held-out test accuracy (%). Three separate bars per model.
Chain-of-thought Code-with-Image (PoT) + Self-evolved skills
Extended thinking barely closes the gap the interpreter opens — GPT-5.6-luna Thinking is 25.0, still far below Code-with-Image at 43.0.
FINDING 01 · medium

An interpreter, not more thinking

On questions that require running an algorithm, extended thinking barely helps, while a bare Python interpreter lifts every executor from 8B to frontier scale.

→ The bottleneck is the medium, not the chain length.
FINDING 02 · procedure

Self-evolved skills add 19–24 points

A training-free reflection loop turns the model's own failed programs into portable procedures, adding another large step on top of the interpreter.

→ Knowing which algorithm to write is learnable, without gradients.
FINDING 03 · repair

Executable reflection carries the gain

Paired ablations attribute a quarter to a third of the total skill gain to executable reflection — the faults that never print require re-execution to see.

→ Debugging code becomes debugging reasoning.
06 Citation

Cite this work

If you find Code-with-Image or CwI-Bench useful, please cite the paper.

@article{yang2026cwi,
  title   = {Self-Evolving Code-with-Image Reasoning},
  author  = {Yang, Tianze and Wu, Liang and Sun, Ruitong and Shi, Yucheng and Wang, Yanqiao and Darbari, Mayank and Liu, Ninghao and Sun, Jin and Hong, Liangjie},
  journal = {arXiv preprint},
  year    = {2026},
  url     = {https://github.com/YangTianze009/LVLM_POT}
}