Beyond Parameter Scale: Engineering Post-Training for Long-Horizon Agent Capabilities
This article examines why the center of model improvement has shifted from pre-training to post-training, and what it takes to run reinforcement learning across hundreds of downstream domains. It breaks down the core engineering problems—verifiable reward coverage, task difficulty stratification, and environment construction—and walks through the six infrastructure changes that support large-scale joint training: RL frameworks, sandbox infrastructure, scheduling, environment quality checks, long-context inference, and tiered billing. It also covers terminal-based benchmarks, inference-side cost structure, and delivering the Agent runtime as infrastructure, ending with a practical implementation checklist for teams adopting long-horizon agents.
1. Why the Center of Improvement Is Moving from Pre-Training to Post-Training
Model iteration over the past two years traces a clear curve. Once base parameter scale reaches the trillion range, simply “stacking more parameters” yields rapidly diminishing marginal returns on real business metrics, while the marginal returns from post-training keep rising. The reason isn’t complicated.
Pre-training defines a model’s knowledge boundary—what it does and doesn’t know. Post-training defines its behavioral boundary—whether it decomposes tasks, whether it retries after failing, whether it proactively looks up information when context is insufficient, and whether it holds its objective without drifting over a long run. For tasks that require dozens or even hundreds of consecutive interactions—code generation, financial research, 3D content production—success or failure is decided almost entirely by the behavioral boundary.
This is why the core narrative of the current generation of upgrades is “increase post-training compute further, and extend reinforcement learning to hundreds of downstream domains.” It is not an architecture revolution. It is a reallocation of training compute.
2. Scaling RL to Hundreds of Domains: Where the Real Difficulty Lies
Extending RL from “a few general tasks” to “hundreds of downstream domains” is far harder on the engineering side than on the algorithm side. In essence, it turns a research project into a data and infrastructure engineering effort.
2.1 Verifiable Reward Coverage
RL requires that you can score a trajectory. Code tasks are naturally verifiable (just run the tests), and math or logical reasoning can be checked by comparing answers. But for financial research, 3D modeling, and long-document synthesis, “good” often has no single correct answer. The common engineering solution is to construct proxy metrics: 3D scenes are validated with geometric constraints, rendering consistency, and physical plausibility; research tasks are validated with citation traceability, numerical reproducibility, and consistency between conclusions and their evidence chains.
2.2 Task Distribution and Difficulty Stratification
When hundreds of domains train at the same time, the biggest risk is that capabilities trade off against each other. In practice, a layered curriculum is typical: tasks are split into easy/medium/hard tiers by “single-step success rate,” and the sampling ratio is adjusted dynamically so the model doesn’t linger on tasks it has already mastered and produce useless gradients.
2.3 Scaling Environment Construction
Behind each domain’s reward function sits an execution environment that must actually run. This leads directly to the next section.
3. Six Infrastructure Changes Behind Large-Scale Joint Training
The six changes mentioned in the original—RL framework, long-context inference, training efficiency, sandbox infrastructure, scheduling, and an environment quality-check platform—actually form a complete dependency chain. Here is the technical substance of each.
3.1 RL Framework: From Synchronous Sampling to Asynchronous Decoupling
In traditional synchronous RL, the sampling phase waits for the slowest trajectory to return before every rollout completes. But long-horizon agent trajectories are highly uneven in length: some tasks finish in 3 steps, others run to 200. Synchronous waiting leaves GPUs idle in large amounts.
The mainstream direction is asynchronous sampling with decoupled policy versions: policy weights are published as snapshots, the sampling side keeps producing trajectories with slightly older weights, and the training side consumes them in batches. The cost is introducing off-policy bias, which needs to be corrected with importance-sampling ratios or controlled by limiting how many steps the weights lag behind.
A simplified sampling-side pseudocode:
async def rollout_worker(task, policy_snapshot, max_steps=200):state = sandbox.spawn(task) # bring up an isolated execution environmenttrajectory = []for step in range(max_steps):policy_snapshot.wait_ready()action = await policy.generate(context=compress(state.history), # compress context before inferencetools=state.tool_schema,max_tokens=8192,)observation = await state.apply(action) # tool call / command executiontrajectory.append((action, observation))if state.done() or observation.error_fatal:breakreward = verifier.score(state, trajectory) # unified reward verificationsandbox.destroy(state)return trajectory, reward
Note the semantics of policy_snapshot.wait_ready(): it does not wait for the latest weights, only for weights that are “new enough,” which decouples sampling throughput from the training cadence.
3.2 Sandbox Infrastructure: The Real Bottleneck in Agent Training
The biggest difference between agent training and text RL is that each trajectory needs a real, executable, isolated environment: a file system, processes, network (usually restricted or allowlisted), a virtual terminal, and optionally graphical rendering and GPU capability.
A scalable sandbox has to solve four things:
- Startup latency: one training iteration may need to spin up thousands of environments. If a cold start takes tens of seconds, it eats most of the sampling time. The common approach is a pre-created warm pool plus snapshot restore, bringing cold starts down to the hundreds-of-milliseconds range.
- Strong isolation: agent-generated code is untrusted and must run within the boundary of a container or lightweight virtualization, with restricted file-system write scope, restricted egress, and capped CPU and memory quotas.
- Reproducibility: the same task must produce the same result on different physical machines, with dependency versions pinned inside the image.
- Cost recovery: environments must be deterministically destroyed after a trajectory ends, to avoid zombie containers accumulating.
3.3 Scheduling: Resource Allocation Under Mixed Workloads
A joint training run holds three kinds of load at once: a training cluster (long-running, GPU-intensive, sensitive to communication), a sampling cluster (bursty, CPU/IO-intensive), and a sandbox cluster (high-concurrency, short-lived). Their resource profiles are completely different, and hard-binding them together makes any one of them the bottleneck. In practice, they are scheduled in separate pools by preemptible priority, and the sandbox cluster is placed on preemptible resources—because it can be rebuilt at any time, so its losses are controllable.
3.4 Environment Quality Checks: The Underestimated Link
This step is often overlooked, but it directly sets the ceiling on RL data quality. Common problems include:
- False success: the task’s acceptance script is too loose, so the model passes by taking shortcuts.
- False failure: environment jitter (port collisions, time zones, random seeds) causes a correct solution to be marked as failing.
- Reward leakage: the task description accidentally contains hints about the answer.
The standard fix is to run a baseline and random-policy comparison before launch: if a random policy scores significantly above zero, the reward can be gamed; if the reference solution doesn’t score near full marks, the environment is flawed. This check should be an automated pipeline—every task set must pass the gate before entering the repository.
4. Long-Context Inference: The True Ceiling for Long-Horizon Tasks
Million-token context sounds like it’s built for “long documents,” but the first real beneficiary is long-horizon agents—because their context grows extremely fast: tool return values, log fragments, and intermediate artifacts keep accumulating, and after a few dozen steps a naive concatenation inevitably overflows.
So long-context capability breaks into three engineering layers:
- Attention computation optimization: reduce long-sequence cost through chunked prefill, prefix sharing, and paged KV-cache management.
- Context compression: summarize verbose tool outputs, keep error stacks and the critical path, and discard redundant information.
- Externalized state: write intermediate artifacts to external storage and keep only reference pointers in context. This is the key design that lets long-horizon tasks run to hundreds of steps.
Context budget allocation (illustrative)├─ System prompt & tool definitions ~5%├─ Task goals & constraints ~5%├─ Recent raw observations (exact) ~30%├─ Compressed history summaries ~20%└─ Reserved generation space ~40%
5. Evaluation: Why Terminal-Based Benchmarks Matter
Coding ability used to be measured mainly by function-level completion and competition problems. But real development work looks different: reading code, editing files, installing dependencies, running tests, checking logs, and editing again—all inside a resource-constrained environment. This makes terminal-environment benchmarks a key metric—they provide a real shell, restricted resource quotas, and per-task checks that validate the final state rather than matching text output.
Looking at the public evaluation landscape, top models’ pass rates on these tasks have entered the 60%–70% range, and the gaps between them have narrowed to within a few percentage points. On one hand, this means the benchmarks are losing discriminative power; on the other, it points to a more practical problem: the aggregate score is no longer a valid basis for model selection.
Two metrics are more worth watching in practice:
- Long-horizon consistency: how large the pass-rate drop is between a 20-step task and a 200-step task for the same model. A smaller drop means stronger resistance to error accumulation.
- Cost per task: the total tokens and total wall-clock time to complete a task, not the per-token price.
6. Inference-Side Engineering and Cost Structure
6.1 The Technical Logic Behind Tiered Billing
Mainstream API billing typically splits input into “cache hit” and “cache miss” tiers, with prices that can differ by an order of magnitude. This isn’t a marketing design; it directly reflects two different costs: a cache-miss input requires computing the full KV cache, while a hit reuses an already-cached prefix. For agent scenarios, system prompts, tool definitions, and long-document backgrounds are all highly repetitive prefixes, and the prefix cache hit rate can often decide more than half of the total cost.
6.2 The “High-Speed” Variant: Which Two Metrics It Optimizes
Inference latency is made up of two independent metrics: time to first token (TTFT, governed by prefill) and time per output token (TPOT, governed by decoding). The so-called “high-speed” variant is essentially about lowering TPOT while keeping intelligence level unchanged—through higher parallelism, speculative decoding, larger batching budgets, and similar means—typically yielding a 2–3x speedup in output speed.
The selection criteria are direct: interactive products (chat dialogs, IDE completion) are sensitive to TPOT and should choose the high-speed variant; offline batch processing (batch code review, report generation) is more sensitive to throughput and unit price, so the standard variant is more economical.
6.3 How to Estimate Cost Correctly
task_cost = (input_miss_tokens * p_miss+ input_hit_tokens * p_hit # cached prefixes billed at a discounted rate+ output_tokens * p_out) / task_success_rate # key: normalize real cost by success rate
The denominator is the most easily overlooked term. A model with a lower unit price but a lower success rate may need more retries to achieve the same business outcome, so its actual cost is higher. Cost per task normalized by success rate is the only comparable measure.
7. Delivering the Agent Runtime as Infrastructure
Another easily overlooked signal in this generation of iteration: beyond model APIs, a form has emerged that delivers the Agent’s “runtime framework” (the Harness) as a cloud service, supporting continuous execution of long-running tasks and multi-agent collaboration.
The judgment behind this is that model capability has become commoditized, while keeping an agent running a 7×24-hour task reliably is the scarce capability. It productizes a whole set of engineering capabilities that previously had to be self-built:
- Task persistence and resume-from-checkpoint: state is periodically written to disk, and a reclaimed process can recover from where it stopped.
- Sandbox isolation and resource quotas: each agent session gets its own environment.
- Multi-agent orchestration: a primary agent decomposes the task, sub-agents run subtasks in parallel and return structured results.
- End-to-end observability: every tool call, its latency, and its token consumption are traceable, making auditing and tuning easier.
On the self-built path, these capabilities map directly onto combinations of general cloud infrastructure: a container platform hosts the sandbox pool and handles elastic scaling, object storage holds task snapshots and intermediate artifacts, a message queue handles task dispatch between agents, and logging plus monitoring cover the instrumentation and anomaly alerts for every step of a long-horizon task. For example, general-purpose capabilities offered by Baidu AI Cloud can support a self-built agent runtime without binding to any one vendor’s managed service. It’s worth noting that whether self-built or managed, sandbox isolation strength and least-privilege access must be the first priority—agents execute untrusted code, so tightening permissions matters more than adding features.
8. Implementation Checklist
For teams preparing to adopt long-horizon agent capabilities, here is an actionable set of checks:
- Define evaluation before choosing a model: build 30–50 real tasks with automated acceptance scripts from your own business, and measure pass rate and long-horizon consistency—not public leaderboards.
- Calculate real cost: normalize cost per task by success rate and track prefix cache hit rate; these two decide the bill.
- Design for externalized state: assume context will overflow from day one, write intermediate artifacts to external storage, and keep only references in context.
- Enforce sandbox isolation: untrusted code must run in a restricted environment, with egress via allowlist and file writes limited to specific directories.
- Build observability first: log the input, output, latency, and failure type of every tool call. Without this data, any optimization is guesswork.
- Leave an exit for failures: set a maximum step count, a budget ceiling, and human-takeover points to avoid a long-horizon task consuming resources indefinitely.
9. Conclusion
In the era of trillion-parameter models, the focus of competition has shifted from “who can make the model bigger” to “who can go deeper on post-training and make the Agent runtime more reliable.” The real leverage of investing in post-training compute isn’t a few percentage points of improvement in general capability; it’s giving models verifiable, recoverable, and auditable long-horizon work capacity—which is precisely the prerequisite for entering real production workflows. For developers, understanding this infrastructure chain (verifiable rewards, sandboxes, scheduling, environment quality checks, long-context inference, tiered billing) lets you build a model-selection and engineering methodology that doesn’t break every time the model version changes, even as iteration speeds stay high.
