TL;DR
Large Language Models (LLMs) that excel at deep, solitary math puzzles often make terrible interactive agents—when you try to blend both skills, the model tends to overthink in a corner instead of interacting with the world. This paper introduces M2A, a training-free "model merging" technique that surgically injects mathematical reasoning into an agent's weights without overwriting its instincts for taking external actions. It boosts real-world software engineering performance by over 7 percentage points without a single gradient update, and even gives you a physical-like "dial" to control how long the model thinks per step.
What Problem Does This Paper Address?
On paper, "reasoning" sounds like a single skill. In practice, different tasks demand completely misaligned behavioral rhythms.
Mathematical reasoning is a closed-world marathon of internal monologue: the model locks itself in a room and outputs a massive chain of thought to solve a problem in a single shot. Agentic reasoning (like fixing a bug in a codebase) is an open-world game of ping-pong: think a little, run a terminal command, observe the error, repeat.
When researchers try to combine these skills via standard multi-task training (mixing math and agent data) or naive weight averaging, the two styles clash. Usually, the heavy, single-turn math habit overwrites the nimble, multi-turn agent habit. The resulting model writes long, rambling monologues, forgets to use its tools, interacts half as much with its environment, and ultimately solves fewer tasks. The authors ask: How can we give an agent the deep analytical horsepower of a math model without ruining its interactive reflexes?
Methods
Instead of retraining models on mixed data, M2A operates directly in parameter space via model merging—combining the "task vectors" (the weight differences from a shared base model) of a fine-tuned Agent model and a Reasoning model. While weight merging is standard, M2A introduces three surgical innovations to prevent behavioral interference:
- Agent-Critical Behavior Calibration: An agent's interactive rhythm lives in its transitions—deciding when to start/stop thinking (
<think>,</think>) or trigger tools (<tool_call>). M2A runs sample trajectories through the agent and collects the hidden layer activations right around these special transition tokens, mapping out the mathematical subspace that governs the "think–act–observe" loop. - Null-Space Projected Merging: Using Singular Value Decomposition (SVD), M2A projects the math reasoning weight updates onto the null space (the orthogonal complement) of that agent-critical subspace. Intuitively, any math parameter update that would push or alter the agent's action-switching neurons is zeroed out; everything else is merged in cleanly.
- Adaptive Layer-Wise Merging: Because weight magnitudes vary wildly across layers, M2A normalizes the incoming reasoning updates to match the scale of the agent's updates per layer, governed by a single global scaling knob $\beta$. It also applies a similarity-aware mask, only merging layers where the agent and math vectors naturally point in compatible directions (above-average cosine similarity).
Datasets
No new benchmarks were introduced.
- Training Source Models: Built on
Qwen3-8B-Base(andLlama-3.1-8B), baseline agent and multi-task models were trained using curated coding-agent and math mixtures from Step-Fun’s SFT dataset (Step-3.5-Flash-SFT). - Evaluation: Real-world coding agent capability was tested on SWE-Bench Verified (resolving actual GitHub issues) and R2E. General agentic reasoning was tested on GAIA. Mathematical and general instruction-following capabilities were evaluated on AIME2024, AIME2025, MATH500, and IFEval.
Key Insights and Ideas
- A Predictable "Thinking Knob": Normally, controlling how many tokens an LLM spends thinking requires tricky reinforcement learning. In M2A, turning up the merge strength scalar ($\beta$) increases the average per-step reasoning length monotonically—and nearly linearly in the optimal zone—giving engineers a training-free dial to tune compute at test time.
- From Trial-and-Error to Evidence-Grounded Action: Looking at the logs, M2A doesn't just make the agent "think longer" in a vacuum; it changes how it works. Compared to the base agent, the M2A agent performs 30% more searches and 18.2% more file inspections before making its first code edit, and makes 17% fewer total edits. Instead of blindly poking at code to see what breaks, it diagnoses the bug first, then strikes cleanly.
- True Two-Way Synergy: Usually, preserving one skill compromises the other. Because M2A tucks math abilities neatly into the agent's null space, the merged model gets better at both interactive coding and solitary math competitions simultaneously.
Key Results
On SWE-Bench Verified (using Qwen3-8B with the OpenHands scaffold):
- M2A hits a 51.2% resolved rate, jumping +7.2 points over the base
Agent-8B(44.0%) with zero retraining—even outperforming several 32B and 72B models trained with SFT and RL. - Multi-task SFT actively hurts, dropping performance from 44.0% to 41.1% as interaction steps fall.
- Naive merging breaks the loop: Task Arithmetic reaches 47.6%, but slashes environment interactions in half (87.1 steps vs. 175.3) while tripling monologue length. M2A maintains healthy interaction (178.0 steps) with a modest, productive bump in reasoning length (253.3 to 327.4 tokens).
- Math & Generalization: M2A boosts AIME2025 success by +35.0 points (16.7% to 51.7%) and AIME2024 by +10.0 points. It also generalizes seamlessly to Llama-3.1-8B (+5.4% on SWE-Bench), different agent scaffolds (Mini-SWE-Agent, R2E), and general agent tasks (78.79% vs. 73.33% on GAIA).
Limitations and Future Work
While a dedicated limitations section is not included in the main text, the authors note a clear operational boundary in their analysis: pushing the merge strength knob ($\beta$) too high (>1.2) pushes the model into an "overthinking" regime. At that point, internal monologues balloon, delaying actions and causing trajectories to fail simply by blowing past the model's maximum context window limit. Regarding broader extensions, the authors note their findings open a new direction for combining capabilities across fundamentally misaligned behavioral patterns beyond just math and coding agents.
Summary updated