Trillion-Parameter Agent Models: Architecture Design and Engineering Essentials
This article explains what agent models need beyond text generation, including tool calling, planning, and state maintenance. It covers the data synthesis pipeline for generating multi-turn trajectories, the quality control methods used to filter them, and the construction of a virtual API pool organized as a hierarchical tree. It also introduces key structural adjustments in the model architecture, building on sparse mixture-of-experts (MoE) and attention optimization.
1. From Dialogue Models to Action Models
Early applications of large language models mainly involved single-turn question answering, where the model’s text output completed the task. Agent scenarios are different. The model must perceive its environment, call external tools, revise its plan based on the returned results, and complete multi-step tasks. These scenarios place new demands on the model. Math reasoning and code generation cover only part of them.
1.1 Capability Boundaries in Agent Scenarios
The core abilities of an agent fall into three categories:
- Tool calling: Deciding when an external capability is needed, selecting the correct function, and generating arguments that match its signature. Missing parameters, type errors, or out-of-range values all cause the call to fail.
- Planning and decision-making: Breaking a user goal into subtasks, determining the execution order, and judging whether the current information is enough to end the task. Ending the plan too early or getting stuck in a loop are common failure modes.
- State maintenance: Recording intermediate results and constraints over a long workflow. As the number of dialogue turns grows, early constraints are easily forgotten, so the model must keep key information stable in its context.
These three capabilities depend on one another. Tool calling needs planning to supply the goal, and planning depends on the observations returned by tools. As a result, improving any one capability alone usually yields limited gains. Training data needs to cover all three together.
1.2 Data Requirements for Capability Gains
Agent capabilities cannot be acquired from general text corpora alone. The model must see a large number of complete “observe, act, observe again” trajectories to learn how to adjust its strategy in response to feedback. Trajectory data must meet three conditions: it must be sufficient in quantity, diverse in type, and the environmental feedback at each step must be realistic and credible. These three conditions set the ceiling for subsequent training.
2. Design of the Data Synthesis System
The data synthesis system is the infrastructure of an agent model. It generates tasks in batches, simulates environments, records trajectories, and selects high-quality samples. In engineering practice, this system is usually evaluated along four dimensions.
2.1 Four Core Properties
- Diversity: Tasks should cover as many industries, functions, and interaction formats as possible. Data from a single domain makes the model transfer its skills poorly to other scenarios.
- Scalability: The generation pipeline should be able to expand in scale as compute increases, without relying on manual annotation. This requires task templates, environments, and validation logic that run automatically.
- Realism: Tool parameter formats, return structures, and error messages should closely resemble those of real systems. If the simulated environment is too idealized, the model will encounter distribution shift when it is deployed.
- Interactivity: Trajectories should span multiple turns, and the environment should return different feedback depending on the model’s actions. Static single-turn question-and-answer samples cannot train the model to handle failures and branching paths.
2.2 Trajectory Generation Pipeline
The sample code below shows the basic pipeline for a trajectory, from generation to filtering. It illustrates the approach only. The actual interfaces must be implemented against a real environment.
def synthesize_trajectory(task_spec, tool_pool, policy_model, verifier):# Sample a set of available tools for the task and build a sandbox environmenttools = tool_pool.sample(task_spec.domain)env = build_sandbox(tools)state = env.reset(task_spec.goal)trajectory = []for _ in range(task_spec.max_steps):action = policy_model.act(state, trajectory)observation = env.execute(action)trajectory.append({"state": state, "action": action, "obs": observation})state = observationif env.is_done():break# Keep only trajectories that pass verification.# Failed samples can be used to build error-correction data.if verifier.check(trajectory, task_spec):return trajectoryreturn None
Two points stand out. First, the sandbox environment provides controllable feedback, so the simulation does not access live business systems. Second, the verifier decides whether a trajectory is stored. Verification can check whether parameters are valid, whether the final state meets the goal, and whether any intermediate steps contain redundant calls.
2.3 Quality Control
As the number of trajectories grows, quality problems are amplified. Common control methods include:
- Running structural validation on each trajectory to check action formats, parameter types, and call order.
- Running semantic validation on the final result to judge whether the task goal was actually achieved.
- Sampling the same task multiple times, discarding samples with unstable results, and keeping correct paths that can be reproduced.
- Sampling by difficulty and domain in layers, so that simple samples do not dominate the training data.
3. Building the API Pool
Training for tool calling requires a large number of interfaces. Using real interfaces directly raises issues with permissions, cost, and stability. A common approach is therefore to build a virtual API pool that has a realistic structure.
3.1 Hierarchical Context Tree
To cover enough industries and functions, interfaces can be organized as a tree. First, large domains are divided into subdomains. Then, each subdomain contains several functions. An example structure looks like this:
Finance├── Securities├── Banking└── InsuranceLegal├── Contracts└── Litigation...(8 top-level domains and 68 subdomains in total)
The tree structure makes coverage easier to control. When generating tasks, the system can sample evenly across nodes, which prevents some domains from having too many samples while others have none.
3.2 Automatic Generation of Interface Definitions
Within each subdomain, a language model can use examples from interface documentation to generate function names, parameter descriptions, constraints, and sample calls. A typical interface definition looks like this:
{"name": "query_account_balance","description": "Query the current balance of a specified account in a given currency","parameters": {"account_id": {"type": "string", "pattern": "^[0-9]{10}$"},"currency": {"type": "string", "enum": ["CNY", "USD"], "default": "CNY"}},"returns": {"type": "object"}}
Generated definitions must be validated. Common checks include whether parameter types are valid, whether the constraints can be satisfied by real inputs, whether the sample calls pass type checks, and whether the return structure matches the description. Interfaces that fail validation should be discarded or regenerated. Otherwise, the training data will contain self-contradictory samples.
3.3 The Importance of Parameter Constraints
Parameter constraints determine whether the model can learn to fill in parameters precisely. The more specific the constraints, the more the model must understand how a user’s intent maps to the required parameter format. For example, if a user says “check my balance in RMB,” the model must map “RMB” to a valid currency enum value. Training samples with ambiguous instructions are designed around this kind of mapping.
4. Key Structural Adjustments to the Model
From a structural perspective, this class of model continues the approach of sparse Mixture-of-Experts (MoE) and attention optimization.
