🤖 AI Summary
This work explores how to elicit general intelligence and autonomous behavior from large language models (LLMs) in non-coding tasks. To this end, it introduces the “LLM-in-a-Sandbox” framework, which embeds an LLM within an interactive code sandbox environment, enabling it—without any additional training—to invoke external tools, manage long-context inputs, access real-time knowledge, and perform structured operations. The study further proposes a reinforcement learning approach, LLM-in-Sandbox-RL, trained exclusively on non-agent data, which substantially enhances the model’s exploration and generalization capabilities. This method demonstrates, for the first time, that LLMs can achieve cross-domain general intelligence through environmental interaction without fine-tuning, excelling in diverse tasks such as mathematical reasoning, physics problem-solving, biomedical question answering, and complex instruction following. The implementation is released as an open-source Python package to facilitate practical deployment.
📝 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.