Text Generation
Transformers
Safetensors
PyTorch
English
mobilellm_r2
facebook
meta
mobilellm
conversational
custom_code
Instructions to use facebook/MobileLLM-R2-2.5B-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use facebook/MobileLLM-R2-2.5B-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="facebook/MobileLLM-R2-2.5B-base", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("facebook/MobileLLM-R2-2.5B-base", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use facebook/MobileLLM-R2-2.5B-base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "facebook/MobileLLM-R2-2.5B-base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "facebook/MobileLLM-R2-2.5B-base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/facebook/MobileLLM-R2-2.5B-base
- SGLang
How to use facebook/MobileLLM-R2-2.5B-base with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "facebook/MobileLLM-R2-2.5B-base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "facebook/MobileLLM-R2-2.5B-base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "facebook/MobileLLM-R2-2.5B-base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "facebook/MobileLLM-R2-2.5B-base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use facebook/MobileLLM-R2-2.5B-base with Docker Model Runner:
docker model run hf.co/facebook/MobileLLM-R2-2.5B-base
Card images from the public project page, since gated files do not load before access
9f2858e verified |
Download README.md from facebook/MobileLLM-R2-2.5B-base: direct link, hf CLI and curl.
- Browser
- Download file 31.9 kB
-
https://huggingface.co/facebook/MobileLLM-R2-2.5B-base/resolve/main/README.md
- Command line
-
hf download hf://facebook/MobileLLM-R2-2.5B-base/README.md
-
curl -L -H "Authorization: Bearer $HF_TOKEN" -o README.md https://huggingface.co/facebook/MobileLLM-R2-2.5B-base/resolve/main/README.md
31.9 kB
| license: fair-noncommercial-research-license | |
| extra_gated_prompt: > | |
| FAIR Noncommercial Research License v1 Last Updated: August 18, 2025 | |
| “Acceptable Use Policy” means the FAIR Acceptable Use Policy, applicable to | |
| Research Materials, that is incorporated into this Agreement. | |
| “Agreement” means the terms and conditions for use, reproduction, distribution | |
| and modification of the Research Materials set forth herein. | |
| “Documentation” means the specifications, manuals and documentation | |
| accompanying Research Materials distributed by Meta. | |
| “Licensee” or “you” means you, or your employer or any other person or entity | |
| (if you are entering into this Agreement on such person or entity’s behalf), | |
| of the age required under applicable laws, rules or regulations to provide | |
| legal consent and that has legal authority to bind your employer or such other | |
| person or entity if you are entering in this Agreement on their behalf. | |
| “Meta” or “we” means Meta Platforms Ireland Limited (if you are located in or, | |
| if you are an entity, your principal place of business is in the EEA or | |
| Switzerland) and Meta Platforms, Inc. (if you are located outside of the EEA | |
| or Switzerland). | |
| “Noncommercial Research Uses” means noncommercial research use cases related | |
| to research, development, education, processing, or analysis and in each case, | |
| is not primarily intended for commercial advantage or monetary compensation to | |
| you or others. | |
| “Research Materials” means, collectively, Documentation and the models, | |
| software and algorithms, including machine-learning model code, trained model | |
| weights, inference-enabling code, training-enabling code, fine-tuning enabling | |
| code, demonstration materials and other elements of the foregoing distributed | |
| by Meta and made available under this Agreement. | |
| By clicking “I Accept” below or by using or distributing any portion or | |
| element of the Research Materials, you agree to be bound by this Agreement. | |
| 1. License Rights and Redistribution. | |
| a. Grant of Rights. You are granted a non-exclusive, worldwide, | |
| non-transferable and royalty-free limited license under Meta’s intellectual | |
| property or other rights owned by Meta embodied in the Research Materials to | |
| use, reproduce, distribute, copy, create derivative works of, and make | |
| modifications to the Research Materials. | |
| b. Redistribution and Use. i. You will not use the Research Materials or any | |
| outputs or results of the Research Materials in connection with any commercial | |
| uses or for any uses other than Noncommercial Research Uses; | |
| ii. Distribution of Research Materials, and any derivative works thereof, are | |
| subject to the terms of this Agreement. If you distribute or make the Research | |
| Materials, or any derivative works thereof, available to a third party, you | |
| may only do so under the terms of this Agreement. You shall also provide a | |
| copy of this Agreement to such third party. | |
| iii. If you submit for publication the results of research you perform on, | |
| using, or otherwise in connection with Research Materials, you must | |
| acknowledge the use of Research Materials in your publication. | |
| iv. Your use of the Research Materials must comply with applicable laws and | |
| regulations (including Trade Control Laws) and adhere to the FAIR Acceptable | |
| Use Policy, which is hereby incorporated by reference into this Agreement. 2. | |
| User Support. Your Noncommercial Research Use of the Research Materials is | |
| done at your own discretion; Meta does not process any information nor provide | |
| any service in relation to such use. Meta is under no obligation to provide | |
| any support services for the Research Materials. Any support provided is “as | |
| is”, “with all faults”, and without warranty of any kind. | |
| 3. Disclaimer of Warranty. UNLESS REQUIRED BY APPLICABLE LAW, THE RESEARCH | |
| MATERIALS AND ANY OUTPUT AND RESULTS THEREFROM ARE PROVIDED ON AN “AS IS” | |
| BASIS, WITHOUT WARRANTIES OF ANY KIND, AND META DISCLAIMS ALL WARRANTIES OF | |
| ANY KIND, BOTH EXPRESS AND IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY | |
| WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A | |
| PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE FOR DETERMINING THE | |
| APPROPRIATENESS OF USING OR REDISTRIBUTING THE RESEARCH MATERIALS AND ASSUME | |
| ANY RISKS ASSOCIATED WITH YOUR USE OF THE RESEARCH MATERIALS AND ANY OUTPUT | |
| AND RESULTS. | |
| 4. Limitation of Liability. IN NO EVENT WILL META OR ITS AFFILIATES BE LIABLE | |
| UNDER ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, TORT, NEGLIGENCE, PRODUCTS | |
| LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, FOR ANY LOST PROFITS | |
| OR ANY DIRECT OR INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, EXEMPLARY OR | |
| PUNITIVE DAMAGES, EVEN IF META OR ITS AFFILIATES HAVE BEEN ADVISED OF THE | |
| POSSIBILITY OF ANY OF THE FOREGOING. | |
| 5. Intellectual Property. | |
| a. Subject to Meta’s ownership of Research Materials and derivatives made by | |
| or for Meta, with respect to any derivative works and modifications of the | |
| Research Materials that are made by you, as between you and Meta, you are and | |
| will be the owner of such derivative works and modifications. | |
| b. If you institute litigation or other proceedings against Meta or any entity | |
| (including a cross-claim or counterclaim in a lawsuit) alleging that the | |
| Research Materials, outputs or results, or any portion of any of the | |
| foregoing, constitutes infringement of intellectual property or other rights | |
| owned or licensable by you, then any licenses granted to you under this | |
| Agreement shall terminate as of the date such litigation or claim is filed or | |
| instituted. You will indemnify and hold harmless Meta from and against any | |
| claim by any third party arising out of or related to your use or distribution | |
| of the Research Materials. | |
| 6. Term and Termination. The term of this Agreement will commence upon your | |
| acceptance of this Agreement or access to the Research Materials and will | |
| continue in full force and effect until terminated in accordance with the | |
| terms and conditions herein. Meta may terminate this Agreement if you are in | |
| breach of any term or condition of this Agreement. Upon termination of this | |
| Agreement, you shall delete and cease use of the Research Materials. Sections | |
| 3, 4 and 7 shall survive the termination of this Agreement. | |
| 7. Governing Law and Jurisdiction. This Agreement will be governed and | |
| construed under the laws of the State of California without regard to choice | |
| of law principles, and the UN Convention on Contracts for the International | |
| Sale of Goods does not apply to this Agreement. The courts of California shall | |
| have exclusive jurisdiction of any dispute arising out of this Agreement. | |
| 8. Modifications and Amendments. Meta may modify this Agreement from time to | |
| time; provided that they are similar in spirit to the current version of the | |
| Agreement, but may differ in detail to address new problems or concerns. All | |
| such changes will be effective immediately. Your continued use of the Research | |
| Materials after any modification to this Agreement constitutes your agreement | |
| to such modification. Except as provided in this Agreement, no modification or | |
| addition to any provision of this Agreement will be binding unless it is in | |
| writing and signed by an authorized representative of both you and Meta. | |
| FAIR Acceptable Use Policy | |
| The Fundamental AI Research (FAIR) team at Meta seeks to further understanding | |
| of new and existing research domains with the mission of advancing the | |
| state-of-the-art in artificial intelligence through open research for the | |
| benefit of all. | |
| As part of this mission, Meta makes certain research materials available for | |
| noncommercial research use. Meta is committed to promoting the safe and | |
| responsible use of such research materials. | |
| Prohibited Uses | |
| You agree you will not use, or allow others to use, Research Materials to: | |
| Violate the law or others’ rights, including to: Engage in, promote, generate, | |
| contribute to, encourage, plan, incite, or further illegal or unlawful | |
| activity or content, such as: Violence or terrorism Exploitation or harm to | |
| children, including the solicitation, creation, acquisition, or dissemination | |
| of child exploitative content or failure to report Child Sexual Abuse Material | |
| Human trafficking, exploitation, and sexual violence The illegal distribution | |
| of information or materials to minors, including obscene materials, or failure | |
| to employ legally required age-gating in connection with such information or | |
| materials. Sexual solicitation Any other criminal activity | |
| Engage in, promote, incite, or facilitate the harassment, abuse, threatening, | |
| or bullying of individuals or groups of individuals | |
| Engage in, promote, incite, or facilitate discrimination or other unlawful or | |
| harmful conduct in the provision of employment, employment benefits, credit, | |
| housing, other economic benefits, or other essential goods and services | |
| Engage in the unauthorized or unlicensed practice of any profession including, | |
| but not limited to, financial, legal, medical/health, or related professional | |
| practices | |
| Collect, process, disclose, generate, or infer health, demographic, or other | |
| sensitive personal or private information about individuals without rights and | |
| consents required by applicable laws | |
| Engage in or facilitate any action or generate any content that infringes, | |
| misappropriates, or otherwise violates any third-party rights, including the | |
| outputs or results of any technology using FAIR research materials | |
| Create, generate, or facilitate the creation of malicious code, malware, | |
| computer viruses or do anything else that could disable, overburden, interfere | |
| with or impair the proper working, integrity, operation or appearance of a | |
| website or computer system | |
| 2. Engage in, promote, incite, facilitate, or assist in the planning or | |
| development of activities that present a risk of death or bodily harm to | |
| individuals, including use of research artifacts related to the following: | |
| Military, warfare, nuclear industries or applications, espionage, use for | |
| materials or activities that are subject to the International Traffic Arms | |
| Regulations (ITAR) maintained by the United States Department of State | |
| Guns and illegal weapons (including weapon development) | |
| Illegal drugs and regulated/controlled substances | |
| Operation of critical infrastructure, transportation technologies, or heavy | |
| machinery | |
| Self-harm or harm to others, including suicide, cutting, and eating disorders | |
| Any content intended to incite or promote violence, abuse, or any infliction | |
| of bodily harm to an individual | |
| 3. Intentionally deceive or mislead others, including use of FAIR Research | |
| Materials related to the following: | |
| Generating, promoting, or furthering fraud or the creation or promotion of | |
| disinformation | |
| Generating, promoting, or furthering defamatory content, including the | |
| creation of defamatory statements, images, or other content | |
| Generating, promoting, or further distributing spam | |
| Impersonating another individual without consent, authorization, or legal | |
| right | |
| Representing that outputs of FAIR research materials or outputs from | |
| technology using FAIR research materials are human-generated | |
| Generating or facilitating false online engagement, including fake reviews and | |
| other means of fake online engagement | |
| 4. Fail to appropriately disclose to end users any known dangers of your | |
| Research Materials. | |
| Please report any violation of this Policy or other problems that could lead | |
| to a violation of this Policy by submitting a report here | |
| [https://docs.google.com/forms/d/e/1FAIpQLSeb11cryAopJ7LNrC4nxEUXrHY26hfkXQMf_uH-oFgA3WlYZQ/viewform]. | |
| extra_gated_fields: | |
| First Name: text | |
| Last Name: text | |
| Date of birth: date_picker | |
| Country: country | |
| Affiliation: text | |
| Job title: | |
| type: select | |
| options: | |
| - Student | |
| - Research Graduate | |
| - AI researcher | |
| - AI developer/engineer | |
| - Reporter | |
| - Other | |
| geo: ip_location | |
| By clicking Submit below I accept the terms of the license and acknowledge that the information I provide will be collected stored processed and shared in accordance with the Meta Privacy Policy: checkbox | |
| extra_gated_description: >- | |
| The information you provide will be collected, stored, processed and shared in | |
| accordance with the [Meta Privacy | |
| Policy](https://www.facebook.com/privacy/policy/). | |
| extra_gated_button_content: Submit | |
| extra_gated_heading: >- | |
| Please be sure to provide your full legal name, date of birth, and full | |
| organization name with all corporate identifiers. Avoid the use of acronyms | |
| and special characters. Failure to follow these instructions may prevent you | |
| from accessing this model and others on Hugging Face. You will not have the | |
| ability to edit this form after submission, so please ensure all information | |
| is accurate. | |
| language: | |
| - en | |
| library_name: transformers | |
| pipeline_tag: text-generation | |
| tags: | |
| - meta | |
| - pytorch | |
| - mobilellm | |
| <p align="center"> | |
| <img src="https://github.com/user-attachments/assets/b1f6cc52-7fbf-4870-aed5-21e066fbd792" width="30%" /> | |
| </p> | |
| 🤗 [Hugging Face](https://huggingface.co/collections/facebook/mobilellm-r2-6b0dff6da185140fdaf1fc3a) | 🌐 [Project page](https://facebookresearch.github.io/MobileLLM/R2/) | |
| # Model Details | |
| We present MobileLLM-R2, the latest 2.5B-parameter model in the MobileLLM family. Trained on 1.2T pre-training tokens and fewer than 2T tokens in total, MobileLLM-R2 supports both long-horizon reasoning and multi-turn agentic tool use. This release includes: | |
| Base model: | |
| - [MobileLLM-R2-2.5B-base](https://huggingface.co/facebook/MobileLLM-R2-2.5B-base/) | |
| Final model: | |
| - [MobileLLM-R2-2.5B](https://huggingface.co/facebook/MobileLLM-R2-2.5B/) | |
| - [MobileLLM-R2-2.5B-GGUF](https://huggingface.co/facebook/MobileLLM-R2-2.5B-GGUF/) (llama.cpp) | |
| In addition to the models, we release the complete training recipe and intermediate checkpoints to facilitate further research on efficient and reproducible agentic model training. | |
| ## Intermediate checkpoints | |
| | [Pre-training](https://huggingface.co/facebook/MobileLLM-R2-2.5B-base/tree/MobileLLM-R2-2.5B-pretrain) | [Mid-training Phase 1](https://huggingface.co/facebook/MobileLLM-R2-2.5B-base/tree/MobileLLM-R2-2.5B-midtrain-stage1) | [Mid-training Phase 2](https://huggingface.co/facebook/MobileLLM-R2-2.5B-base) | [General SFT](https://huggingface.co/facebook/MobileLLM-R2-2.5B/tree/MobileLLM-R2-2.5B-sft-stage-1) | [Agentic Reasoning SFT](https://huggingface.co/facebook/MobileLLM-R2-2.5B/tree/MobileLLM-R2-2.5B-sft) | [On-policy Distillation](https://huggingface.co/facebook/MobileLLM-R2-2.5B) | | |
| |---|---|---|---|---|---| | |
| ## Highlights | |
| - **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. | |
|  | |
| *With only 2.5B parameters and 1.2T pre-training tokens, MobileLLM-R2 outperforms OLMo-3-7B-Instruct (7.3B parameters, 5.9T pre-training tokens) on five of the six benchmarks shown, spanning mathematical reasoning, coding, and agentic tasks.* | |
| ## News | |
| - Nov 30, 2026: 🚀 MobileLLM-R2 models are released on [HuggingFace](https://huggingface.co/collections/facebook/mobilellm-r2-6b0dff6da185140fdaf1fc3a). | |
| - Nov 24, 2025: 🔥 MobileLLM-R1.5 models are available on [HuggingFace](https://huggingface.co/collections/facebook/mobilellm-r1-68c4597b104fac45f28f448e). | |
| - Sept 29, 2025: 🎉 The technical report "[MobileLLM-R1: Exploring the Limits of Sub-Billion Language Model Reasoners with Open Training Recipes](https://arxiv.org/pdf/2509.24945)" is available. | |
| - Sept 28, 2025: 🌟 The MobileLLM-R1 training code is available on [GitHub](https://github.com/facebookresearch/MobileLLM-R1). | |
| - Sept 12, 2025: 🚀 MobileLLM-R1 models are released on [HuggingFace](https://huggingface.co/collections/facebook/mobilellm-r1-68c4597b104fac45f28f448e). | |
| **Model Architecture**: | |
| | | # Layers | # Attention Heads | # KV Heads | Dim | Hidden Dim | Params | | |
| |---|---|---|---|---|---|---| | |
| | MobileLLM-R2-2.5B | 32 | 32 | 8 | 2048 | 8192 | 2.49B | | |
| | | Input modalities | Output modalities | Context Length | Vocabulary Size | Shared Embeddings | | |
| |---|---|---|---|---|---| | |
| | [MobileLLM-R2-2.5B-base](https://huggingface.co/facebook/MobileLLM-R2-2.5B-base) | Text | Text | 16k | 202k | Yes | | |
| | [MobileLLM-R2-2.5B](https://huggingface.co/facebook/MobileLLM-R2-2.5B) | Text | Text | 32k | 202k | Yes | | |
| Our architecture builds upon the designs of MobileLLM and Muse-Glimmer-30B. We adopt the Muse-Glimmer tokenizer, which has a 202,048-token subword vocabulary, together with SwiGLU activations and RoPE with θ = 10<sup>7</sup>, and we share the input and output embedding weights. | |
| ## 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](https://huggingface.co/datasets/DCAgent2/swebench-verified-sample-100) of SWE-bench Verified, with the [Q8_0 GGUF file](https://huggingface.co/facebook/MobileLLM-R2-2.5B-GGUF/blob/main/MobileLLM-R2-Q8_0.gguf) and each task in a container without network access. These replays show runs whose fix passed the task's SWE-bench tests. | |
|  | |
|  | |
| - **Full replay:** eight solved runs in [`demo/swe_replay.html`](https://huggingface.co/facebook/MobileLLM-R2-2.5B-GGUF/blob/main/demo/swe_replay.html); download it and open it in a browser (it works offline). | |
| - **Run it yourself:** the [GGUF model card](https://huggingface.co/facebook/MobileLLM-R2-2.5B-GGUF) has the setup for both harnesses. | |
| - **Claude Code:** the run goes 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. Anthropic does not support using Claude Code with models other than Claude. | |
| # How to use | |
| The model code ships with the checkpoint, so pass `trust_remote_code=True` to both the tokenizer and the model: | |
| ```python | |
| import torch | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| tokenizer = AutoTokenizer.from_pretrained("facebook/MobileLLM-R2-2.5B", trust_remote_code=True) | |
| model = AutoModelForCausalLM.from_pretrained("facebook/MobileLLM-R2-2.5B", dtype=torch.bfloat16, trust_remote_code=True) | |
| ``` | |
| # Inference examples | |
| Transformers | |
| ```python | |
| 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)) | |
| ``` | |
| You can also serve it with stock vLLM 0.28 or newer, whose built-in `muse_glimmer` parsers return OpenAI-style `tool_calls` (on vLLM 0.17 to 0.27, install `vllm_plugin/` from the repository): | |
| ```bash | |
| vllm serve facebook/MobileLLM-R2-2.5B --trust-remote-code \ | |
| --enable-auto-tool-choice --tool-call-parser muse_glimmer --reasoning-parser muse_glimmer | |
| ``` | |
| For llama.cpp (b11671 or later): `llama-server -m MobileLLM-R2-Q4_K_M.gguf --jinja --swa-full -c 32768`. | |
| # Evaluation | |
| ## MobileLLM-R2 base model | |
| | Model | MATH500 | GSM8K | MBPP | HumanEval | CommonSense | MMLU | WikiText-2 (↓) | | |
| |---|---|---|---|---|---|---|---| | |
| | | 4-shot em | 8-shot em | 3-shot pass@1 | 0-shot pass@1 | 0-shot accuracy | 5-shot accuracy | perplexity | | |
| | **MobileLLM-R2-2.5B-base** | 45.0 | 88.9 | 54.2 | 43.9 | 56.7 | 54.4 | 15.75 | | |
| ## MobileLLM-R2 post-trained model | |
| | Category | Benchmark | **MobileLLM-R2-2.5B** | MobileLLM-R1.5-950M | Qwen3.5-2B | SmolLM3-3B | Nemotron-3-Nano-4B | Gemma-4-E2B | Olmo-3-7B | | |
| |---|---|---|---|---|---|---|---|---| | |
| | | Size | 2.50B | 0.95B | 2.27B | 3.08B | 3.97B | 2.00B / 5.12B | 7.30B | | |
| | Math | AIME24 (avg@16) | **<u>59.4</u>** | 39.8 | 13.3 | 46.7 | 58.5 | 48.1 | 54.8 | | |
| | | AIME25 (avg@16) | **49.0** | 31.0 | 16.5 | 37.7 | <u>56.5</u> | 36.0 | 42.3 | | |
| | | MATH500 | **91.0** | 86.6 | 67.8 | **91.8** | 91.4 | 77.4 | <u>92.0</u> | | |
| | | GSM8K | **91.9** | 83.7 | 76.2 | 88.0 | 87.2 | 90.1 | <u>93.3</u> | | |
| | Knowledge | MMLU | 56.5 | 37.4 | **<u>65.9</u>** | 63.2 | 65.8 | 58.1 | 63.4 | | |
| | | GPQA-Diamond | 45.2 | 29.3 | **51.5** | 41.4 | <u>61.1</u> | 44.4 | 41.9 | | |
| | Coding | HumanEval | **69.5** | 11.6 | 36.0 | 54.3 | <u>72.0</u> | 67.1 | 47.6 | | |
| | | MBPP | **49.6** | 5.6 | 23.2 | **<u>50.0</u>** | 45.8 | 47.4 | 39.2 | | |
| | | LiveCodeBench v6 | **<u>47.3</u>** | 29.1 | 12.6 | 28.8 | 45.3 | 44.8 | 21.8 | | |
| | Agentic | BFCL V4 | **50.6** | 10.2 | 48.9 | 25.7 | <u>53.8</u> | 41.9 | 31.8 | | |
| | | SWE-Bench Verified | **<u>30.9</u>** | 0.0 | 15.6 | 0.0 | 7.3 | 1.1 | 0.6 | | |
| | OOD | Terminal-Bench 2.0 | **<u>5.2</u>** | 0.0 | 4.1 | 0.4 | 2.6 | 1.9 | 1.1 | | |
| | | Aider Polyglot | **<u>6.5</u>** | 2.7 | 3.7 | 2.5 | 5.0 | 3.7 | 2.1 | | |
| | | BFCL-Parity | **77.5** | 0.0 | 30.1 | 70.2 | 68.0 | <u>84.0</u> | 69.4 | | |
| <sub>**Bold**: within 1.0 point of the best among models under 3.5B total parameters. <u>Underline</u>: best of all models.</sub> | |
| ## Quantized models (GGUF) | |
| [MobileLLM-R2-2.5B-GGUF](https://huggingface.co/facebook/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. | |
| | Quantization | Size (GB) | Perplexity | vs BF16 | | |
| |---|---|---|---| | |
| | BF16 | 5.00 | 15.61 | reference | | |
| | Q8_0 | 2.67 | 15.64 | +0.2% | | |
| | Q6_K | 2.09 | 15.64 | +0.2% | | |
| | Q5_K_M | 1.87 | 15.76 | +1.0% | | |
| | Q4_K_M | 1.67 | 16.17 | +3.6% | | |
| | IQ4_XS | 1.54 | 16.37 | +4.9% | | |
| Perplexity is measured with `llama-perplexity` on the full WikiText-2 test set at a 512-token context. | |
| # Training | |
| ## Training Process | |
|  | |
| MobileLLM-R2 is pre-trained on 1.2T tokens selected from a pool of over 15T raw tokens from 194 sources, mid-trained in two phases, the second with more math and code, and post-trained in three stages: general SFT, agentic reasoning SFT, and on-policy knowledge distillation (OPD). | |
| ### Training stages and hyperparameter details | |
| In pre-training, the model is optimized with Muon at a peak learning rate of 1.2×10<sup>-3</sup> and a weight decay of 0.1, on a cosine schedule with 7,500 warmup steps, with online knowledge distillation from Muse-Glimmer-30B (forward KL, no hard-label loss). | |
| In mid-training, two 50,000-step distillation phases from Muse-Glimmer-30B each decay the learning rate linearly to zero; the share of math and code rises from 15.1% and 27.6% in Phase 1 to 49.0% and 39.2% in Phase 2. | |
| In post-training, both SFT stages use Muon with a cosine schedule (10% warmup) and zero weight decay. OPD samples one student rollout per prompt (temperature 0.6, top-p 0.95, up to 30,000 tokens) and minimizes the forward KL from the teacher over the full vocabulary. | |
| | Stage | Phase | Tokens / Samples | Batch Size | Sequence Length | Updates / Epochs | Peak LR | #GPUs | | |
| |---|---|---|---|---|---|---|---| | |
| | Pre-training | Single phase | 1.2T tokens | 128 | 16k | 600k | 1.2e-3 | 32 x 8 | | |
| | Mid-training | Phase 1 | 105B tokens | 128 | 16k | 50k | 3.63e-4 | 16 x 8 | | |
| | | Phase 2 | 105B tokens | 128 | 16k | 50k | 3.63e-4 | 16 x 8 | | |
| | Post-training | General SFT | 2.4M samples | 1024 | 32k | 2 epochs | 8e-5 | 16 x 8 | | |
| | | Agentic Reasoning SFT | 8.8M samples | 1024 | 32k | 1 epoch | 4e-5 | 16 x 8 | | |
| | | OPD | 812K samples | 1024 | 32k | 1 epoch | 5e-6 | 16 x 8 | | |
| ## Data Mix | |
| ### Pre-training | |
| | Dataset | Subset | Mix Ratio | | |
| |---|---|---| | |
| | [FineWeb-Edu](https://huggingface.co/datasets/HuggingFaceFW/fineweb-edu) | v1.4.0 | 0.86% | | |
| | [Dolma 3](https://huggingface.co/datasets/allenai/dolma3_mix-6T-1025-7B) | Common Crawl | 57.84% | | |
| | | Stack Edu | 2.95% | | |
| | | olmOCR Science | 10.28% | | |
| | | ProofPile Arxiv | 0.31% | | |
| | | Wiki | 0.79% | | |
| | [Dolma](https://huggingface.co/datasets/allenai/dolma) | FLAN | 0.58% | | |
| | [DCLM](https://huggingface.co/datasets/mlfoundations/dclm-baseline-1.0) | Baseline | 0.51% | | |
| | [MegaMath](https://huggingface.co/datasets/IFM/MegaMath) | [Text and code blocks](https://huggingface.co/datasets/IFM/MegaMath/tree/main/megamath-text-code-block) | 0.69% | | |
| | | [Translated code](https://huggingface.co/datasets/IFM/MegaMath/tree/main/megamath-translated-code) | 0.27% | | |
| | | [QA](https://huggingface.co/datasets/IFM/MegaMath/tree/main/megamath-qa) | 0.98% | | |
| | | [Web Pro](https://huggingface.co/datasets/IFM/MegaMath/tree/main/megamath-web-pro) | 0.73% | | |
| | [Nemotron](https://huggingface.co/datasets/nvidia/Llama-Nemotron-Post-Training-Dataset) | [Code](https://huggingface.co/datasets/nvidia/Llama-Nemotron-Post-Training-Dataset/blob/main/SFT/code/code_v1.1.jsonl) | 0.51% | | |
| | | [Math](https://huggingface.co/datasets/nvidia/Llama-Nemotron-Post-Training-Dataset/blob/main/SFT/math/math_v1.1.jsonl) | 0.95% | | |
| | | [Science](https://huggingface.co/datasets/nvidia/Llama-Nemotron-Post-Training-Dataset/blob/main/SFT/science/science.jsonl) | 0.55% | | |
| | [FineMath](https://huggingface.co/datasets/HuggingFaceTB/finemath) | Base and subsets | 0.33% | | |
| | [OpenWebMath](https://huggingface.co/datasets/open-web-math/open-web-math) | Proof-Pile 2 | 0.34% | | |
| | [Algebraic Stack](https://huggingface.co/datasets/EleutherAI/proof-pile-2/tree/main/algebraic-stack) | Proof-Pile 2 | 0.31% | | |
| | [Arxiv](https://huggingface.co/datasets/togethercomputer/RedPajama-Data-1T/blob/main/urls/arxiv.txt) | Arxiv | 0.80% | | |
| | [StackExchange](https://data.together.xyz/redpajama-data-1T/v1.0.0/stackexchange/stackexchange.jsonl) | StackExchange | 0.29% | | |
| | [Wiki](https://huggingface.co/datasets/allenai/dolmino-mix-1124/tree/main/data/wiki) | English | 0.46% | | |
| | [Natural Reasoning](https://huggingface.co/datasets/facebook/natural_reasoning) | -- | 0.73% | | |
| | [Cosmopedia](https://huggingface.co/datasets/HuggingFaceTB/cosmopedia) | SmolLM | 0.27% | | |
| | Bridge data | Synthetic cross-domain | 15.78% | | |
| | Others | -- | 1.89% | | |
| | **Total** | | **100.00%** | | |
| ### Mid-training | |
| | Dataset | Subset | Rows (M) | Phase1 Mix Ratio | Phase2 Mix Ratio | | |
| |---|---|---|---|---| | |
| | [Dolmino](https://huggingface.co/datasets/allenai/dolmino-mix-1124) | DCLM Baseline | 606 | 37.03% | 6.58% | | |
| | | FLAN | 57.3 | 4.10% | 0.73% | | |
| | | peS2o | 38.8 | 11.41% | 2.03% | | |
| | | Wiki | 6.17 | 2.66% | 0.47% | | |
| | | StackExchange | 2.48 | 2.12% | 2.02% | | |
| | | Math | 21 | 11.63% | 29.39% | | |
| | [Nemotron](https://huggingface.co/datasets/nvidia/Llama-Nemotron-Post-Training-Dataset) | [Code (SFT)](https://huggingface.co/datasets/nvidia/Llama-Nemotron-Post-Training-Dataset/tree/main/SFT/code) | 10.1 | 5.69% | 8.08% | | |
| | | [Math (SFT)](https://huggingface.co/datasets/nvidia/Llama-Nemotron-Post-Training-Dataset/tree/main/SFT/math) | 22.1 | 3.45% | 19.59% | | |
| | StarCoder | [StarCoder](https://huggingface.co/datasets/bigcode/starcoderdata) | 206 | 6.90% | 9.80% | | |
| | Dolma 3 | [Stack-Edu (Python, C++, C, JavaScript)](https://huggingface.co/datasets/allenai/dolma3_mix-6T-1025-7B) | 526 | 15.00% | 21.31% | | |
| | **Total** | | | **100.00%** | **100.00%** | | |
| ### Post-training | |
| | Phase | Objective | Dataset | Data Type | Rows | Repeat | Epochs | Teacher-rewritten | | |
| |---|---|---|---|---|---|---|---| | |
| | General SFT | CE | [Dolci-Think-SFT-7B](https://huggingface.co/datasets/allenai/Dolci-Think-SFT-7B) | General Reasoning | 2.3M | 1× | 2 | 0% | | |
| | | | [Nemotron-Agentic-v1](https://huggingface.co/datasets/nvidia/Nemotron-Agentic-v1) | Agentic | 100K | 1× | 2 | 0% | | |
| | Agentic Reasoning SFT | CE | [OpenMathReasoning](https://huggingface.co/datasets/nvidia/OpenMathReasoning) (CoT) | Math Reasoning | 3.2M | 1× | 1 | 25.0% | | |
| | | | [OpenCodeReasoning-2](https://huggingface.co/datasets/nvidia/OpenCodeReasoning-2) | Code Reasoning | 2.6M | 1× | 1 | 12.9% | | |
| | | | [OpenScienceReasoning-2](https://huggingface.co/datasets/nvidia/OpenScienceReasoning-2) | Science Reasoning | 1.6M | 1× | 1 | 24.8% | | |
| | | | [OpenThoughts-Agent-SFT](https://huggingface.co/datasets/open-thoughts/OpenThoughts-Agent-SFT-100K) | Agentic | 94K | 14× | 1 | 5.0% | | |
| | | | Synthesized Agentic Data | Agentic | 27K | 3× | 1 | 0% | | |
| | OPD | KL | OpenMathReasoning | Math Reasoning | 561K | 1× | 1 | -- | | |
| | | | OpenCodeReasoning-2 | Code Reasoning | 184K | 1× | 1 | -- | | |
| | | | OpenThoughts-Agent | Agentic | 66K | 1× | 1 | -- | | |
| # Citation | |
| If you find our model useful for your research, please consider citing: | |
| ``` | |
| @article{zhao2026mobilellm-r2, | |
| 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} | |
| } | |
| @article{zhao2025mobilellm-r1, | |
| title={MobileLLM-R1: Exploring the Limits of Sub-Billion Language Model Reasoners with Open Training Recipes}, | |
| author={Zhao, Changsheng and Chang, Ernie and Liu, Zechun and Chang, Chia-Jung and Wen, Wei and Lai, Chen and Cao, Sheng, and Tian, Yuandong and Krishnamoorthi, Raghuraman and Shi, Yangyang and Chandra, Vikas}, | |
| journal={arXiv preprint arXiv:2509.24945}, | |
| year={2025} | |
| } | |
| ``` | |
| # Contact | |
| Changsheng Zhao, Meta Inc (cszhao at meta dot com) | |
| Ernie Chang, Meta Inc (erniecyc at meta dot com) | |
| Zechun Liu, Meta Inc (zechunliu at meta dot com) | |
| # License | |
| MobileLLM-R2 is released under the FAIR Noncommercial Research License; see [LICENSE](https://huggingface.co/facebook/MobileLLM-R2-2.5B/blob/main/LICENSE). | |