High-Density Architecture Design for Reinforcement Learning Sandbox Platforms

    This article examines the architecture of a production-grade sandbox platform built for reinforcement learning (RL) training and evaluation of large language models. It breaks down seven agentic workload characteristics—bursty creation, sparse but high-density CPU usage, stateful long-lived execution, heterogeneity, environment diversity, untrusted execution, and interruptibility—and maps them to four infrastructure challenges: environment provisioning, scheduling and placement, isolation and security, and state persistence and recovery. The discussion covers layered on-demand image supply, decentralized local scheduling with controlled oversubscription, tiered isolation, checkpoint and restore, and observability and capacity governance, offering a practical reference for teams building similar intelligent coding or automated evaluation infrastructure.

    1. Why Reinforcement Learning Needs a Redesigned Sandbox Platform

    Once large models move into the reinforcement learning (RL) stage, the bottleneck in training and evaluation is often not the GPU but the “environment” side. A single rollout needs a real file system, dependencies, background services, and a toolchain. Inside that environment, the model modifies files, installs dependencies, starts processes, and then takes the next action based on the accumulated state. This workload is fundamentally different from traditional online service containers: it is not a long-running, stable resident service, but an execution unit that is massive, short-lived, heavily stateful, and demanding of strong isolation all at once.

    Public material from a leading AI team’s sandbox execution platform shows that its internal platform carries the full RL training and evaluation sandbox workload, from early model versions through multiple later versions. The material states explicitly that this kind of platform is not a “single sandbox runtime,” nor a “thin wrapper over containers,” but a production-grade execution platform. Understanding that statement is the prerequisite for understanding every architectural trade-off that follows.

    Start with the scale. One scale unit contains roughly 160 CPU nodes, 30,000 cores, and about 250 TB of memory. It creates about 3 million sandbox instances per day, with a peak concurrency of about 380,000 and a creation rate exceeding 5,000 per second. A single node has stably hosted 800 microVMs or 3,200 containers. A single RL job can request up to 32,000 sandboxes at once, and they arrive within an extremely short window.

    The most critical number here is the “5,000+ creations per second” rate. At this magnitude, any centralized routing table, or any scheduling decision that requires cross-instance negotiation, immediately becomes a bottleneck. The platform’s subsequent layered design was essentially forced out by this set of numbers.

    2. Seven Agentic Workload Characteristics That Overturn Traditional Assumptions

    The material summarizes seven workload characteristics, each corresponding to a traditional assumption that gets overturned.

    1. Bursty creation. Training and evaluation batches cannot use any instance until the environment is ready, and requests arrive not as a trickle but as a pulse flood. The traditional “reserve capacity plus scale up slowly” approach fails outright.

    2. CPU-sparse but must be high-density. An agent spends most of its time waiting for the model to generate the next action. Measurements show that about 90% of sandboxes consume less than 5% of their requested CPU on average. This means oversubscription is not an optimization but a requirement; yet oversubscription must be controlled, otherwise long-tail tasks interfere with each other.

    3. Stateful and long-lived. The model changes files, installs dependencies, and starts services, and later tool calls depend on this accumulated state. The median lifetime is about 15 to 17 minutes, and p99 exceeds 3 hours. Even when the CPU is idle, the memory footprint, page cache, and writable state remain pinned, so resources cannot truly be released.

    4. Highly heterogeneous. Algorithm-script execution, whole-repository code repair, security offense and defense, graphical interface operation, mobile development, and full-system environments differ enormously in isolation strength and resource profile. A single sandbox abstraction cannot cover them all.

    5. Explosive environment diversity. One week of production data shows about 11,000 base images, about 100,000 workspaces, and about 100 tool sets, totaling more than 130 TB. Each image has a very low reuse rate; the median image reuse for microVMs is 1, so local caching is essentially ineffective. Meanwhile, the image data actually read at runtime is only 4.2% to 13.3%—for a 6 GB runtime image, only about 6% is actually read.

    6. Untrusted execution. An agent may damage the file system, exhaust resources, or interfere with system components, so isolation and quota design must assume “failure will happen” by default.

    7. Interruptible execution. GPU-side tasks can be preempted, but the rollout is still in progress, so the platform must be able to save and efficiently restore execution state.

    These seven points converge into four infrastructure challenges: environment provisioning efficiency, scheduling and placement, isolation and security, and state persistence and recovery. Each is expanded below.

    3. Environment Provisioning: Removing “Decompression Cost” from the Critical Path

    The traditional approach of local image caching plus on-demand pulling almost completely fails when the fanout is 1. A viable direction is layered provisioning:

    • Content-addressed read-only layers plus a private writable layer per instance, with base layers shared globally and copy-on-write;
    • Lazy loading combined with page cache reuse, fetching data only when it is actually accessed, turning the read amplification of reading 6% of a 6 GB image into bandwidth savings;
    • Warm-up and prefetch: based on the image manifest declared by a job, push metadata and hot pages to target nodes before the batch arrives;
    • Separate provisioning of workspaces and tool sets, avoiding forcing 130 TB of diversity through a single image channel.

    A schematic layered structure can be understood like this:

    1. [ Global read-only base layer pool ] --content-addressed--> [ Node page cache ] --copy-on-write--> [ Instance writable layer ]
    2. ^fetch pages on demand / prefetch |
    3. | v
    4. [ Image and workspace manifest declared by the job ]----> [ Metadata service (decentralized) ] --> Instance

    The key constraint is that no global single point can appear on the provisioning path; metadata queries must be cacheable and localizable, otherwise the 5,000/s creation rate will crush them.

    4. Scheduling and Placement: Decentralize and Localize Decisions

    Within a window of thousands of instance creations per second, a centralized scheduler cannot make per-instance decisions. A workable pattern is:

    • Sharding and local autonomy: divide the node pool into scale units, let a local scheduler make placement decisions within a unit, and only negotiate capacity across units;
    • Declaration-based admission: when a job is submitted, it declares the number of instances, resource profile, isolation level, and image manifest, turning scheduling into “batch admission plus local filling”;
    • Controlled oversubscription: base oversubscription on requested CPU rather than usage, and use runtime suppression (rate limiting, priority preemption) to protect long-tail tasks;
    • Anti-affinity and fault domains: spread out the instances of the same rollout to avoid a single node failure invalidating an entire evaluation batch.

    A simplified local placement pseudocode:

    1. def place(job, nodes):
    2. # Batch admission to avoid per-instance global negotiation
    3. plan = []
    4. for spec in job.specs: # spec includes isolation level and resource profile
    5. node = pick_node(nodes, spec) # local view, no global lock
    6. if node is None:
    7. return backpressure(job) # backpressure instead of infinite queuing
    8. plan.append((node, spec))
    9. return commit(plan)

    5. Isolation and Security: Assume the Agent Will “Cause Damage”

    Untrusted execution requires assuming failure by default. In engineering, isolation is usually split into three tiers: container-level (lightweight, shared kernel, for low-risk scripts), lightweight virtual machine level (independent kernel, for whole-repository code and security tasks), and full-machine level (for system-level and mobile environments). Supporting measures include a read-only root file system with explicit writable paths, syscall and capability trimming, network egress allowlists, hard resource quotas with periodic checkups, and automatic “reclaim on anomaly” handling. Production records in the material show that real failures mostly come from resource exhaustion and component interference rather than sophisticated attacks, so quotas and observability often yield more benefit than heavier isolation schemes.

    6. State Persistence and Recovery: Designed for Interruptible Execution

    Long lifetimes coexisting with preemption mean checkpoint and restore must be supported. A viable path is incremental snapshots of memory and disk state, copy-on-write baselines, and page cache reuse on restore; for long-tail instances with p99 over 3 hours, use low-frequency snapshots plus incremental logs to avoid the snapshot itself becoming a bottleneck. The recovery goal is not “perfect restoration in seconds” but “usable within the scheduling window,” so the recovery flow should be merged with the placement decision, choosing a nearby node that already holds the relevant page cache.

    7. Observability and Capacity Governance

    The core metrics of a high-concurrency sandbox platform are not average CPU utilization but: creation rate and creation latency percentiles, oversubscription ratio and interference event count, image page hit rate, snapshot and restore time, and the environment cost per rollout. For capacity governance, it is recommended to use the scale unit as the closed-loop unit for stress testing and drills, and to replay real job profiles to validate burst capacity.

    8. Conclusion

    A sandbox platform for reinforcement learning is essentially about treating the “environment” as a first-class citizen to be scheduled and provisioned. Bursty creation requires decentralization, CPU sparsity requires controlled oversubscription, stateful long lifetimes require snapshot and restore, explosive diversity requires layered on-demand provisioning, and untrusted execution requires isolation that assumes failure by default. If an enterprise is building similar intelligent coding or automated evaluation infrastructure, general-purpose capabilities such as the container platform, object storage, log service, and monitoring and alerting offered by Baidu AI Cloud can serve as a reference for selecting the underlying components that carry such a layered architecture.