Layered Model Routing: How Planning and Execution Work Together

    Using the strongest model for every coding task wastes budget and time. This article explains how to split planning, execution, and review across model tiers, match models to failure cost, and keep agents cheaper and more reliable.

    In intelligent coding and automated R&D, teams often default to sending every hard task to the strongest, most expensive model. Quotas drain quickly and wait times grow, while success still depends on whether requirements were decomposed clearly, boundaries were locked, and tests covered the critical paths. Industry practice is increasingly clear: capability is not simply “more parameters, higher tier.” Splitting planning, review, and execution so different tiers own different jobs is often more stable and cheaper than one model doing everything.

    The real problem is missing role split, not a model that is “too small”

    Code agents face two different cognitive loads. One is architectural judgment, interface contracts, risk identification, and cross-module consistency—this needs strong reasoning, long context, and careful trade-offs. The other is editing files to a spec, adding tests, running checks, and fixing compile errors—this depends on following instructions, fast iteration, and parallelism. Binding both to one tier creates two kinds of waste: high-tier models doing mechanical work (cost blowups), and low-tier models doing global planning (wrong designs that force full-pipeline rework).

    A better abstraction than marketing “large / medium / small” cups is role layering on a task graph: a planner owns goals, constraints, and acceptance criteria; an executor owns local implementation and verification; a reviewer samples against those criteria. That matches architect / implementer / reviewer in software engineering, with the automatable parts handed to models.

    Bake in “mentor and apprentice”: turn human supervision into reusable policy

    Many teams already switch by hand: high tier for frameworks and APIs, lighter tier for boilerplate. It works until deadline pressure collapses everything onto the high tier. Encoding the policy as a workflow comes down to three rules.

    First, planning output must be executable. It should not be prose advice. It should be a task list: which paths to change, input/output contracts, modules that must not change, test commands, and pass criteria. Without checkable acceptance, the executor can only guess intent.

    Second, execution must be parallelizable and scoped. Isolate subtasks at file or function level. Put the scope in the prompt and repo constraints (for example, only a given directory) so a light model does not “look done” by touching unrelated config.

    Third, review must sample risk, not reread every line at the top tier. Prioritize public API changes, auth and data paths, concurrency and error handling, and whether tests hit real failure modes. On review failure, write back to planning—do not let the executor invent a new architecture.

    A sketch of the flow:

    1. Input requirement
    2. → Planner model: tasks, constraints, acceptance criteria
    3. → Dispatch executors in parallel: edit code + run tests
    4. → Reviewer model or human: sample against acceptance
    5. → On failure, replan locally; on success, merge

    This is not a vendor-specific feature. It is engineering “design then implement, contract then code.” In the cloud you can pair it with logs, alerts, and object storage for planning snapshots and test artifacts so you can trace which decomposition caused a regression.

    Why a lighter model can feel “more stable”: leaderboards are not your repo

    Public general, code-fix, and knowledge-work suites are often used to claim “small tiers can compete.” Treat three facts carefully.

    Leaderboard tasks usually have clear boundaries, tidy repos, and automatic fail/pass. Real work has implicit conventions, legacy, and environment drift. A top score means strong instruction following and local repair on that distribution—not independent system refactoring.

    Latency and context strategy change the feel. Light tiers are fast, so you get more retries and more parallel jobs in the same wall-clock time. For “change one function, add one assertion,” rapid trial-and-error can beat one slow, deep pass. That can feel like “small cup beats medium cup”; it is task shape matching the executor’s strengths.

    Do not invent or over-trust precise percentages and dollar demos. Dataset definitions, prompts, tool permissions, and timeouts rewrite scores. Teams should define their own metrics: time per request, quota burn, first-merge pass rate, rollback rate, escaped defects.

    A practical suggestion: run an internal gold set (10–30 real tickets) on “all high-tier” versus “high-tier plan + light-tier execute,” and compare quality and cost—do not buy from an external chart.

    Choose tier by cost of failure, not by brand

    Coarse-split work by failure cost.

    High cost: domain-model refactors, auth and audit, data migration, concurrency primitives, cross-service contracts. Planning and critical review should use a more reliable reasoning tier. Execution can still be local and light, but merge needs strong review and regression.

    Medium cost: ordinary business APIs, internal scripts, test completion, docs and type annotations. Planning can be mid-tier or templated; execution dominates; sampled review is enough.

    Low cost: formatting, renames, sample data, compile fixes from a clear error. Loop a light tier; the main cost of failure is time.

    “Nominally small, actually useful” usually happens on low- and medium-cost work with a crisp spec. If the spec is vague, light models go green on tests with wrong semantics, drop “extra” checks, or oversimplify with the wrong abstraction. That is weak constraints, not a mysterious model.

    Engineering details that actually cut spend

    Renaming the model is not enough; design context and tool rights.

    Control context: do not dump the whole repo into every execute step. Planning should emit a file list and snippet index; execution gets only what it needs. In long chats, periodically compress to “current goal + confirmed contracts + open issues” so a light model does not drift in noise.

    Tool allowlists: give executors edit, test, and read-only search. High-risk ops (dependency changes, permission config, production-related scripts) wait for review, then a human or high-tier confirmation. The expensive agent failure is often expanding the change surface, not one wrong business line.

    Isolate parallelism: two execute sessions must not write the same file. Serialize conflicting files with branches or a queue; parallelize the rest. Merge behind a unified test gate.

    Record decisions: constraints from each plan and rejection reasons from each review go in the repo or ticket so humans can take over and the next plan repeats fewer mistakes. Short-lived environments per run, a message queue for subtasks, and object storage for patches and logs are generic capabilities—not a proprietary API name.

    Humans stay in the loop: layering replaces repetition, not accountability

    Layered routing raises throughput; it does not waive responsibility. For security, compliance, money, and privacy, people must freeze acceptance criteria. Models may propose tests; they must not declare production-ready. Prompts should forbid inventing unverified APIs, deleting failing tests, and using mocks to hide real dependencies.

    For collaboration, standardize three artifacts: a planning note (for reviewers), patch plus tests (for the gate), and a risk list (for the owner). Missing any of them confuses “fast” with “correct.”

    Launch checklist

    Before a request: What is the failure-cost band? Can acceptance be a command or assertion? Can the change set be limited to directories? Which steps need a human? If the last three are unanswered, write the spec before starting the agent.

    While running, watch three signals: the executor keeps widening the diff; tests pass but contradict the verbal requirement; quota and latency are spent on repeated replan. The first two mean the contract is soft; the third means granularity is too coarse or too fine.

    Afterward, retro: which subtasks never needed a high tier, which reviews can become static rules (for example, never touch a given config file). The more rules you deposit, the more high-tier spend concentrates on real judgment.

    Closing

    “Small cup beats medium cup” is more accurately: once work is split into verifiable local jobs, a low-latency, instruction-stable executor is often cheaper than binding every step to a mid or high tier. If a platform offers “planner tier + executor tier” orchestration, it is productizing supervision experienced teams already use. What to hold onto is not a leaderboard rank, but executable plans, constrained execution, and review against criteria. Get those three right and the engineering ceiling is set by planning and review, while cost is amortized by parallel execution—a method you can copy, not a short-lived feel for one model SKU.