Multi-Model Orchestration: A Layered Scheduling Approach to AI Coding
This article explains why letting a single high-capability model run continuously over an entire repository and long conversation history tends to fail, and how splitting planning, scheduling, and execution into three layers addresses the problem. It covers context pollution, cost imbalance, and review feedback overhead; the responsibilities of each layer; a sample task card; a capability-to-task matching table; context governance practices; common anti-patterns; and a step-by-step adoption path. The core takeaway is that multi-model collaboration works by assigning each role the right context and the right task granularity, trading a small amount of extra tokens for more stable output quality and a more controllable cost curve.
1. The Problem: Why “Unlimited Ammo” Execution Spirals Out of Control
A common pattern in real-world AI coding tools is to keep one high-capability model reading the full repository and the entire conversation history, then have it handle planning, coding, and self-review in one continuous run. This looks efficient because it avoids the overhead of switching roles, but it exposes three problems.
The first is context pollution. Long histories are mixed with failed attempts, discarded approaches, and redundant logs. When the model resumes work, it is easily pulled off course by earlier conclusions: the plan may be correct while the implementation drifts.
The second is a distorted cost structure. Using the strongest reasoning model to repeatedly read through long tasks and long histories puts high-value compute on low-value repeated reading. Meanwhile, the stage that actually produces code is often handled by a weaker role, creating an inversion where the model that thinks the most writes the least, and the model that writes the most is the weakest.
The third is review feedback cost. When output quality is insufficient, the repository and conversation history have to be fed back to the strong model in full for review, which amplifies token consumption further, and the review conclusions are hard to capture in a structured form.
2. The Core Idea: Split Planning, Scheduling, and Execution into Three Layers
A more robust approach is to layer by responsibility rather than stacking single points by “who is stronger.”
- Planning layer: a strong reasoning model works with high-quality context to produce goals, constraints, acceptance criteria, and task breakdowns, outputting structured documents rather than free-form text.
- Scheduling and acceptance layer: a mid-tier model with stable long-context performance handles task distribution, status tracking, and result verification, acting as a middle management layer.
- Execution layer: a low-latency, low-cost model completes single-point coding in a clean context with no history, receiving only one task card.
A sample task card structure looks like this:
task_id: T-017goal: Add pagination parameters to the order query APIconstraints:- Do not change the existing response structure- New logic must have unit testscontext_refs: [docs/api.md#pagination, src/order/service.py]acceptance:- All unit tests pass- No new static analysis warningsoutput_format: patch + test
The key point is that context_refs provides only references and summaries, not entire history segments. Acceptance criteria are defined in advance by the planning layer, and the execution layer does not judge its own work.
3. Matching Model Capabilities: Let Models Do What They Are Relatively Good At
Whether layering holds up depends on whether the capability profile aligns with the task profile. A simple scoring table can drive the decision instead of assigning roles by intuition.
| Task type | Key capability | Recommended layer |
|---|---|---|
| Requirement clarification, tradeoff decisions | Long-chain reasoning | Planning layer |
| Task breakdown, progress verification | Context management | Scheduling layer |
| Single-file changes, script writing | Instruction following, low latency | Execution layer |
| UI operation, image recognition tasks | Multimodal perception | Execution layer (specialized) |
It is worth stressing that the execution layer is not a “low-spec” tier. It is a specialized role constrained to narrow tasks and clean context. Placing multimodal scenarios such as UI operation and screenshot understanding in the execution layer is often more economical than having the planning layer read images repeatedly.
4. Context Governance: Where the Real Gains Come From
The benefits of layering essentially come from reallocating the context budget.
- Read only the necessary fragments: use symbol indexes, interface signatures, and related tests as the minimal context set.
- Compress history: turn long conversation conclusions into decision records, keeping only conclusions and constraints while discarding process noise.
- Isolate in both directions: the execution layer does not inherit the planning layer’s failed attempts; acceptance conclusions are written back as structured fields rather than pasted in full.
- Make it reproducible: store task cards and acceptance results so they can be traced and re-orchestrated.
If an organization needs to host these artifacts, general-purpose capabilities can be used: object storage for task cards and patches, a message queue for task distribution, a container platform for running verification pipelines, and logging services with monitoring and alerting to track failure rates.
5. Common Anti-Patterns and How to Avoid Them
- Planning and execution in the same body: when one role both sets the criteria and evaluates itself, it tends to produce a false acceptance that “looks like it passed.”
- Missing acceptance criteria: without decidable conditions, the scheduling layer can only judge subjectively, and rework rates rise.
- Task granularity too coarse: a single task spanning multiple modules forces the execution layer’s context to expand, degrading back into the long-history pattern.
- Over-layering: when the task itself is very small, the fixed overhead of three-layer collaboration costs more than it saves, so a single role should be allowed to connect directly.
6. Recommended Adoption Steps
First, lock down an acceptance criteria template and make “decidable” a gating condition. Second, pilot the three-layer split on one or two low-risk modules, and track rework rate and token consumption. Third, gradually expand task card coverage, and feed failure cases back as constraint entries. Fourth, templatize high-frequency repetitive tasks to reduce how often the planning layer is invoked.
Overall, the value of multi-model collaboration lies not in stacking stronger models, but in having each role work with the right context at the right granularity. Layered scheduling trades a small amount of extra tokens for more stable execution quality and a more controllable cost curve, making it a practical engineering compromise today.
