From Answering to Doing: Engineering Post-Training for Large Language Models

    A practical walkthrough of how post-training goals for general-purpose LLMs have shifted from single-turn answer quality to end-to-end task completion, covering data validity, ablation-driven pipelines, interleaved thinking, orchestration design, trainable aesthetics, and a rebuilt evaluation system. The article shows why the engineering system around a model, not the model alone, is what separates "agents that can finish the job" from those that cannot.

    In recent technical discussions, one question keeps gaining traction: why does the progress of each new generation of general-purpose models feel less like “more parameters” and more like “finally able to get work done”?

    Behind that observation is a migration of the training objective. For the past two years, mainstream benchmarks have centered on the correctness of single-turn question answering—whether the answer is accurate, whether the reasoning is coherent, and whether the knowledge coverage is adequate. But once a model is placed in real-world settings such as software engineering, terminal operation, and project-level refactoring, a harsh fact surfaces: single-turn accuracy and end-to-end task success rate are only weakly correlated.

    A model can produce a “looks correct” response at every turn, yet drift completely off course after turn 7. It can also make a small mistake at one turn but, if it has self-correction ability, still finish the task. This has driven a fundamental shift in the post-training objective:

    Dimension Traditional post-training Agent-oriented post-training
    Optimization target Single-turn answer quality End-to-end task success rate
    Cost of failure One wrong answer The entire trajectory fails
    Key capabilities Knowledge coverage, fluent expression Planning, tool use, error correction, wrap-up
    Evaluation form Static benchmark scoring Trajectory evaluation inside executable environments

    Once you understand this shift, the engineering decisions that follow all make sense.

    1. Data Engineering: From “Volume” to “Validity”

    The first lesson is counterintuitive yet repeatedly confirmed: the growth curve of raw data volume flattened long ago; data “validity” is where the marginal return now lies.

    Validity can be broken down into three actionable criteria: whether the sample can be automatically verified (it compiles, it passes tests, the answer is decidable); whether it sits near the model’s capability boundary (too easy carries no information, too hard is all noise); and whether it aligns with the target distribution (if you are building an engineering agent, you should feed it more multi-file, cross-turn, tool-using trajectories rather than purely static text).

    More important is a per-domain strategy. Code, mathematics, and scientific text define “good data” completely differently, and a single cleaning rule set will inevitably do harm:

    • Code: license compliance, compilability, runnable tests, deduplication threshold control, difficulty-stratified sampling;
    • Math: automatically verifiable answers, step-by-step checkable derivation chains;
    • Scientific text: complete citations, entity-consistency checks, timestamp and version tagging.

    2. Bringing Software Engineering Methodology into the Training Flow

    This point is the most worth borrowing: do not push everything into a full run at once—run ablations on a small model first.

    1. # Sample configuration for a per-domain data pipeline (pseudo-config)
    2. data_pipeline:
    3. domains:
    4. - name: code
    5. filters: [license_ok, compilable, test_pass, dup_ratio_lt_0.15]
    6. sampling: difficulty_stratified
    7. - name: math
    8. filters: [answer_verifiable, chain_checkable]
    9. gate: # release gate
    10. method: ablation
    11. proxy_model_scale: small # validate with a smaller model of the same architecture
    12. metrics: [task_success_rate, trajectory_length, tool_error_rate]
    13. rollback: on_regression # rollback condition

    The flow is structurally identical to a staged rollout: validate the gain on a small proxy model → scale up the mixture ratio only if the gain holds → roll back the moment metrics regress. The value of this mechanism is that it turns a “data recipe” from alchemy into a reproducible, auditable, and rollback-capable engineering asset. Any change to the mixture can answer three questions: what changed, what gain is expected, and how do you prove it works.

    3. Interleaved Thinking: Let the Model “Think While Doing”

    In agent tasks, the most damaging failure is not a single-point error but planning wrong at the very first step and then staying wrong all the way down. Because every subsequent step is built on a mistaken premise, the cost of correction grows exponentially.

    The idea is to change thinking from a “one-time upfront action” into a “state that runs throughout”:

    • Interleaved thinking: reasoning and tool calls alternate; each time a new observation arrives, the plan is re-evaluated rather than thinking through everything first and then executing blindly;
    • Retained thinking: the basis for the previous turn’s judgment is carried forward, avoiding repeated reasoning and self-contradiction;
    • Turn-level thinking: a reasoning summary is kept separately within each turn, for recovery, auditing, and human intervention.
    1. # Pseudo-code: main loop of an agent with interleaved thinking
    2. async def run_agent(task, tools, max_turns=30):
    3. state = AgentState(goal=task, history=[], evidence=[])
    4. thinking = None
    5. for _ in range(max_turns):
    6. thinking = await model.think( # 1) think first, do not output the final answer directly
    7. goal=state.goal,
    8. observation=state.history[-1] if state.history else None,
    9. prior_thinking=thinking, # 2) keep the previous turn's thinking to avoid repeated reasoning
    10. tool_schemas=tools.schemas(),
    11. )
    12. decision = parse_action(thinking)
    13. if decision.type == "final":
    14. return decision.payload, verify(state) # 3) there must be a verification step before delivery
    15. observation = await tools.invoke(decision) # 4) think while doing
    16. state.history.append((decision, observation))
    17. state.evidence.extend(observation.get("evidence", []))
    18. raise BudgetExceeded(task) # 5) explicit budget boundary, not unlimited retries

    Three easily overlooked engineering details are here: thinking results must be separated from the final answer (otherwise the model will output a guess as a conclusion); the budget must be explicit (set upper limits on turns, tokens, and tool-call counts); and failures must be attributable (switch hypotheses after the same strategy fails twice, rather than continuing to tweak parameters).

    4. The Model Is Not Everything: The Framework Side Matters Just as Much

    A widely underestimated fact is that in agent scenarios, model capability is only part of the end-to-end success rate. Some teams have noted in public technical talks that framework and orchestration quality can influence the final success rate on the order of thirty percent. This means that with the same model, a different orchestration scheme can produce a noticeable cliff in usability.

    Three areas are worth polishing:

    1. Structured system prompts. Rather than writing a long passage of natural language, provide explicit role, workflow, constraints, tool-selection criteria, termination conditions, and failure-handling strategy.

    1. [Role] Software engineering agent responsible for end-to-end delivery
    2. [Workflow] Locate -> Plan -> Minimal change -> Verify -> Report
    3. [Constraints] Advance one verifiable sub-goal at a time; restate the impact scope before changing anything
    4. [Tool selection] Use retrieval tools for read-heavy, write-light tasks; use command tools when factual confirmation is needed
    5. [Termination] Verification passed and the change set is minimized -> output a structured conclusion
    6. [Failure handling] Same strategy fails twice in a row -> switch hypotheses and explain why

    2. Layered tool-call design. Do not flatten all capabilities onto a single layer. A sound approach is to keep the number of top-level tools small, expose detail through parameters in tiers, and set confirmation and least privilege for dangerous operations (writing files, executing commands, accessing external networks). The more tools there are, the higher the probability of choosing the wrong one—this is purely a matter of attention competition.

    3. Stability under multi-agent parallelism. Parallelism improves throughput but introduces shared-state conflicts, result-merge conflicts, and failure propagation. A workable strategy is to keep task partitioning as orthogonal as possible, give each branch an independent sandbox, and use deterministic rules rather than free model judgment during the merge phase.

    5. Aesthetics Are Not Magic—They Are a Trainable Capability

    “Why does the frontend generated by this generation of models suddenly look better?” is a question that has puzzled many people. The answer is not mysterious: break aesthetics down into annotatable, scorable dimensions, then train them as a capability.

    The typical approach is: assemble a dedicated frontend and interface engineering team; collect high-quality pages and design cases; bring in vision-language models to help with filtering and scoring; and finally strengthen “non-semantic capabilities” such as layout balance, information hierarchy, spacing and font-size proportion, and purposefulness of motion as explicit training signals.

    1. def score_ui_sample(image, dom_tree, prompt) -> float:
    2. rubric = ["layout_balance", "hierarchy", "proportion",
    3. "motion_quality", "fidelity_to_prompt"]
    4. judged = vlm.judge(image, dom_tree, prompt, rubric=rubric)
    5. weights = {"fidelity_to_prompt": 0.40, "layout_balance": 0.20,
    6. "hierarchy": 0.15, "proportion": 0.15, "motion_quality": 0.10}
    7. return weighted_sum(judged, weights)

    The single most important point here is to define the standard for “good” before talking about training. Aesthetics seem mystical usually only because no one has broken them down into decidable dimensions. Once that breakdown is complete, they become an optimizable target, just like whether code compiles.

    6. Proving the Model Can “Get Work Done”: Rebuilding the Evaluation System

    If you want to replicate this path, evaluation is unavoidable. It is advisable to establish at least four layers of metrics:

    • Completion layer: task success rate (the proportion that runs end to end), first-run success rate;
    • Process layer: average trajectory length, tool-call error rate, self-correction success rate, number of repeated reasoning passes;
    • Cost layer: token consumption per task, wall-clock latency, performance degradation under concurrency;
    • Stability layer: consistency across multiple samples of the same task, robustness under boundary inputs.

    Two hard requirements apply to the methodology: an executable environment (running real tests inside an isolated sandbox rather than grading by hand) and repeated sampling with multiple seeds (a single run has no statistical significance). You must also maintain a fixed regression set and run it for any model or prompt change; otherwise you fall into the loop of “fixing this while breaking that.”

    7. Implementation Checklist

    • Is the training objective explicitly written as “answering correctly” or “finishing the job”? The two cannot share the same set of metrics;
    • Is the data pipeline per-domain, and does it have a release gate and rollback condition?
    • Is interleaved thinking and cross-turn state retention supported?
    • Is the system prompt structured, and does it include termination conditions and failure handling?
    • Is the toolset layered, and do dangerous operations have confirmation and least privilege?
    • Is there an executable end-to-end evaluation environment, a regression set, and multi-seed sampling?
    • Are trajectories observable (are logs, metrics, and alerts connected end to end)?
    • Have non-semantic capabilities (layout, hierarchy, motion) been broken down into scorable dimensions?

    At the infrastructure level, this workflow has a clear dependency on general-purpose cloud capabilities: an elastic container platform to carry the elastic scaling of batch inference and evaluation tasks, object storage to carry the archiving of training corpora and artifacts, a message queue to decouple tasks and smooth out peaks, logging and monitoring/alerting to provide trajectory-level observability, and key and permission management to enforce least privilege for tool calls. Baidu AI Cloud offers corresponding capabilities across these general categories and can serve as a reference foundation for teams building their own post-training and evaluation pipelines.

    Closing Thoughts

    The change in this generation of models is, in essence, not that they are “stronger,” but that their objective is clearer. From optimizing single-turn answers to optimizing end-to-end completion; from blindly piling up data to per-domain validation and staged rollouts; from one-shot planning to interleaved thinking and self-correction; from verbally praising aesthetics to breaking aesthetics down into trainable dimensions—no single step is novel, but combined, they become the dividing line between “can get work done” and “cannot.”

    For engineering teams, the most valuable takeaway may be this: when model capabilities converge, what truly creates the gap is the engineering system around the model.