Hugging Face Harness Adapters: Optimizing Qwen3.8-27B for Agentic Performance

Hugging Face has introduced a framework for training "harness adapters"—custom LoRA adapters trained via Reinforcement Learning (RL) that specialize a base model for a specific agent harness and task distribution. By training directly within the target harness, models achieve higher accuracy and efficiency compared to general-purpose base models.

Training Inside Agent Harnesses

Standard RL frameworks often reimplement agent loops, which can lead to discrepancies between training and deployment. This approach uses the actual agent harness in the loop, leveraging the AsyncGRPOTrainer from TRL and the Harbor integration in OpenEnv. By placing a proxy between the harness and the model (vLLM), the trainer learns from the exact tokens produced during real-world agent interactions. This method was applied to Qwen3.8-27B across three distinct harnesses: Pi, OpenCode, and Hermes Agent.

The Task Pipeline and Validation

Effective RL training requires high-quality, validated tasks that are neither too easy nor too difficult for the base model. The team constructed a dataset of 871 tasks from three sources:

  • SWE-smith: Injects bugs into real Python and Go repositories.
  • SWE-Gym: Packages real GitHub issues and fixes as Harbor tasks.
  • Tasksmith: Generates new tasks from merged pull requests, ensuring that both reference solutions and known-wrong solutions are correctly identified.

Every task underwent an eligibility screen using openenv validate to ensure determinism and correctness. A difficulty check was then performed: tasks that the base model solved 100% of the time or 0% of the time were excluded, focusing training on the "qualified" subset where the model showed potential for improvement.

Performance and Efficiency Gains

Specialized adapters consistently outperformed the base Qwen3.8-27B model. For instance, on the SWE-bench Pro (hard 51) benchmark, the Pi-adapted model improved from 40.0% to 64.0% pass@1. Beyond accuracy, these adapters are significantly more efficient; on tasks solved by both the base and adapted models, the adapters reduced tool calls by 56–72% and token usage by 44–60%.

The Super-Adapter: Merging Capabilities

Beyond individual specialists, the team created a "super-adapter" by merging the three LoRA adapters (Pi, Hermes, and OpenCode) using PEFT's concatenation method. By applying the merged weights at half-strength, the super-adapter provides a single model that performs well across all three harnesses. This model maintains high performance even when compared to the base model's "thinking" mode, despite being trained with thinking disabled, and offers substantial reductions in tool call frequency.

Implications for Agentic Models

This work demonstrates that RL training within a specific harness allows models to "escape" the limitations of general-purpose training. While the researchers noted a form of "reasoning leakage"—where models generate short, reasoning-like text before tool calls—the final results confirm that these adapters are both more accurate and more token-efficient than their base counterparts. The full recipe, including the AsyncGRPOTrainer configuration and the safeagents plugin for preventing model misbehavior, is available on the Hugging Face Hub for community reproduction.

Sources