Trillion-Parameter Model Post-Training: Building Long-Horizon Agent Capabilities

    As competition in large-model development shifts from parameter scale toward post-training efficiency and long-horizon agent capabilities, trillion-parameter models are increasingly evaluated as complete systems rather than single checkpoint outputs. This article examines a representative combination—trillion parameters, million-token context, large-scale post-training, a high-speed inference variant, and open weights—and explains the engineering practices behind it. It covers how effective compute and reinforcement learning shape post-training, how long context is extended and managed, how verifiable rewards support large-scale RL, the infrastructure needed to turn RL compute into capability, evaluation methods, deployment considerations, and practical guidance for building reliable long-horizon agents.

    The release cadence of leading model vendors is becoming shorter, and the focus of competition is shifting from “parameter scale” to “post-training efficiency” and “long-horizon agent capability.” Recent trillion-parameter flagship models have shown noticeable improvements in areas such as code generation, 3D creation, financial research, and long-horizon agent tasks. Some of these models also provide a high-speed variant and fully open weights, giving developers and enterprises an additional set of tools for model selection.

    This article uses a representative release pattern—“trillion parameters + million-token context + large-scale post-training + high-speed variant + open weights”—as a sample. It analyzes the technical approach and engineering practices behind this pattern to help readers make more informed decisions during model selection, evaluation, and integration.

    1. Competition Shifts Toward Post-Training and Long-Horizon Agents

    1.1 Effective Compute Beyond Parameter Scale

    Pre-training determines the model’s knowledge foundation and general capabilities, and parameter scale plays a dominant role in this stage. However, when model scale reaches the trillion-parameter level, simply increasing parameters yields diminishing returns: compute investment becomes enormous, while capability growth increasingly depends on data quality, training efficiency, and post-training design.

    As a result, reinforcement learning compute in the post-training stage is becoming a new competitive variable. The core question is whether compute invested in RL can translate into measurable capability improvements on real tasks.

    1.2 New Requirements from Long-Horizon Agent Tasks

    Unlike traditional single-turn question answering, long-horizon agent tasks require a model to maintain a consistent objective across dozens or even hundreds of steps. The agent repeatedly executes a loop of “planning, calling tools, observing results, and revising the plan.”

    For example, fixing a complex bug that spans multiple modules and involves hundreds of files may require the following steps:

    • Retrieval and localization: Finding relevant code within a million-token repository context.
    • Implementation modification: Editing multiple files.
    • Test execution: Running build and test commands.
    • Failure analysis: Adjusting the approach based on errors and logs.

    Any step that fails can cause the task to drift away from the original goal. Therefore, long-horizon capability tests not only single-step generation quality but also multi-step consistency, reliability of tool calls, and the ability to recover from errors.

    This also explains why fields as different as code generation, 3D creation, and financial research can benefit from the same round of post-training: they are all tasks with long cycles, strong feedback signals, and multi-tool collaboration.

    2. Million-Token Context: The Foundation for Long-Horizon Agents

    2.1 From Position-Encoding Extrapolation to Long-Context Continued Training

    Expanding a context window from tens of thousands of tokens to a million tokens usually cannot be achieved reliably through inference-time extrapolation alone. The process is typically advanced in three steps.

    1. Length extrapolation: Use general methods such as position-encoding interpolation and temperature scaling in the pre-trained model to initially expand the effective range of position encodings.
    2. Long-context continued pre-training: Continue training the model with long documents, large code repositories, long technical materials, and other corpus so that the model learns to use distant information.
    3. Post-training alignment: Use long-context instruction fine-tuning and long-horizon task RL to enable the model to make effective use of the full context in realistic long tasks.

    2.2 Inference-Side Engineering Optimization

    Million-token context creates pressure on GPU memory and latency. Common engineering approaches include:

    • Using efficient architectures such as sparse attention and linear or hybrid attention.
    • Using paged key-value cache management to reduce memory fragmentation and reuse common prefixes.
    • Applying context-length-aware scheduling, priority ordering, and preemption management to prevent a single extremely long request from blocking the queue for an extended period.

    2.3 Fitting a Context Does Not Mean Using It Well

    A long context window does not necessarily mean effective memory. Research has repeatedly observed phenomena such as important information in the middle of a long context being ignored. As the context reaches million-token scale, noise, stale content, and contradictory intermediate conclusions can accumulate rapidly.

    Therefore, context needs to be actively managed in engineering:

    • Hierarchical summarization: Compress early history into structured summaries.
    • External memory: Write intermediate artifacts into files, databases, or vector stores and retrieve them when needed.
    • Externalized state: Explicitly save task state, such as plans, completed steps, and pending items, rather than stuffing everything into the conversation history.

    3. Large-Scale Reinforcement Learning: Turning Compute into Capability

    3.1 Prioritize Verifiable Rewards

    In domains such as code and mathematics, where outcomes can be judged automatically, reward functions only need to perform basic verification:

    • Code tasks: Whether unit tests pass, whether static checks report errors, and whether the build succeeds.
    • 3D and graphics tasks: Whether geometry and topology are valid, whether materials and units are correct, and whether the target rendering result matches expectations.
    • Data analysis tasks: Whether script execution results match expected outputs.

    These rewards are objective and can be calculated automatically, making them suitable as the backbone signal for RL training. Through large-scale trial and error, the model learns to make better intermediate decisions within long sequences.

    3.2 Challenges of Large-Scale Joint Training

    Improving capabilities across hundreds of downstream domains simultaneously introduces three major challenges:

    • Domain interference: Different domains vary significantly in reward scale and task difficulty. Direct mixing can cause high-reward domains to dominate gradient updates.
    • Catastrophic forgetting: Training on new domains may weaken general conversation and safety capabilities.
    • Sparse feedback: In long tasks, only the final success or failure signal is available, making it difficult to identify which step caused the problem.

    Common countermeasures include:

    • Dynamically adjusting sampling ratios by domain.
    • Retaining a certain proportion of general and safety data in the training mixture.
    • Using multi-stage curriculum learning, progressing from easy to difficult tasks.
    • Introducing step-level or process-level rewards to mitigate sparse feedback.

    3.3 Relationship with “Slow Thinking” Inference

    Large-scale RL tends to improve a model’s tendency to perform multi-step reasoning, self-checking, and backtracking on complex problems. This is consistent with the idea of “slow thinking.”

    However, longer reasoning also means higher latency and cost. In engineering practice, it is necessary to set a budget for reasoning length and combine the model with a high-speed variant for interactive scenarios.

    4. Layered Technical Stack: Making RL Compute Deliver Reliably

    The system complexity of large-scale RL is much higher than that of conventional training. It requires coordinated operation among training frameworks, long-context inference engines, sandboxes, scheduling systems, and other infrastructure. If any component becomes a bottleneck, newly added compute cannot be converted into usable capability.

    To support joint training across hundreds of domains, optimization can be performed across the following six layers.

    Layer Main Challenge Key Optimization Direction
    RL training framework Mismatch between generation and training pace Decouple generation and training, asynchronous generation, prevent long-tail samples from blocking global progress
    Long-context inference engine Memory and latency of extremely long sequences Paged key-value cache, prefix reuse, length-aware scheduling and preemption
    Training efficiency Memory and communication overhead at trillion-parameter scale Tensor/pipeline/expert parallelism, overlap communication and computation, asynchronous checkpointing
    Sandbox infrastructure Isolation safety and task reproducibility Lightweight isolation, resource quotas, snapshot rollback, standardized images
    Scheduling system Resource fragmentation and fault recovery Group scheduling, topology awareness, elastic scaling, fault tolerance
    Environment quality assurance platform Inconsistent quality of environments and graders Grader regression testing, task solvability checks, difficulty stratification

    4.1 RL Training Framework: Solving “Fast Generation, Slow Training”

    RL training repeatedly follows a “generate, score, update” loop. First, the model interacts with the environment to generate trajectories. Then, reward functions score those trajectories. Finally, an RL algorithm updates model parameters.

    Several key tensions arise in practice:

    • Generating one complete trajectory, especially one involving multiple tool calls, may take tens of seconds or even several minutes.
    • One parameter update on the training side requires aggregating a large batch of trajectories.
    • In a synchronous setup, fast samples wait for slow samples, significantly reducing compute utilization.

    A common approach is to decouple generation from training. An inference cluster continuously produces trajectories and writes them into a queue, while the training cluster consumes them in batches. For timed-out or abnormal long-tail samples, the system can support “continuation” instead of discarding the entire trajectory.

    To balance policy freshness, periodic weight synchronization is usually adopted. A “staleness limit” can also be set, constraining the generation gap between the weights used to produce a trajectory and the current training weights.

    4.2 Long-Context Inference Engine

    In RL scenarios, multiple sampling branches for the same task often share a common prefix, such as the system prompt, task description, and already-read file content.

    By reusing cached computations for the common prefix, repeated computation can be significantly reduced. At the same time, requests need to be scheduled by context length. Extremely long requests should be queued or throttled separately to prevent a single long request from occupying resources for an extended period.

    4.3 Training Efficiency

    The memory overhead of trillion-parameter models is a major constraint on training efficiency. Common strategies include:

    • Mixture-of-Experts architecture: Only a subset of parameters is activated, reducing per-step computation, but this introduces expert parallelism and all-to-all communication overhead.
    • Combined parallelism strategies: Combine data parallelism, tensor parallelism, and pipeline parallelism, and use distributed optimizer state sharding to reduce peak memory usage.
    • Communication optimization: Overlap computation and communication, use low-precision communication, and apply topology-aware task placement.
    • Checkpoint optimization: Use asynchronous saving and sharded saving to reduce recovery time after failures.

    4.4 Sandbox Infrastructure

    RL training for agents depends on large numbers of executable real environments. Code repositories require compilation and runtime environments. 3D creation requires graphics rendering environments. Financial research requires data processing and analysis tools.

    A usable sandbox should provide the following capabilities:

    • Strong isolation: Isolate processes, file systems, and networks, and restrict high-risk operations using mechanisms such as system-call whitelists.
    • Resource quotas: Limit CPU, memory, disk, and runtime to prevent runaway tasks.
    • Fast startup and shutdown: Support second-level startup and destruction, enabling large numbers of concurrent instances.
    • Snapshot and rollback: Restore the initial state after task failure to ensure reproducibility.
    • Observability: Fully record execution logs and resource consumption to facilitate debugging.

    When selecting infrastructure, enterprises usually have two paths: self-built infrastructure or cloud services. Whether using a self-built cluster or cloud capabilities such as container services, object storage, message queues, logging, and monitoring alerts, the key is to incorporate task artifacts, logs, and environment images into a unified observable and reusable system. For example, Baidu AI Cloud provides services such as Container Engine CCE, Object Storage Service BOS, Kafka-based messaging, and Log Service BLS.

    4.5 Scheduling System

    RL training is a mixed workload involving training clusters, inference clusters, and sandbox clusters. Scheduling needs to solve three problems:

    • Group scheduling: Training tasks usually require multiple nodes and GPUs to be ready at the same time. Partially idle nodes can cause resource fragmentation.
    • Elastic scaling: Adjust resources on the generation and training sides dynamically according to their real-time ratio.
    • Fault tolerance: A single-node failure should not force an entire task to roll back. The system should support node-level recovery and task-level rescheduling.

    4.6 Environment Quality Assurance Platform

    The reliability of rewards often determines training effectiveness before model strength does. If graders in environments contain flaws, such as incomplete test coverage, boundary-condition errors, or unstable dependencies on external networks, the model may learn how to “cheat the reward” instead of truly solving problems.

    For this reason, the industry often establishes shared platforms to check the quality of environments and graders:

    • Run regression tests on graders to ensure consistent judgments on known positive and negative examples.
    • Validate task solvability and stratify difficulty levels.
    • Periodically scan for data leakage and reward vulnerabilities.
    • Route failed samples back into the training and evaluation process.

    5. Code, 3D Creation, and Financial Research: Three Views of Long-Horizon Task Capability

    5.1 Coding Agents

    Recent trillion-parameter models commonly emphasize the combination of “code + long-horizon agents.” Improvements are reflected in three areas:

    1. Realistic terminal tasks: Evaluate whether the model can complete tasks in resource-constrained terminal environments where information is incomplete and dependencies are complex, using real tests.
    2. Multi-step tool calls: Evaluate whether the model can reasonably select tools, parse outputs, handle errors, and continue execution.
    3. End-to-end delivery: Evaluate whether the model can form a complete loop from requirement understanding and solution design to coding, testing, and submission.

    From an engineering perspective, this means the model can gradually take on tasks such as: given a repository and an issue, autonomously complete the fix and submit it.

    5.2 3D Creation

    3D creation is a typical “multimodal + multi-step iteration” task. An agent needs to translate text descriptions into geometry, materials, lighting, and rendering parameters, and then repeatedly iterate between preview and correction.

    Long-horizon capability in this context is reflected in the ability to:

    • Maintain consistent design intent across steps.
    • Locate the cause when rendering results are unsatisfactory, such as geometry intersections, normal errors, or improper material parameters.
    • Generate reusable scripts or parameterized assets.

    5.3 Financial Research

    Financial research emphasizes an “evidence chain”: data sources must be verifiable, calculation processes must be reproducible, and conclusions must be traceable.

    Long-horizon capability here is reflected in cross-document and cross-data-source information integration, as well as multi-step verification. However, such tasks have low fault tolerance. Model outputs still require human review and compliance checks.

    6. Evaluation: How to Credibly Measure Long-Horizon Capability

    6.1 Realistic Terminal Tasks

    Evaluation should simulate realistic engineering environments: run tasks in resource-constrained terminals, attach task-specific tests, and prohibit access to preconfigured answers during evaluation.

    This design can effectively distinguish between “knowing how to write code” and “knowing how to solve problems.”

    6.2 Internal Long-Horizon Benchmarks

    Internal benchmarks usually cover multiple engineering domains and focus on multi-step execution, tool calling, and end-to-end problem solving.

    Compared with single-generation evaluations, they place more emphasis on metrics such as task completion rate, step efficiency, and error recovery rate.

    6.3 Interpreting Evaluation Results Rationally

    • Improvements on public leaderboards indicate capability trends, but they do not necessarily reflect performance in business scenarios.
    • Evaluation sets should be built using proprietary data and should cover the real task distribution.
    • Pay attention to the issue of evaluation set contamination: public data may be covered by training corpora, while private internal evaluation sets often provide better discrimination.

    7. High-Speed Inference Variant: Similar Intelligence, Lower Latency

    Providing a high-speed variant of the same model is a typical engineering practice for balancing capability, latency, and cost. Reducing latency without changing model capability usually relies on a combination of the following methods:

    • Low-precision inference: Quantize weights and activations to reduce memory bandwidth requirements.
    • Speculative decoding: A smaller model or draft head generates candidates, and the larger model verifies them in parallel, reducing effective latency.
    • Scheduling and cache optimization: Use continuous batching, prefix caching, and dynamic batching based on request length.
    • Parallelism and deployment optimization: Use expert parallelism, tensor parallelism, and request routing optimization.

    High-speed variants are better suited to interactive, low-latency scenarios, such as coding assistants and conversational agents. Standard variants are better suited to offline batch processing and complex reasoning tasks.

    8. Open Weights: Deployable, Fine-Tunable, and Integrable

    Fully open weights give enterprises greater control:

    • Private deployment: Data does not leave the domain, helping meet compliance and confidentiality requirements.
    • Domain fine-tuning: Continue training on proprietary data to improve performance in vertical scenarios.
    • Capability integration: Integrate the model into proprietary agent frameworks, tool chains, and business systems.
    • Cost optimization: Perform batch processing and inference scheduling on self-owned resources and scale as needed.

    However, deploying a trillion-parameter model is not easy. Advance planning is required:

    • Memory and parallelism: Even with low-precision storage, a trillion-parameter model may require memory on the order of several terabytes. Multi-node, multi-GPU deployment is needed, combined with strategies such as tensor parallelism and expert parallelism.
    • Inference frameworks: Mainstream inference frameworks differ in their support for MoE and long context. Sufficient stress testing is required.
    • Service governance: This includes rate limiting, circuit breaking, observability, and canary releases.

    9. Implementation Guidance: Engineering Long-Horizon Agents

    9.1 Use Budgets to Control Long-Horizon Tasks

    One of the most common failure modes of long-horizon agents is: unlimited steps, uncompressed context, and unlimited retries.

    It is recommended to explicitly manage budgets and context at the code level:

    1. import time
    2. class BudgetExceeded(Exception):
    3. pass
    4. def run_agent(task, model, sandbox, max_steps=40, max_seconds=1800):
    5. """Long-horizon agent loop with step/time budgets and context summarization"""
    6. start = time.time()
    7. messages = [{"role": "user", "content": task}]
    8. history = [] # Externalized state: tool call records and completed steps
    9. for step in range(max_steps):
    10. if time.time() - start > max_seconds:
    11. raise BudgetExceeded("Task timed out")
    12. resp = model.chat(messages + [summarize(history)], tools=sandbox.tools)
    13. if resp.finish_reason == "stop":
    14. return resp.text
    15. result = sandbox.call(resp.tool_call) # Execute the tool call
    16. history.append({"step": step, "call": resp.tool_call, "result": result})
    17. messages.append({"role": "assistant", "content": resp.text})
    18. messages.append({"role": "tool", "content": result})
    19. raise BudgetExceeded("Maximum step count exceeded")

    9.2 Context and Memory Management

    • Write long-term memory into external storage and inject it on demand through retrieval.
    • Truncate and structure summaries of tool outputs to prevent overly long outputs from crowding the context.
    • Keep key intermediate artifacts, such as plans, completed items, and pending tasks, in explicit structures.

    9.3 Observability and Evaluation

    • Record the inputs and outputs of each step, tool calls, and latency to facilitate failure diagnosis.
    • Build business-specific evaluation sets and perform regular regression testing, focusing on task completion rate and cost.
    • Retain human review steps for high-risk scenarios, such as finance and healthcare.

    9.4 Model Selection Matrix

    Scenario Key Metrics Recommendation
    Interactive coding assistant Latency, cost per request High-speed variant + shorter context
    Complex engineering repair Task completion rate, long-horizon stability Standard variant + long context + budget control
    Private deployment Data compliance, controllability Open weights + self-managed inference cluster
    Batch data processing Throughput, cost Batch processing + quantized inference

    10. Conclusion

    Competition in post-training trillion-parameter models is ultimately a competition of systems engineering capability: whoever can reliably turn RL compute into real capability improvements on practical tasks will gain an advantage in the era of long-horizon agents.

    For developers and enterprises, rather than chasing a single leaderboard score, it is more valuable to build an evaluation system around their own business and to strengthen long-context handling, tool calling, budget control, and observability. A model is only the starting point. Engineering implementation is the key to realizing its value.