Introduction
Large language models (LLMs) have demonstrated remarkable capabilities as autonomous agents, performing complex tasks such as web navigation and multi-step problem solving. However, the massive parameter counts and high inference costs of state-of-the-art models make them difficult to deploy in real-world, latency-sensitive environments. Knowledge distillation—transferring the expertise of a large "teacher" model to a smaller "student"—is a common solution, but standard methods often fail to capture the unique operational structure of agents.
This paper introduces Structured Agent Distillation (SAD), a framework designed to compress large teacher agents into efficient student models by explicitly supervising the distinct phases of agent behavior: reasoning and acting. Unlike traditional token-level distillation, SAD ensures that student models learn the underlying logic behind their actions, preventing the common pitfall of "parroting" surface-level outputs without understanding the plan.
The Challenge of Flat Distillation
Standard distillation techniques typically treat an agent's output as a flat, continuous string of text. This "token-level" approach ignores the inherent structure of agent trajectories, which alternate between internal deliberation (reasoning) and external execution (acting). By treating a critical planning step the same as a simple button click, standard distillation blurs the functional boundaries of the task. Consequently, student models often suffer from semantic drift, skipping necessary planning steps or failing to ground their actions in the provided reasoning, leading to significant performance degradation at smaller scales.
Structured Agent Distillation (SAD)
To address these limitations, SAD models the compositional structure of agent behavior through four key components:
- Trajectory Segmentation: The teacher's output is parsed into distinct
[REASON]and[ACT]spans using rule-based identifiers. - Segment-Aware Masking: Binary masks are applied at the token level to ensure that supervision for reasoning does not overlap with supervision for actions, maintaining functional purity.
- Semantic Decoupling (Dual Losses): The student is trained using two separate objectives:
- CoT-Policy Alignment Loss: Minimizes the divergence between teacher and student reasoning spans to ensure logical coherence.
- Action Consistency Loss: Ensures the student accurately replicates the teacher's grounded decisions.
- Curriculum Learning: Training begins with simpler trajectories (based on length and teacher confidence) and progressively introduces more complex scenarios to stabilize the learning process.
Experimental Evaluation
The authors evaluated SAD across three diverse agent benchmarks: ALFWorld (embodied household tasks), WebShop (e-commerce navigation), and HotPotQA-ReAct (multi-hop reasoning). The framework was tested across multiple model families, including GPT-2, OPT, and LLaMA, with student sizes ranging from 120M to 7B parameters.
Key Findings
Performance and Efficiency
SAD consistently outperformed state-of-the-art token-level distillation methods like MiniLLM. In the ALFWorld environment, distilling a 1.5B GPT-2 teacher into a 120M student resulted in a +4.3% absolute gain in task success. Notably, the benefits of structured distillation were most pronounced at smaller scales, where traditional methods often fail to produce functional agents.
Logic-Driven Latency Reduction
A counterintuitive finding was that forcing the model to learn explicit reasoning actually improved efficiency. SAD-trained students produced more concise reasoning traces and required fewer total steps to complete tasks compared to token-level baselines. This suggests that better logical alignment leads to more direct and effective decision-making.
Semantic Decoupling
Ablation studies confirmed that both reasoning and action supervision are essential. Removing either component led to a sharp decline in performance, proving that these two skills are complementary and must be decoupled to be learned effectively by compact models.
Conclusion and Future Work
Structured Agent Distillation provides a robust pathway for deploying capable autonomous agents on resource-constrained devices. By respecting the functional structure of agent trajectories, SAD allows tiny models to achieve high fidelity to their much larger teachers. Future research will focus on extending this framework to multimodal agents (incorporating vision) and exploring more complex hierarchical planning structures beyond the ReAct format.
Summary updated