Kestrel: A Lightweight Rust and Python Execution, Sandboxing, and Safety Runtime for Agentic Post-Training
Year: 2026
Type: preprint
Abstract: Agentic reinforcement learning (RL) post-training—particularly Group Relative Policy Optimization (GRPO) over multi-turn software engineering and tool-use environments—is increasingly bounded by systems runtime overhead rather than accelerator arithmetic. Conventional training pipelines combine heavyweight container resets, Python-level actor queues, and unverified quantization configurations, wasting 70%–90% of step wall-clock time on environment initialization while exposing runs to silent training collapse from loss-mask leakage and trainer–rollout numerical divergence. We present Kestrel, an open-source, trainer-agnostic execution, sandboxing, and safety runtime packaged as a single 5.1 MB compiled Rust binary paired with a zero-bloat Python SDK. Kestrel introduces three tightly coupled runtime primitives: (1) an unprivileged Linux kernel Copy-on-Write (CoW) snapshot-fork engine built on user/mount namespaces, private tmpfs-backed OverlayFS, per-execution read-only bind-mounted hidden evaluation harnesses, network/PID isolation, and Seccomp-BPF filtering, supporting sub-millisecond batch forking and stacked mid-trajectory tree branching; (2) a pre-flight and live zero-collapse safety shield combining multi-turn token loss-mask auditing, IEEE BF16/FP8/NVFP4 per-layer KL compilation, adversarial exploit probing, Schulman k3 KL tracking, and Brownfield Canary automatic checkpoint rollback; and (3) a zero-GIL Rust Radix Prefix-Tree session router with elastic spot-node preemption failover, adaptive straggler cutting, and five-stage bottleneck auto-tuning. Evaluated live on Linux 6.18, Kestrel forks 16 isolated 2,000-file repository sandboxes in 1.96 ms (0.123 ms/fork, a 2,390.6x speedup over full directory copies), scales to G=64 rollouts in 6.30 ms, eliminates 66.7% of redundant prefix turns under mid-trajectory Tree-GRPO, catches 10/10 synthetic masking, mismatch, and escape faults in 1.50 s, and routes multi-turn sessions in 7.1–8.9 us with up to 99.9% KV-prefix cache hit rate across mid-run spot-node evictions. Open-source code & reproducible Google Colab study: https://github.com/Rahulchaube1/Kestrel
Author: Chaube, Rahul
Institution: SRM Institute of Science and Technology
Language: English
Subfield: Artificial Intelligence
Field: Computer Science
Domain: Physical Sciences
Open Access status: green
OpenAlex ID: W7242537391
Cites:
Cited by:
Related to:
