Table of Contents
Fetching ...

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.

LLM-in-Sandbox Elicits General Agentic Intelligence

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 ) 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.
Paper Structure (60 sections, 7 figures, 16 tables, 1 algorithm)

This paper contains 60 sections, 7 figures, 16 tables, 1 algorithm.

Figures (7)

  • Figure 1: Overview of LLM-in-Sandbox. We enable LLMs to explore within a code sandbox (i.e., virtual computer), unlocking significant performance gains across diverse LLMs and domains. Green values indicate improvements over vanilla LLMs. All LLMs are evaluated without additional training.
  • Figure 2: Sandbox behavior patterns across task domains for strong agentic models. (a)-(c): Capability usage rate, computed as capability invocations / total turns. (d): Average number of interaction turns per task.
  • Figure 3: Sandbox Configuration for LLM-in-Sandbox-RL: task contexts are stored as files within the sandbox environment. (a) Multi-document or long contexts are split into separate files. (b) Single-file contexts are supplemented with distractors.
  • Figure 4: Task Setup. Prior related tasks are used as in-context examples.
  • Figure 5: LLM-in-Sandbox transcends the text-in-text-out paradigm. By granting LLMs access to a basic virtual computer, they can autonomously install tools, write and execute programs, and produce usable files—interactive webpages (.html), images (.png), videos (.mp4), and audio (.wav).
  • ...and 2 more figures