Sandbox Platform Architecture for Large Language Model RL Training

    Agentic reinforcement learning requires fast, isolated, stateful execution environments at a scale that conventional infrastructure was not designed to support. This article examines how bursty provisioning, sparse CPU usage, diverse images, untrusted execution, and training preemption shape sandbox architecture, and outlines practical principles for provisioning, resource oversubscription, isolation, recovery, and decentralized control.

    1. Why RL Training Needs a Dedicated Sandbox Platform

    As large language model training moves beyond pretraining toward reinforcement learning (RL)-based post-training, infrastructure bottlenecks are shifting from GPU compute to execution-environment provisioning.

    In agentic RL, models learn through repeated interaction with an execution environment: writing code, running scripts, manipulating files, and starting services. Feedback from these actions provides reward signals. The training platform must therefore rapidly supply each training sample with a secure, isolated, reproducible, and recoverable environment—a sandbox.

    Conventional container orchestration and virtualization systems were designed primarily for long-running services. RL training workloads have substantially different requirements.

    A published paper from a leading AI team describes an internal sandbox platform that supported RL training and evaluation across its model generations, from early releases to the latest versions covered by the paper. Using that experience as a reference, this article extracts general architectural principles for large-scale training sandbox platforms.

    2. Scale Determines the Architecture

    Understanding the platform starts with understanding its workload. Publicly reported figures include:

    • One scaling unit: approximately 160 CPU nodes, 30,000 CPU cores, and 250 TB of memory.
    • Daily sandbox creation: approximately 3 million instances, with peak concurrency of around 380,000.
    • Peak creation rate: more than 5,000 sandboxes per second.
    • Per-node density: stable operation with 800 microVMs or 3,200 containers on a single node.
    • Single RL job demand: up to 32,768 sandboxes requested within a very short arrival window.

    The creation rate of more than 5,000 sandboxes per second is particularly important. At that scale, centralized routing tables and scheduling decisions requiring coordination across instances can become bottlenecks.

    The architecture follows directly from these constraints: decentralization, shared-nothing design, and local decision-making become central requirements rather than optional optimizations.

    3. Seven Characteristics of Agentic Training Workloads

    The team identified seven workload characteristics, each challenging an assumption common in traditional infrastructure.

    3.1 Bursty Provisioning

    Training and evaluation batches cannot begin using their environments until all required sandboxes are ready. Requests therefore arrive in bursts rather than as a steady stream.

    A single batch may request tens of thousands of sandboxes almost simultaneously. High or unpredictable creation latency leaves expensive GPU clusters idle while they wait for environments.

    3.2 Sparse CPU Usage, but High Density Is Essential

    Agents spend much of their time waiting for the LLM to generate the next action. Measurements showed that approximately 90% of sandboxes used, on average, less than 5% of their requested CPU allocation.

    Allocating physical resources strictly according to requested capacity would waste substantial compute. CPU oversubscription is therefore necessary, but the platform must still deliver predictable performance when sandboxes become active in bursts.

    3.3 Stateful, Long-Lived Environments

    Models modify files, install dependencies, and start services inside sandboxes. Subsequent tool calls depend on this accumulated state.

    Median sandbox lifetimes were approximately 15–17 minutes, while the 99th percentile exceeded three hours. Even when CPU usage is low, memory footprints, page caches, and writable state remain resident and cannot simply be reclaimed.

    Resource reclamation is consequently much more complicated than it is for stateless services.

    3.4 Highly Heterogeneous Workloads

    Workloads span script evaluation, repository-wide software engineering, security attack-and-defense tasks, computer interaction, mobile development, and full-system environments.

    These tasks differ substantially in resource profiles and required isolation strength. No single sandbox abstraction can cover every scenario. The platform must support multiple execution environments, including containers, microVMs, and emulators.

    3.5 Rapidly Expanding Environment Diversity

    One week of production data included:

    • More than 11,000 base images.
    • Approximately 100,000 workspace snapshots.
    • More than 100 toolkits.
    • Over 130 TB of data in total.

    Image reuse was particularly low. The median reuse count for microVM images was just one, meaning most images were used only once. Conventional local image caching therefore provided little benefit.

    However, workloads read only 4.2%–13.3% of their image data at runtime. A task using a 6 GB Python image, for example, might read only about 6% of that image before completion.

    This access pattern provides a strong basis for lazy loading and on-demand image distribution.

    3.6 Untrusted Execution

    Agents may damage filesystems, exhaust resources, or interfere with system components. Production incidents included accidental deletion of critical directories, fork bombs, and disk exhaustion.

    Strong isolation and resource limits are baseline requirements, not optional safeguards.

    3.7 Execution Can Be Interrupted

    GPU training jobs may be preempted by higher-priority work while sandbox rollouts are still in progress.

    The platform must preserve execution state and efficiently reconstruct environments when training resumes. Otherwise, substantial progress in already-generated trajectories may be wasted.

    4. Four Core Infrastructure Challenges

    These seven characteristics converge into four architectural challenges.

    4.1 Efficient Environment Provisioning

    Bursty creation combined with environment diversity means preparation costs cannot grow linearly with instance count.

    The key is to decouple image unpacking and environment startup from image-data reads. Lazy image loading and snapshot/restore techniques can reduce startup times from seconds to below one second.

    4.2 Balancing Oversubscription and Isolation

    The platform needs substantial CPU oversubscription to improve utilization. At the same time, it must preserve fairness and security through cgroup quotas, memory limits, and microVM isolation boundaries.

    The challenge is not simply to fit more instances on a node, but to do so without losing control over resource contention or untrusted execution.

    4.3 State Management and Recovery

    Sandbox state must be saved outside the running instance and restored quickly.

    This capability needs to work with the training system’s preemption and recovery mechanisms so that interrupted jobs can resume without discarding valuable rollout progress.

    4.4 A Decentralized Control Plane

    Scheduling, image distribution, and health checking must be localized wherever possible.

    A centralized metadata service should not become the bottleneck for provisioning or operating hundreds of thousands of environments.

    5. General Design Principles

    These lessons also apply to small and medium-sized RL training platforms, even when their workloads are far below millions of daily sandbox instances.

    5.1 Base Oversubscription on Measurements

    Measure actual resource behavior before choosing oversubscription ratios. Relevant measurements include CPU-utilization percentiles, memory footprints, and sandbox lifetime distributions.

    Oversubscription should reflect observed workload characteristics rather than an arbitrary capacity target.

    5.2 Separate Image Layers and Load Data Lazily

    Store base images, dependency layers, and workspace snapshots separately. Fetch block-level data on demand at runtime.

    This approach can reduce network and disk I/O by an order of magnitude rather than transferring entire images that workloads barely read.

    5.3 Use Tiered Isolation

    Use containers for trusted workloads where density is the priority, and lightweight virtual machines for untrusted workloads where stronger boundaries are needed.

    A unified API can hide these implementation differences from callers.

    5.4 Keep the Control Plane Stateless and Local

    Make scheduling decisions at the node level wherever possible. Central components should focus on coarse-grained resource accounting rather than coordinating every instance-level operation.

    This reduces dependence on shared control-plane state during provisioning bursts.

    5.5 Design for Preemption from the Start

    Treat interruption as a normal operating condition from day one.

    Sandbox state should be checkpointable and recoverable so that training can resume efficiently after preemption.

    6. Conclusion

    RL training is moving the infrastructure challenge beyond GPU scheduling toward the rapid provisioning of hundreds of thousands of secure execution environments.

    The resulting architecture is shaped by the workload: bursty creation drives decentralization, sparse CPU usage drives oversubscription, low image reuse drives lazy loading, and untrusted execution drives tiered isolation.

    Understanding this workload-driven reasoning is more valuable than memorizing any particular scale metric. It provides a general framework for designing infrastructure when new workloads invalidate the assumptions behind existing systems.