Effective Planning Strategies and Optimization Methods for Large Language Models in Complex Tasks

    This article explains why planning quality—not raw generation fluency—determines how well large language models handle complex tasks, and how to turn strong planning ability into a repeatable, testable agent development workflow. It covers a practical evaluation approach that separates planning from execution, a weighted planning-quality scoring rubric, two worked examples (an interactive spreadsheet prototype and a procedural visual scene), model selection by responsibility, cost accounting and control methods, and reusable planning prompt and checklist templates.

    1. In Complex Tasks, Planning Quality Is the Real Differentiator

    When large language models move beyond code completion and text generation into application building, scene generation, and multi-module collaboration, the meaningful differences show up less in whether a single answer reads well and more in whether the model can break a vague goal into an executable engineering plan. The stage that consumes most of the development effort is usually not the final code implementation, but whether the upfront planning was sufficient: Are the requirement boundaries clear? Can the modules be split? Are the interfaces well defined? Are risks addressed early? Are the acceptance criteria actionable?

    This article uses “method analysis” rather than “benchmark and analysis” for a specific reason: without stating the tested model, tool versions, sample size, measurement period, and usage accounting basis, a single instance of high token consumption cannot be directly interpreted as a lack of model capability. To run a formal benchmark, you should at minimum document: model name and version, calling interface, task samples, input length, number of retries, test period, token counting method, and deliverable acceptance results.

    The focus here is therefore a general question: How do developers evaluate a large language model’s planning ability on complex tasks, and how do they convert strong planning into a landable, reproducible, and verifiable agent development process?

    2. Evaluation Method: Separate Planning from Execution

    For complex tasks, a more reliable approach is not to have a single model do all the work in one pass, but to separate planning from execution: first let a model with stronger planning ability produce the top-level design as a structured document, then let a more efficient execution model or AI coding tool implement the code, complete tests, and perform local optimization based on that document.

    This approach offers at least three benefits.

    First, cost is more controllable. The planning stage can call a more capable model, while the execution stage can use a cheaper model or tool, avoiding the need to use expensive models for every step.

    Second, responsibilities are clearer. The planning model owns architecture, interfaces, risks, and acceptance; the execution model owns implementation. If the final result is poor, it is easier to tell whether the plan was incomplete or the execution deviated.

    Third, planning quality is easier to evaluate. Whether the code runs is only an outcome. Whether the architecture is clear, the interfaces are reasonable, the risks are identified, and the acceptance criteria are executable better reflects the model’s value as a development assistant or technical architect.

    The planning stage’s goal can be abstracted into the following structure:

    1. TaskPlan = {
    2. goal: Clear objective and scope,
    3. nonGoals: What will explicitly NOT be done this time,
    4. constraints: Performance, cost, compatibility, and maintainability constraints,
    5. architecture: Module breakdown and dependencies,
    6. interfaces: Inputs, outputs, state, and exception definitions,
    7. dataModel: Core data structures,
    8. workflow: Main flow and critical paths,
    9. risks: Risk points and mitigation strategies,
    10. acceptance: Acceptance criteria and test cases
    11. }

    A high-quality plan should not be just a “feature list.” It should be an engineering blueprint that can guide development, testing, and acceptance.

    To evaluate planning quality, you can apply the following scoring rubric after the planning output. It can be used for both manual review and automated review pipelines.

    Dimension Weight Key question Scoring guidance
    Completeness 25 Does it cover goal, non-goals, modules, interfaces, data, workflow, risks, and acceptance? Deduct 5 points for each missing key module or acceptance item
    Interface clarity 20 Are inputs, outputs, exceptions, boundary conditions, and state changes defined? Interfaces with names but no constraints score at most 10
    Risk coverage 20 Does it identify risks such as performance, state consistency, circular dependencies, and failure recovery? Deduct 10 points if there is no risk mitigation plan
    Cost estimation 20 Does it specify call scope, context control, retry strategy, and model tiering? Plans without cost control should be penalized heavily
    Testability 15 Does it provide test cases, acceptance thresholds, and regression methods? A plan that cannot be verified is considered incomplete

    A plan with a total score below 75 should not enter the execution stage directly; 80 or above can move into development; 90 or above can be saved as a reusable template.

    3. Task One: Planning an Interactive Spreadsheet Prototype

    The first sample is building an interactive spreadsheet prototype. The goal is not to replace a mature commercial product, but to test whether the model can plan a core prototype that is editable, calculable, undoable, and persistent.

    The difficulty in this kind of task lies not in the UI but in the data flow and state management. The planning stage must first define a clear data model, for example:

    1. Workbook
    2. └── Sheet
    3. └── Cell
    4. ├── value
    5. ├── formula
    6. ├── style
    7. └── dependencies

    A cell must store more than its final value; it must also store the formula expression, reference relationships, style, and result cache. Otherwise, when a cell is modified, the system cannot know which cells need recalculation.

    The formula system is a key module. A rigorous plan should include:

    • Expression parser: converts formulas into a structured syntax tree;
    • Reference analyzer: identifies which cells a formula depends on;
    • Dependency graph builder: establishes dependency relationships between cells;
    • Calculation scheduler: recomputes the affected region in topological order;
    • Error handler: handles empty values, division by zero, type errors, and circular references.

    If the planning stage has no notion of a dependency graph, the implementation easily degenerates into “recalculate the entire sheet on every change,” causing performance to degrade quickly.

    The performance section cannot merely say “optimize recalculation”; it needs quantifiable acceptance thresholds. It is recommended that the prototype plan specifies:

    • Baseline acceptance scale: no fewer than 5,000 cells;
    • Stress test scale: 50,000 cells;
    • Input feedback target: keyboard input to UI state update in under 50 milliseconds;
    • Single-point recalculation target: recalculation in under 200 milliseconds after a normal formula change;
    • Incremental trigger conditions: use incremental recalculation when the proportion of affected cells is below 20% or the dependency depth is less than 5;
    • Degradation strategy: switch to chunked calculation, deferred calculation, or manual triggering when the recalculation scope exceeds the threshold;
    • Test method: generate a formula network via script, modify key cells, and record timing and result consistency.

    Undo, redo, and persistence also need to be defined in advance. For a spreadsheet, a more reasonable undo approach is usually to record operation commands, such as “set cell value,” “insert a row,” “delete a column,” and “change style,” rather than saving a full snapshot every time. The persistence section should define a serialization format and consider exception recovery: If saving fails, is export allowed? If the file is corrupted, does it fall back to the autosave? If these are not clarified in advance, the execution stage tends to produce a lot of rework.

    Acceptance criteria can include:

    • Can sheets be created, deleted, and renamed?
    • Can cells be edited and saved immediately?
    • Can basic formulas be parsed?
    • When a referenced cell is modified, are its dependents updated automatically?
    • Can circular references be detected?
    • Can undo and redo roll back correctly?
    • After saving and reloading, is the content consistent?
    • Does it remain responsive under larger data volumes?

    4. Task Two: Visual Scene Planning and Iterative Refinement

    The second sample shifts to visual generation: using scripted drawing capabilities to build complex scenes and continuously refine them aesthetically. On the surface this is “drawing,” but it actually tests the model’s integrated planning ability over visual structure, randomness, performance, and aesthetics.

    “Aesthetics” cannot be handed directly to the model for execution; it must first be translated into engineering parameters. In the planning stage, aesthetic goals can be decomposed into:

    • Composition: subject position, visual center, and spatial proportions;
    • Color: primary color, secondary colors, contrast colors, and saturation range;
    • Light and shadow: light source direction, shadow layers, and highlight positions;
    • Layers: background, midground, foreground, occlusion, and particles;
    • Detail: texture density, edge roughness, and noise intensity;
    • Atmosphere: fog effects, halos, grain, and warm/cool tendencies.

    Only when aesthetic goals are converted into parameters can the model generate reliably, rather than depending on an accidental result.

    Complex scenes should use a layered rendering structure:

    1. Scene
    2. ├── BackgroundLayer
    3. ├── MidgroundLayer
    4. ├── ForegroundLayer
    5. ├── LightLayer
    6. ├── ParticleLayer
    7. └── PostProcessLayer

    The background layer handles distant views and spatial depth, the midground layer handles the main structure, the foreground layer handles occlusion and detail, the lighting layer unifies the atmosphere, the particle layer handles dynamic effects, and the post-processing layer converges the overall style.

    Random generation must introduce determinism. To support debugging, reproduction, and iteration, the plan should define seed management, parameter export, and rollback flows. A recommended sequence is:

    1. For each generation, record the random seed, parameter version number, rendering order, and model prompt;
    2. Output seed.txt and params-v1.json to ensure parameters are recoverable;
    3. Generate a baseline screenshot as a comparison reference for later rounds;
    4. Each time composition, color, or lighting is adjusted, create a new version, such as params-v2.json;
    5. If the result gets worse, roll back to the previous version’s parameters and re-render;
    6. Use screenshot comparison, color histograms, structural similarity, and human ratings for integrated acceptance.

    If the scene consists of a large number of primitives, performance must also be considered. Drawing item by item directly can lead to slow rendering or even blocking the main thread. More reasonable strategies include:

    • Batch static primitives together;
    • Clip invisible regions;
    • Reuse templates for repeated elements;
    • Pre-render complex textures into caches;
    • Update dynamic parts in separate layers;
    • Cap the number of primitives per frame.

    Acceptance for visual tasks is more subjective than for functional tasks, but it can still be engineered. You can check:

    • Is there a clear visual focal point?
    • Do foreground, midground, and background show clear layers?
    • Is the color palette unified?
    • Do light and shadow support the spatial structure?
    • Does detail density interfere with subject recognition?
    • Does style stay consistent across multiple generations?
    • Is the image still balanced after parameter adjustments?

    5. Core Traits of Models with Strong Planning Ability

    Looking across both tasks, “strong planning ability” does not mean a model can produce a very long document. It means the model can identify complexity in advance and decompose a complex problem into engineering modules that are executable, verifiable, and maintainable.

    Models with strong planning ability usually share these traits:

    1. Clear requirement boundaries: They can distinguish prototype validation from production systems and will not blindly pile on features.
    2. Reasonable module division: They separate the data layer, logic layer, rendering layer, interaction layer, and testing layer.
    3. Clear interface definitions: They do not just give function names; they also define inputs, outputs, exceptions, and boundary conditions.
    4. Early risk identification: They consider circular references, performance bottlenecks, state inconsistency, and failure recovery in advance.
    5. Strong cost awareness: They plan context splitting, model tiering, and retry strategies.
    6. Testable and verifiable: They provide test cases, acceptance criteria, and regression methods.

    6. Cost Accounting and Control for Complex Tasks

    It is not surprising that complex tasks burn through API quota quickly, but high consumption cannot be equated with low efficiency. The key is to clarify the accounting basis and determine whether the consumption was exchanged for reusable outcomes.

    A recommended accounting basis is:

    1. Total tokens = Input tokens + Output tokens
    2. Total calls = Planning calls + Coding calls + Testing calls + Retry calls
    3. Effective cost ratio = Value of reusable deliverables / Total call cost

    For example, a complex task might produce the following calls:

    1. Planning calls: 120,000 tokens
    2. Coding calls: 480,000 tokens
    3. Testing calls: 180,000 tokens
    4. Failed retries: 120,000 tokens
    5. Total: 900,000 tokens

    If these 900,000 tokens ultimately produce architecture documents, runnable modules, test cases, and an acceptance checklist that can be reused in subsequent iterations, development costs for later phases will drop significantly. Conversely, if the calls only produce one-off code with no documentation, no tests, and no boundary statements, then high consumption may indeed indicate low efficiency.

    Methods to control cost include:

    • Do not stuff all materials into the context at once;
    • Split tasks by module and provide only the documents needed for the current module;
    • Build templates and caches for high-frequency tasks;
    • Give architecture planning to a stronger model and code completion to a cheaper model;
    • Set an upper limit on failed retries and record the failure reasons;
    • Use automated checks instead of repetitive manual follow-up questions.

    For model selection, you can tier by responsibility:

    • Architecture planning, risk assessment, and solution comparison: prefer models with strong reasoning and good context understanding;
    • Code generation, test completion, and comment generation: prefer fast, low-cost execution models;
    • Large repository understanding: choose long-context models, but still trim irrelevant files;
    • Simple formatting and batch replacement: lightweight models or rule-based tools are sufficient.

    7. Practical Optimization Advice and Reusable Templates

    To better serve development, you can establish a stable workflow.

    First, documents before code. Do not let the model jump straight into code generation. First produce the architecture description, module list, interface definitions, and task breakdown, then move to implementation.

    Second, tier model usage. Use strong models for planning, risk, and acceptance; use execution models for coding, testing, and completion.

    Third, control context scope. Provide only the necessary documents, interface descriptions, and local code each time, reducing interference from irrelevant information.

    Fourth, build templates. Templatize common tasks, such as an application prototype planning template, a visual scene generation template, a testing and acceptance template, and a cost estimation template.

    Fifth, introduce automated acceptance. Define acceptance criteria during the planning stage and run checks automatically during execution.

    The following planning prompt template can be reused directly:

    1. You are a senior technical architect. Based on the following goal, output a complete task plan.
    2. Task goal:
    3. [Fill in the goal]
    4. Non-goals:
    5. [Fill in what will NOT be done this time]
    6. Constraints:
    7. [Performance, cost, compatibility, maintainability]
    8. Please output:
    9. 1. System architecture and module breakdown;
    10. 2. Core data structures;
    11. 3. Interface definitions, including inputs, outputs, exceptions, and boundary conditions;
    12. 4. Key workflows;
    13. 5. Risk list and mitigation strategies;
    14. 6. Acceptance criteria and test cases;
    15. 7. Cost estimation and model tiering suggestions;
    16. 8. A self-assessment of planning quality, out of 100 points.
    17. Requirements:
    18. - Do not write the full code directly;
    19. - Do not omit the acceptance criteria;
    20. - If information is insufficient, list the questions that need clarification.

    Planning checklist:

    • Are the goals and non-goals clearly defined?
    • Is it broken down into independently implementable modules?
    • Are interface exceptions and boundary conditions defined?
    • Are performance and failure risks identified?
    • Are acceptance criteria and testing methods provided?
    • Are context trimming and cost control addressed?
    • Is it ready to be handed to an execution model for implementation?

    Common mistakes:

    • Only writing a feature list with no architecture or acceptance criteria;
    • Interfaces with only function names, no inputs, outputs, or exceptions;
    • Deferring risks until code fails, then patching afterwards;
    • Visual tasks with no seed and no parameter versioning, making them impossible to reproduce;
    • Generating a huge context in one go, raising cost and making maintenance difficult;
    • Not distinguishing planning from execution, leaving responsibilities unclear.

    8. FAQ: Common Questions About Complex Task Planning

    How do you evaluate a large language model’s planning quality?
    Use the planning-quality scoring rubric across five dimensions: completeness, interface clarity, risk coverage, cost estimation, and testability. A total score below 75 is not recommended for direct execution.

    How do you avoid wasting quota on complex tasks?
    Plan before executing, control the context, split tasks by module, set an upper limit on failed retries, use strong models for key decisions, and use low-cost models for repetitive implementation.

    How do you choose models?
    Give architecture, risk, and acceptance to a strong planning model; give code generation, test completion, and comments to a faster execution model; use long-context models for long-context tasks, but still trim irrelevant content.

    How do you validate visual refinements?
    Translate aesthetics into parameters, record seeds and parameter versions, keep baseline screenshots, and run multi-round evaluation through screenshot comparison, color consistency, and human ratings.

    9. Conclusion: Planning Ability Sets the Ceiling for Complex Tasks

    The value of large language models in complex tasks is shifting from “generating a piece of code” to “planning a complete solution.” Strong planning ability helps developers turn vague requirements into clear blueprints and turn uncontrollable generation into engineering workflows that can be decomposed, verified, and reused.

    For agent development, what truly matters is not whether the model can generate everything in one shot, but whether it can continuously produce high-quality designs at limited cost, steadily control risks, and move the project forward step by step. As model capabilities and engineering processes continue to merge, planning ability, cost control ability, and acceptance ability will become key standards for measuring the quality of complex task development.