Post-Training at Trillion-Parameter Scale and Engineering Long-Horizon Agents

    As models scale from tens of billions to trillions of parameters and support million-token contexts, pretraining provides increasingly strong general capabilities. Real-world performance now depends heavily on post-training and reinforcement learning. This article examines post-training infrastructure bottlenecks, parallelism and communication strategies, the memory and compute costs of long-context inference, sandbox and reward-signal reliability, and the evaluation standards required for long-horizon agents.

    Models have grown from tens of billions to trillions of parameters. Once a model reaches roughly three trillion parameters and supports million-token contexts, its foundational capabilities from pretraining are already substantial. Performance in real-world applications increasingly depends on post-training and reinforcement learning. Rather than discussing specific product choices, this article reviews post-training optimization from an architecture and platform perspective, the evolution of long-horizon agents, and the metrics and risks that teams should verify during deployment.

    1. Key Bottlenecks in Post-Training

    Compute investment in post-training is growing rapidly. When many downstream domains must be trained jointly, every layer of the technology stack can affect training stability. A practical metric is the proportion of newly added reinforcement learning compute that translates into reproducible improvements in evaluation metrics. When this proportion is low, the underlying issue is usually not a lack of compute, but problems with data distribution, reward design, scheduling efficiency, or environmental noise.

    Teams should define three categories of observability metrics at the beginning of a project:

    • GPU utilization, or Model FLOPs Utilization (MFU)
    • The proportion of per-step training time spent on communication
    • Success-rate variation across tasks and domains

    Without these measurements, it is difficult to determine whether an optimization has actually produced meaningful results.

    2. Parallelism and Communication in Reinforcement Learning Frameworks

    Reinforcement learning continuously aligns a policy with human preferences and domain-specific objectives. Compared with supervised fine-tuning, RL training includes policy-model forward and backward passes, sample generation, reward computation, and parameter synchronization. The pipeline is longer, and bottlenecks are more widely distributed.

    Common combinations of parallelism include the following:

    • Tensor parallelism (TP): Splits the matrix operations of a single layer across multiple accelerators. It requires high intra-layer communication bandwidth and is typically implemented within a server using high-speed interconnects.
    • Pipeline parallelism (PP): Splits the model by layers to reduce per-device memory usage. However, it introduces pipeline bubbles, which must be managed by adjusting the number of microbatches.
    • Expert parallelism (EP): For mixture-of-experts (MoE) models, places different experts on different devices. Routing can create substantial All-to-All communication overhead and should be measured separately.
    • Data parallelism (DP) and ZeRO-style sharding: Scale throughput across multiple nodes while reducing the memory required for optimizer states.

    There is no universally optimal parallelism configuration. The right choice depends on the cluster topology, model architecture, and sequence length. Teams should first run small-scale experiments to measure the per-step runtime and peak memory usage of each combination before choosing a scale-out strategy.

    Communication optimization is equally important. Overlapping computation and communication, using gradient accumulation, and bucketing parameter synchronization can reduce idle time. Operator fusion reduces the number of times intermediate results are written back to memory, lowering both peak memory usage and memory-access overhead. Dynamic batching helps keep compute units occupied across samples with different lengths, reducing waste caused by padding.

    3. Memory and Compute Costs of Long-Context Inference

    Million-token contexts are fundamental for long-horizon agents that process multiple code files, lengthy financial reports, and records of many tool calls. Two categories of cost should be considered separately.

    The first is memory. KV Cache usage grows linearly with sequence length and increases further with batch size and model depth. When multiple long requests enter a service simultaneously, memory fragmentation and peak usage can easily cause out-of-memory failures. Common approaches include scheduling requests by length, reserving dedicated resources for extremely long requests, and using paged KV Cache management to reduce fragmentation.

    The second is computation. Under standard full attention, attention computation grows quadratically with sequence length. Increasing the sequence from 128K to 1M tokens multiplies its length by eight and increases the attention component of computation by approximately 64 times. FlashAttention primarily reduces memory-access overhead; it does not change the asymptotic complexity of attention.

    Ring Attention distributes the sequence across multiple devices and circulates KV blocks between them in a ring. This prevents per-device memory from growing with the full sequence length. However, it depends on high-bandwidth device-to-device communication and is more complex to implement. Sparse attention and linear attention can reduce computational cost, but they may lose accuracy on tasks that require precise retrieval. These approaches therefore require separate evaluation.

    4. Sandbox Environments and Reward-Signal Quality

    Long-horizon agents need to call tools, execute code, and process feedback in realistic environments. The quality of training data depends in part on the reliability of the sandbox infrastructure.

    A sandbox platform typically needs to satisfy three requirements:

    1. High concurrency: It must be able to start a large number of independent tasks simultaneously.
    2. Low latency: Startup and teardown must be fast enough not to slow down sampling.
    3. Strong isolation: Tasks must not affect one another or gain unauthorized access to the host system.

    Containers are suitable for most tasks, while microVMs, such as Firecracker-style solutions, are better suited to running untrusted code. The two approaches involve different trade-offs in startup speed, resource overhead, and security boundaries.

    Environment validation is another commonly overlooked issue. Missing dependencies, network timeouts, full disks, and incorrect test cases can all give an agent an inaccurate reward. If these failures are interpreted as evidence of insufficient model capability, RL may optimize in the wrong direction.

    Teams therefore need a shared validation platform that monitors sandbox health in real time, marks samples affected by environmental failures, and excludes them from reward computation.

    5. Evaluating Long-Horizon Agents

    For code-generation and terminal-based tasks, a model must solve problems end to end. It needs to understand task context, plan a sequence of actions, handle runtime failures, and complete debugging and compilation in a resource-constrained environment. Evaluations of these capabilities must include clear measurement definitions; otherwise, results cannot be compared reliably.

    At a minimum, a reproducible evaluation record should include:

    • Benchmark name and version
    • Number of samples
    • Evaluation date
    • Decoding settings, such as temperature and maximum number of steps
    • The baseline model used for comparison and its version
    • A classification of failed samples

    A single percentage is not enough. Without this context, readers cannot determine which types of tasks the reported result actually represents.