← Latest papers
💻 computer science

Cascaded Code Editing: Large-Small Model Collaboration for Effective and Efficient Code Editing

This paper proposes a cascaded code editing framework that leverages a large model to generate concise edit sketches and a smaller, more efficient model to apply them, thereby balancing effectiveness and efficiency while addressing the limitations of small models in handling long contexts and cross-file dependencies.

Original authors: Chaozheng Wang, Zezhou Yang, Shuzheng Gao, Cuiyun Gao, Zongjie Li, Yichen Li, Ting Peng, Hailiang Huang, Yuetang Deng, Michael R. Lyu

Published 2026-04-22
📖 4 min read☕ Coffee break read

Original authors: Chaozheng Wang, Zezhou Yang, Shuzheng Gao, Cuiyun Gao, Zongjie Li, Yichen Li, Ting Peng, Hailiang Huang, Yuetang Deng, Michael R. Lyu

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are a master architect (a Large AI Model) tasked with renovating a massive, 100-story skyscraper. The client gives you a simple note: "Make the elevators safer by adding a 'stop if the door is open' feature."

The Old Way: The "Over-Engineered" Architect

In the traditional approach, the master architect takes the note, walks up to the 100th floor, and rewrites the entire blueprint of the building from the ground up. They redraw the foundation, the lobby, the kitchens, and the bedrooms, even though they haven't changed a single thing about them. They only actually modified the elevator shafts on the 10th floor.

The Problem:

  • Wasted Effort: The architect spends hours redrawing things that were already perfect.
  • High Cost: This takes a long time and costs a fortune in "architect fees" (computing power).
  • Slowness: You have to wait hours for the full blueprint to be finished, even though you only needed a small fix.

The New Way: The "Cascaded" Team

This paper proposes a smarter, two-person team approach called Cascaded Code Editing. Instead of one person doing everything, they split the job based on their strengths.

Step 1: The Master Architect (The Large Model)

First, the master architect looks at the blueprints and the client's note. Instead of redrawing the whole building, they write a concise sketch or a "sticky note" that says exactly what needs to change:

"In the elevator code on line 45, add a check: if door_open: stop."

They ignore the 99 floors of unchanged code. This takes seconds and costs very little.

Step 2: The Skilled Foreman (The Small Model)

Next, this sketch is handed to a Skilled Foreman (a smaller, faster, cheaper AI model). The Foreman's job is simple:

  1. Look at the original, massive blueprint.
  2. Find the exact spot mentioned in the sketch.
  3. Paste the new instruction into the blueprint.
  4. Hand back the finished, updated building.

Why is this better?

  • Speed: The Foreman is much faster at pasting small changes than the Master Architect is at rewriting whole books.
  • Cost: The Master Architect only does the "thinking" part (the sketch), which is short. The Foreman does the "copy-pasting" (the heavy lifting), which is cheap.
  • Quality: The Master Architect is smart enough to know what to change, and the Foreman is trained specifically to be precise at where to put it.

The Secret Sauce: Training the Foreman

The paper realized that while the Master Architect is great at making sketches, the Foreman (small models) used to be a bit clumsy. If the building was huge (long code), the Foreman would get lost, forget where to paste the change, or accidentally delete the wrong floor.

To fix this, the authors created a giant training school for these Foremen:

  1. The Dataset: They gathered over 100,000 real-world examples of "Before Blueprints" and "After Sketches" to teach the Foremen how to spot the right spot.
  2. Curriculum Learning: They didn't just throw the Foremen into the deep end. They started them on small, single-room renovations (short code) and gradually moved them up to the 100-story skyscrapers (long code).
  3. Multi-File Training: They also taught the Foremen how to handle renovations that affect multiple buildings at once (cross-file dependencies), which is a common real-world headache.

The Results

When they tested this new team:

  • Cheaper: It cost 19% less money to run.
  • Faster: It finished 13% faster.
  • Better: Surprisingly, the final building was often more accurate than if the Master Architect had tried to do it all alone. The Master Architect focused purely on the logic, while the trained Foreman ensured the details were perfect.

In a Nutshell

This paper is about specialization. Instead of paying a genius (Large Model) to do a janitor's job (rewriting unchanged code), you pay the genius to design the plan and a highly trained, efficient assistant (Small Model) to execute the plan. By teaching that assistant how to handle huge, complex buildings, you get the best of both worlds: genius-level planning with budget-level speed and cost.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →