MobileLLM-R2: Advancing On-Device Language Models from Reasoning to Agents

Changsheng Zhao1,* Ernie Chang1,*,§ Zechun Liu1,*,† Dylan R. Ashley1 Matteo Paltenghi1 Vikas Chandra1 Yangyang Shi1 Raghuraman Krishnamoorthi1

1Meta AI

*Equal contribution, authors listed in alphabetical order §Led overall data curation efforts †Corresponding author; project lead

Bar charts comparing MobileLLM-R2-2.5B with six open models on SWE-Bench Verified, LiveCodeBench, AIME'24, Aider Polyglot, HumanEval and GSM8K
Figure 1: MobileLLM-R2 (2.5B) against six open models on six reasoning, coding and agentic benchmarks.
Training pipeline from random initialization: pre-training on 1.2T tokens, mid-training phases 1 and 2 on 105B tokens each, then General SFT on 2.4M samples, Agentic Reasoning SFT on 8.8M samples and on-policy distillation on 812k samples, producing MobileLLM-R2
Figure 2: The MobileLLM-R2 training pipeline, from pre-training on 1.2T tokens to on-policy distillation.

TL;DR: MobileLLM-R2 is a 2.5B on-device model, trained from scratch, for long-horizon reasoning and multi-turn agentic tool use.

  • Agentic coding at 2.5B parameters: 30.9% on SWE-Bench Verified, 15.3 points above the strongest baseline, Qwen3.5-2B (15.6%).
  • Reasoning and coding: the best AIME'24 (59.4%) and LiveCodeBench (47.3%) scores of all seven models compared.
  • Token efficiency: 1.2T pre-training tokens, 9.3× fewer than SmolLM3-3B and 30× fewer than the Qwen3 family.
  • On-policy distillation: the final stage adds 9.6 points on AIME'24, 8.7 on LiveCodeBench and 5.9 on SWE-Bench Verified over the SFT model.
  • On device: 3.0 GiB of memory at a 32K context with Q4_K_M weights and an 8-bit KV cache, suggesting memory feasibility on commodity mobile devices.

Introduction

Agentic models are moving language models from reasoning and responding to acting: interacting with applications on behalf of users. Bringing this to devices means building reliable agentic skills within tight memory and compute budgets, yet the end-to-end training of small agentic models is poorly understood. Existing work either keeps large-model recipes proprietary or optimizes post-training in isolation.

Our central finding is that agentic performance after post-training depends strongly on what pre-training establishes. Post-training sharpens what the base model can already express, but does not reliably recover what it cannot. So we design pre-training and post-training as one end-to-end recipe.

Data mixtures are optimized recursively by measured performance, with synthetic bridge data to ease competition between capabilities. Sampling lift is an early indicator of post-training potential, and a readiness predictor anticipates diminishing returns from pre-training. In post-training, a joint SFT stage learns long-horizon reasoning and multi-turn agentic trajectories together, and aligning the SFT data with the teacher, in chat format and in trajectories, is critical for on-policy distillation.

Pre-training

1) Mixtures chosen by measured performance, not hand-set ratios

We build the pre-training mixture from a pool of over 15T raw tokens from 194 sources. Each round trains candidate mixtures at small scale and uses their scores to refine the next, until scores plateau; the final run is then monitored for diminishing returns.

Data curation pipeline with a mixture-selection stage and a monitored full-scale run
Data curation: mixture selection, then a monitored full-scale run.
Animation of one round of the data pipeline: fitting, validation and audit splits; sources processed into weighted groups; training scored per cluster on the validation split
One round of the data pipeline, row by row.

2) Bridge data eases competition between domains

Adding data for one capability can affect performance on others, and the trade-offs are sharpest in small models. Synthetic bridge documents combine competing domains in a natural intermediate form, such as natural-language explanations of code. They make up 15.8% of the pre-training mixture and, in our ablation, improve all 19 evaluated benchmarks, with an average gain of 1.27 percentage points (3.48% relative).

3) Sampling lift signals post-training potential

Sampling lift, Δ16 = pass@16 − pass@1, measures solvable capability that sits outside the model's most likely output, which is what post-training can draw on. Later in pre-training, pass@1 keeps improving while pass@16 saturates, and post-training gains diminish as the lift shrinks.

Base pass@k for k from 1 to 16 on GSM8K, HumanEval and MultiPL-E across pre-training checkpoints, and post-SFT pass@1 for each checkpoint
Sampling lift provides an early signal of post-training potential.

4) Zero-shot scores predict performance after post-training

A ridge-regression readiness predictor maps a checkpoint's 20 zero-shot scores and its sampling lift to its BFCL score after a fixed post-training recipe. Fit on checkpoints before 500k steps, it tracks the later held-out checkpoints without post-training them.

(a) Measured post-trained BFCL across pre-training checkpoints against the frozen predictor forecast; (b) fitted predictor weights by capability domain and for sampling lift
(a) Measured post-trained BFCL against the predictor's forecast. (b) Predictor weights by capability domain and for sampling lift.

