Low-Cost Development with Strong LLM Planning: Separating Planning from Execution

    This article explains why end-to-end, single-session LLM usage can exhaust a monthly token quota after just two tasks, and how to control cost by splitting planning from execution. It presents a three-layer structure (planning, execution, validation), task card constraints, two reproducible capability probes (a spreadsheet-style calculation kernel and code-generated visual rendering), a three-tier budget model, and common pitfalls with workarounds. The goal is to turn vague requirements into a deterministic engineering path and make model evaluation quantifiable.

    1. Background: Why “Two Tasks Burn Through the Monthly Quota” Is a Warning Sign

    In real software production, a recurring pattern appears: a developer describes a goal in one natural-language sentence and asks the model to produce the result end to end. It looks highly efficient in the short term, but the token consumption curve often rises exponentially. “Two tasks exhaust the monthly allowance” is not a model capability problem; it is a usage problem. Cramming planning, implementation, debugging, and refactoring into a single session causes the context to swell repeatedly and ineffective retries to stack up.

    To understand this, distinguish two kinds of work:

    • Planning work: requirement clarification, scope definition, module decomposition, data structure design, interface contracts, milestone breakdown. The output is documents and decisions. Token consumption correlates with problem complexity but stays largely controllable.
    • Execution work: writing code to a fixed plan, adding tests, fixing compile errors. The output is code. Token consumption correlates strongly with code volume and iteration count, and can easily spiral out of control.

    The conclusion is direct: separating planning from execution—using a stronger planning model to produce an “executable blueprint,” then a lower-cost model to carry it out—is the first-principles approach to cost control.

    2. Core Method: Layering Planning and Execution

    2.1 Layered Structure

    The recommended three-layer structure:

    1. Planning layer: outputs architecture decisions, module lists, data structures, interface contracts, and acceptance criteria, persisted as local documents (e.g., docs/spec.md, docs/tasks.md).
    2. Execution layer: takes the documents as the only input and implements task card by task card. Ad-hoc scope expansion is forbidden.
    3. Validation layer: runs automated tests and static checks against the acceptance criteria. On failure, retry at the task card level rather than reopening a global session.

    2.2 Key Constraints

    • Planning documents must be “executable by a stranger”: consistent terminology, explicit interface signatures, clearly written boundary conditions.
    • Keep each task card at a granularity achievable in half a day to one day, avoiding overly long contexts.
    • The execution layer may not modify the architecture on its own. When it finds a design flaw, it writes the issue back to a problem list for the planning layer to decide.

    A sample task card structure:

    1. task_id: T-014
    2. goal: Implement persistence for the cell style model
    3. inputs: [docs/spec.md#style-model]
    4. outputs: [src/style/store.ts, tests/style/store.test.ts]
    5. acceptance:
    6. - Read/write round-trip is consistent
    7. - Invalid input returns a structured error
    8. budget: { max_rounds: 3 }

    3. Capability Probe Design: Measuring Real Ability at Controllable Cost

    To evaluate a model’s engineering ability, “generate a large application from one sentence” end to end is neither economical nor reproducible. A more rigorous approach is to pick probe targets with bounded complexity and automatable acceptance.

    3.1 Probe One: Prototype-Level Replication of Spreadsheet Software

    A spreadsheet-style application works as a yardstick because its complexity is widely recognized in the industry: the core difficulty is not the UI but the dependency graph and recalculation scheduling.

    A minimum viable kernel should include:

    • Sparse cell storage with bulk range reads and writes;
    • Formula parsing (lexing → syntax tree → evaluation);
    • Dependency graph construction and topological sorting, with circular reference detection;
    • Incremental recalculation and dirty-region propagation;
    • Undo/redo and a persistence format.

    Dependency management is the dividing line. A runnable verification snippet:

    1. def recalc(cells, deps):
    2. order, cyclic = toposort(deps)
    3. if cyclic:
    4. raise CyclicReference(cyclic)
    5. for addr in order:
    6. cells[addr].value = evaluate(cells[addr].formula, cells)
    7. return cells

    Acceptance criteria should be quantified, for example: a sparse sheet of ten thousand formulas produces correct results in a single full recalculation, circular references are reported accurately, and incremental updates trigger only the affected subgraph.

    3.2 Probe Two: Controllable Beautification in Generative Visuals

    The second dimension examines aesthetic sense and numerical approximation: draw a high-density set of strokes in pure code to reconstruct a scene with depth (such as a dungeon-like blue space), then progressively add light falloff, volumetric fog, and grain noise.

    Evaluation should not stop at “does it look similar” but break into measurable metrics:

    • The relationship between stroke count and rendering time;
    • Deviation of the color histogram from the target distribution;
    • Image quality metrics such as structural similarity;
    • Convergence speed after parameter fine-tuning.

    This design converts “aesthetics” into regression-testable engineering metrics and avoids subjective arguments.

    4. Cost Model and Budget Management

    The root cause of cost overruns is the absence of budget constraints. Introduce three tiers of budget:

    • Task budget: set a maximum number of interaction rounds and a maximum token cap for each task card;
    • Stage budget: set thresholds for planning, implementation, and validation separately; stage overruns require human confirmation;
    • Monthly budget: use the subscription allowance or pay-as-you-go billing as the boundary, with warning lines (e.g., 60%, 85%).

    Also follow three practices: keep only the necessary document fragments in context; downgrade failed retries to smaller tasks; and turn reusable specs, templates, and scaffolds into local assets to reduce repeated reasoning.

    When deploying on the cloud, general-purpose capabilities can carry the engineering steps: object storage holds build artifacts, a message queue decouples long-running tasks, a container platform hosts parallel execution, and logging plus monitoring and alerting handle cost observability and anomaly localization. This turns cost from a “black-box bill” into “attributable metrics.”

    5. Common Pitfalls and How to Avoid Them

    • Planning that spins in place: documents state goals but not interfaces, forcing the execution layer to make its own decisions and pushing cost back up. Avoid it by mandating interface contracts and acceptance clauses.
    • Scope creep: requirements added mid-execution. Avoid it by routing every change back to the planning layer to form a new task card.
    • Missing acceptance: without automated tests, the model will be “confidently wrong.” Avoid it by writing acceptance cases before implementation.
    • Single-session dependence: all context piled into one session. Avoid it by sharding per task and treating documents as the single source of truth.

    6. Conclusion

    The value of strong planning ability is not how much code it generates in one shot, but turning vague requirements into a deterministic engineering path. With the three-stage method—planning persisted as documents, execution handed to a low-cost stage, validation closed by automation—the monthly allowance becomes a predictable linear expense, and model capability evaluation is upgraded from subjective impression to reproducible, quantifiable experiments. For teams building intelligent development workflows in cloud environments such as Baidu AI Cloud, this paradigm can serve directly as a blueprint for implementation.