Harness Policy Distillation: Aligning Agent Policies with Runtime Semantics
Organizations: National Key Laboratory for Novel Software Technology, Nanjing University, China · School of Artificial Intelligence, Nanjing University, China
Abstract
Deploying a general-purpose model as an agent means running it inside a product-specific runtime harness that decides which actions are executable, how state advances, and when the loop may terminate. Ordinary trajectory supervision shows which action was taken but leaves the runtime semantics behind that action implicit. We introduce Harness Policy Distillation (HPD), which makes these runtime control semantics an explicit training target alongside actions to align the harness policy. HPD replays reference trajectories through the harness to recover the runtime semantics that are implicit in ordinary trajectory data, and represents them as control documents at each model-call boundary. These documents provide privileged information for a teacher to generate actions, while harness verification ensures that the resulting targets are executable under the runtime contract. We jointly train a shared model on the runtime semantics recovered from control-state privileged information and native history, thereby internalizing these semantics into the model policy. At deployment, the trained model uses the original harness interface without requiring the control document or any additional supplement. On TRAJECT-Bench with the Pi harness, Qwen3-8B trained with HPD reaches 22.98% autonomous task success and 49.23% runtime compliance, against 3.09% and 19.90% for the unadapted model. Harness-verified teacher actions substantially improve the native deployment policy, while joint control-state supervision provides further gains in task completion and runtime compliance. HPD turns executable runtime semantics into dense supervision for learning harness-compatible actions at each decision boundary.
Figures & tables
| Method | Supervision source | TS | F1 | Step-SR | RC | Exact | Action-Acc |
| Base | — | 3.09 | 26.82 | 26.45 | 19.90 | 2.57 | 53.41 |
| SFT | Ground truth | 2.06 | 2.40 | 47.20 | 55.92 | 1.72 | 2.06 |
| DPO | Preference labels | 7.20 | 33.62 | 11.12 | 25.56 | 5.15 | 72.38 |
| GiGPO | Task reward | 4.46 | 29.65 | 26.17 | 21.61 | 3.43 | 54.63 |
| GRPO | Task reward | 3.43 | 27.59 | 25.79 | 20.41 | 2.74 | 54.35 |
| GSPO | Task reward | 7.72 | 37.61 | 13.46 | 28.64 | 6.69 | 54.30 |
| HPD variant | TS | F1 | Step-SR | RC | Exact | Action-Acc |
|---|---|---|---|---|---|---|
| HPD-T | 20.58 | 39.96 | 59.25 | 43.74 | 15.61 | 61.40 |
| T I (staged) | 18.01 | 40.23 | 47.99 | 34.99 | 14.24 | 64.07 |
| T R (staged) | 7.03 | 17.47 | 37.29 | 18.35 | 5.15 | 56.64 |
| T+I joint (without R) | 20.58 | 39.66 | 56.92 | 41.68 | 14.92 | 62.90 |
| T+R joint (without I) | 20.58 | 40.63 | 63.13 | 48.03 | 16.81 | 62.80 |
| Full HPD (T+I+R joint) | 22.98 | 41.22 | 63.79 | 49.23 | 18.70 | 64.95 |
Appendix figures & tables9 assets
Supplementary material from the paper’s appendix.
Appendix
| Setting or diagnostic | Value |
|---|---|
| Candidates per sampling attempt | |
| Attempts to full raw-trajectory coverage | 5 |
| Sampling temperature | 1 |
| Vocabulary filter | distribution_top_k=0 (full vocabulary) |
| First-attempt acceptance rate ( ) | 87.90% |
| Cumulative coverage by attempt 5 | 100% |
| Setting | Value |
|---|---|
| Accelerators | NVIDIA A800-SXM4-80GB (81,920 MiB each) |
| Host resources | 64 CPU cores; 1,030,000 MB RAM |
| Runtime and precision | CUDA 12.8; BF16 (bfloat16) |
| Batch size | 128 |
| Optimizer | torch.optim.AdamW(foreach=False) |
| Learning rate | constant |
| Method | TS | F1 | Step-SR | RC |
|---|---|---|---|---|
| Base | ||||
| HPD-T | ||||
| Full HPD |
| Optimizer steps | TS | F1 | Action-Acc | Step-SR | RC | Exact |
|---|---|---|---|---|---|---|
| 40k (intermediate) | 19.55 | 39.79 | 63.74 | 58.27 | 43.40 | 15.61 |
| 60k (completed) | 22.98 | 41.22 | 64.95 | 63.79 | 49.23 | 18.70 |
| Varied view | T:I:R | TS | F1 | Step-SR | RC | Exact |
|---|---|---|---|---|---|---|
| Default | 1:1:1 | 16.12 | 39.90 | 52.76 | 40.65 | 13.21 |
| Injected (0.2) | 5:1:5 | 15.95 | 39.18 | 56.40 | 43.57 | 12.52 |
| Injected (0.6) | 5:3:5 | 16.64 | 39.48 | 53.93 | 41.34 | 13.55 |
| Injected (1.4) | 5:7:5 | 14.92 | 39.30 | 51.21 | 39.11 | 12.01 |
| Injected (1.8) | 5:9:5 | 16.12 | 39.90 | 49.77 | 39.28 | 12.86 |
| Runtime (0.2) | 5:5:1 | 17.67 | 39.33 | 53.74 | 40.48 | 14.07 |
| Model | Variant | TS | F1 | Action-Acc | Step-SR | RC | Exact |
|---|---|---|---|---|---|---|---|
| Qwen3-0.6B | Base | 0.00 | 24.78 | 52.06 | 3.64 | 0.00 | 0.00 |
| HPD | 4.46 | 25.70 | 54.07 | 24.20 | 16.50 | 2.40 | |
| Qwen3-1.7B | Base | 0.00 | 27.00 | 49.90 | 4.53 | 0.00 | 0.00 |
| HPD | 6.52 | 30.50 | 59.00 | 33.60 | 20.80 | 3.30 | |
| Qwen3-4B | Base | 1.03 | 20.81 | 53.40 | 9.81 | 7.38 | 0.86 |
| HPD | 15.09 | 38.50 | 59.40 | 48.60 | 38.90 | 11.50 |
LLM Agent Training
Large language model agent training teaches models to plan, use tools, and learn from multi-step interaction with environments.
See all 586 papers