Code provides the strongest signal (37.7%), and sampling lift carries information that zero-shot accuracy does not. Mid-training follows: two 50,000-step phases distill from Muse-Glimmer-30B on 105B tokens each, and Phase 2 raises the share of mathematics and code from 15.1% and 27.6% to 49.0% and 39.2%.

Post-training

Post-training has three stages: general SFT, agentic reasoning SFT, and on-policy knowledge distillation (OPD), in which the student trains on its own rollouts with the teacher's next-token distribution as the target.

1) One model learns long reasoning and agentic tool use together

Single-turn reasoning and multi-turn tool use demand different reasoning patterns. Median outputs run from 1,724 to 16,718 tokens on math and coding problems but 210 tokens per turn on SWE-Bench, where reasoning interleaves with tool calls. Trained on both, one model keeps MATH500, AIME'25 and LiveCodeBench close to reasoning-only training and reaches 27.0% on SWE-Bench, against 25.4% for agentic-only training.

Training dataMATH500AIME'25LCBSWE-Bench
Long-horizon reasoning data only90.8%38.3%31.4%0.0%
Agentic multi-turn data only30.0%2.6%12.0%25.4%
Joint reasoning + agentic training91.2%37.1%29.3%27.0%

SFT data mixtures: reasoning data, agentic data, or both.

2) Distillation needs the teacher's chat template

Because OPD supervises the student's own trajectories, it depends on how compatible they are with the teacher, starting with the chat protocol. Tool-use formats differ across model families, and small mismatches can degrade tool use or invalidate whole episodes, so we convert source trajectories into the native Muse-Glimmer protocol.

LLaMA 3.1

<|start_header_id|>assistant<|end_header_id|>

<|python_tag|>{
  "type": "function",
  "name": "get_weather",
  "parameters": {"city": "Tokyo"}
}<|eom_id|>

<|start_header_id|>ipython<|end_header_id|>

...<|eot_id|>

<|start_header_id|>assistant<|end_header_id|>

...<|eot_id|>

Qwen3.5

<|im_start|>assistant
<tool_call>
<function=get_weather>
<parameter=city>
Tokyo
</parameter>
</function>
</tool_call><|im_end|>

<|im_start|>user
<tool_response>
...
</tool_response><|im_end|>

<|im_start|>assistant
...<|im_end|>

Muse-Glimmer

<|start|>assistant to=self<|message|>
...<|eom|>

<|start|>assistant to=get_weather<|message|>
<atem:function_calls>
<atem:invoke name="get_weather">
<atem:parameter name="city">Tokyo</atem:parameter>
</atem:invoke>
</atem:function_calls><|eot|>

<|start|>tool<|message|>
<tool_output>...</tool_output><|eot|>

<|start|>assistant to=user<|message|>
...<|eot|>
The same tool call serialized in LLaMA 3.1, Qwen3.5 and Muse-Glimmer.

3) Teacher-written solutions make one distillation round enough

SFT data can also teach behaviors unlike the teacher's. Mismatches with limited impact on SFT accuracy matter far more after OPD: the template switch lifts mean AIME'24/'25 accuracy after OPD from 17.1 to 36.8, and adding 25% teacher-written solutions lifts it to 54.9. With them, one OPD round is enough; without them, OPD first lowers accuracy and needs several rounds to recover.

SFT Stage 2 data formatAfter SFTAfter OPD
Original chat template43.417.1
Muse-Glimmer template49.036.8
+ 25% teacher-written solutions43.954.9

Mean AIME'24/'25 accuracy after SFT and after OPD, for three SFT data formats.

Results

We compare MobileLLM-R2 with six open models from 0.95B to 7.3B parameters on 14 benchmarks, all reproduced from publicly released checkpoints under one evaluation framework and protocol. Among models with fewer than 3.5B total parameters, it is best or within 1.0 point of the best on 12 of 14, and it beats OLMo-3-7B-Instruct on AIME'24, AIME'25, HumanEval, LiveCodeBench and SWE-Bench Verified with a third of the parameters.

Results tables

CategoryBenchmark MobileLLM-
R1.5-950M0.95B
Qwen3.5-
2B2.27B
SmolLM3-
3B3.08B
Nemotron-3-
Nano-4B3.97B
Gemma-4-
E2B2.00B / 5.12B
Olmo-3-
7B7.30B
MobileLLM-
R2-2.5B2.50B
MathAIME24 (avg@16)39.813.346.758.548.154.859.4
AIME25 (avg@16)31.016.537.756.536.042.349.0
MATH50086.667.891.891.477.492.091.0
GSM8K83.776.288.087.290.193.391.9
KnowledgeMMLU37.465.963.265.858.163.456.5
GPQA29.351.541.461.144.441.945.2
CodingHumanEval11.636.054.372.067.147.669.5
MBPP5.623.250.045.847.439.249.6
LiveCodeBench29.112.628.845.344.821.847.3
AgenticBFCL V410.248.925.753.841.931.850.6
SWE-Bench Verified0.015.60.07.31.10.630.9
OODTerminal-Bench0.04.10.42.61.91.15.2
Aider Polyglot2.73.72.55.03.72.16.5
BFCL-Parity0.030.170.268.084.069.477.5

