LLM-in-Sandbox Elicits General Agentic Intelligence
Daixuan Cheng, Shaohan Huang, Yuxian Gu, Huatong Song, Guoxin Chen, Li Dong, Wayne Xin Zhao, Ji-Rong Wen, Furu Wei
TL;DR
The paper proposes LLM-in-Sandbox, a minimal code sandbox that lets large language models interact with a virtual computer to tackle non-code tasks, leveraging external resources, file-based context, and code execution to unlock general intelligence. It demonstrates that strong agentic LLMs can generalize across mathematics, physics, chemistry, biomedicine, long-context understanding, and instruction following without task-specific training, and introduces LLM-in-Sandbox-RL, which trains sandbox exploration from general, non-agentic data to boost cross-domain generalization and transfer to vanilla generation. The work also analyzes the approach's computational efficiency and infrastructure overhead, showing substantial long-context token reductions (up to $8\times$) and competitive throughput, and it open-sources a Python package for real-world deployment. Additionally, the authors frame LLM-in-Sandbox as both a default inference infrastructure and a standardized agentic-capability benchmark, proposing sandbox-native training to institutionalize sandbox reasoning as a core capability. Overall, the approach provides a path toward general agentic intelligence by expanding LLMs' problem-solving repertoire through computable environments and tool acquisition beyond text-only generation.
Abstract
We introduce LLM-in-Sandbox, enabling LLMs to explore within a code sandbox (i.e., a virtual computer), to elicit general intelligence in non-code domains. We first demonstrate that strong LLMs, without additional training, exhibit generalization capabilities to leverage the code sandbox for non-code tasks. For example, LLMs spontaneously access external resources to acquire new knowledge, leverage the file system to handle long contexts, and execute scripts to satisfy formatting requirements. We further show that these agentic capabilities can be enhanced through LLM-in-Sandbox Reinforcement Learning (LLM-in-Sandbox-RL), which uses only non-agentic data to train models for sandbox exploration. Experiments demonstrate that LLM-in-Sandbox, in both training-free and post-trained settings, achieves robust generalization spanning mathematics, physics, chemistry, biomedicine, long-context understanding, and instruction following. Finally, we analyze LLM-in-Sandbox's efficiency from computational and system perspectives, and open-source it as a Python package to facilitate real-world deployment.