Accuracy (%), parameter counts under the names. Bold: within 1.0 point of the best model under 3.5B total parameters; underline: best overall. Per-benchmark protocols are in the paper.

Model Details

MobileLLM-R2-2.5B builds on the architectural designs of MobileLLM and Muse-Glimmer-30B. It has 32 layers, 32 attention heads with 8 key-value heads, a model dimension of 2048, a hidden dimension of 8192, and 2.49B parameters in total. It uses the 202,048-token Muse-Glimmer tokenizer, SwiGLU, RoPE (θ = 10⁷), and shared input and output embeddings. Training hyperparameters and detailed data compositions for all stages are provided in the paper.

Released models: MobileLLM-R2-2.5B-base, the base model after mid-training (16k context); MobileLLM-R2-2.5B, the final model (32k context); and MobileLLM-R2-2.5B-GGUF for llama.cpp.

Quantized Models (GGUF)

MobileLLM-R2-2.5B-GGUF provides BF16 and five quantizations from 1.5 to 5.0 GB. These files, in dense/, run on llama.cpp built with the small patch in that folder; on an Apple M4 Max laptop, Q4_K_M with an 8-bit KV cache decodes 137 tokens/s at a 4K context.

QuantizationSize (GB)Perplexityvs BF16
BF165.0015.61reference
Q8_02.6715.64+0.2%
Q6_K2.0915.64+0.2%
Q5_K_M1.8715.76+1.0%
Q4_K_M1.6716.17+3.6%
IQ4_XS1.5416.37+4.9%

Size and WikiText-2 perplexity of each GGUF quantization. Perplexity is measured with llama-perplexity on the full WikiText-2 test set at a 512-token context.

Demo: a local coding agent

MobileLLM-R2 runs as a coding agent on a laptop with llama.cpp. We ran two agent harnesses, Terminus-2 and Claude Code, on tasks from a 100-task sample of SWE-bench Verified, with the Q8_0 GGUF file and each task in a container without network access. These replays show runs whose fix passed the task's SWE-bench tests.

Replay: MobileLLM-R2 Q8_0 fixing django__django-13410 in Terminus-2
MobileLLM-R2 (Q8_0) fixing django__django-13410 in Terminus-2.
Replay: MobileLLM-R2 Q8_0 fixing django__django-11066 in Claude Code
MobileLLM-R2 (Q8_0) fixing django__django-11066 in Claude Code, through a small adapter that repairs mechanical tool-call mistakes; it is provided as a demo only, and its code will be released with our open-source code on GitHub.

The GGUF repository has the full replay page for eight solved runs and the setup for both harnesses.

Quick Start

The model code ships with the checkpoint, so pass trust_remote_code=True to both the tokenizer and the model (transformers 4.57 or 5.x). Reasoning strength defaults to high; agentic and tool-calling use matches the agentic training data with low reasoning strength.

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "facebook/MobileLLM-R2-2.5B"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
    model_id, dtype=torch.bfloat16, trust_remote_code=True
).to("cuda")

# Math problem / default scenario (reasoning strength "high" by default)
messages = [{"role": "user", "content": "Compute: $1-2+3-4+5- \\dots +99-100$."}]
inputs = tokenizer.apply_chat_template(
    messages, add_generation_prompt=True, return_tensors="pt", return_dict=True
).to("cuda")

# Tool calling / agentic scenario: low reasoning strength, as in the agentic training data
tools = [{"type": "function", "function": {"name": "get_weather",
    "description": "Get the current weather for a city.",
    "parameters": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]}}}]
messages = [{"role": "user", "content": "What is the weather like in Paris right now?"}]
inputs = tokenizer.apply_chat_template(
    messages, tools=tools, reasoning_strength="low",
    add_generation_prompt=True, return_tensors="pt", return_dict=True
).to("cuda")

out = model.generate(**inputs, max_new_tokens=30000)  # sampling defaults: temperature 0.6, top-p 0.95, top-k 20
print(tokenizer.decode(out[0, inputs["input_ids"].shape[1]:], skip_special_tokens=False))

Serve it with stock vLLM 0.28 or newer, which loads the model code shipped in the repository; the built-in muse_glimmer parsers return OpenAI-style tool_calls and reasoning. For llama.cpp, use the GGUF files.

vllm serve facebook/MobileLLM-R2-2.5B --trust-remote-code \
    --enable-auto-tool-choice --tool-call-parser muse_glimmer --reasoning-parser muse_glimmer

llama-server -m MobileLLM-R2-Q4_K_M.gguf --jinja --swa-full -c 32768

BibTeX

@article{zhao2026mobilellmr2,
  title   = {MobileLLM-R2: Advancing On-Device Language Models from Reasoning to Agents},
  author  = {Zhao, Changsheng and Chang, Ernie and Liu, Zechun and Ashley, Dylan R. and
             Paltenghi, Matteo and Chandra, Vikas and Shi, Yangyang and Krishnamoorthi, Raghuraman},
  journal = {arXiv preprint},
  year    = {2026}
}