You need to agree to share your Hugging Face information to access this model

The information you provide will be collected, stored, processed and shared in accordance with the Meta Privacy Policy.

Log in or Sign Up to review the conditions and access this model content.

MobileMoE-S (PTE) Model Card

MobileMoE is a family of on-device Mixture-of-Experts (MoE) language models with sub-billion active parameters, designed to push the quality–efficiency Pareto frontier for on-device LLMs, including three model scales (S/M/L): 0.3B/0.5B/0.9B active parameters (1.3B/2.8B/5.3B total), with <3 GB INT4 weight footprints to fit in mobile DRAM. Each scale is released in four variants: a Base model (pre-training + mid-training), an SFT model (supervised fine-tuning), a QAT model (quantization-aware training), along with an ExecuTorch model for running on phones. You are currently in the MobileMoE-S-PTE repository β€” the INT4 quantization-aware-trained 0.3B-active model packaged for phones: an ExecuTorch program (.pte) for Android phones, together with the INT4 QAT checkpoint it is converted from.

S M L
Active / total params 272M / 1.3B 528M / 2.8B 922M / 5.3B
Layers 20 26 32
Model dimension 768 1024 1280
Heads (Q / KV) 12 / 4 16 / 4 20 / 4
Routed experts 60 60 60
Top-k 4 4 4
Projected INT4 weight memory 0.68 GB 1.48 GB 2.75 GB
Base MobileMoE-S-Base MobileMoE-M-Base MobileMoE-L-Base
SFT MobileMoE-S-SFT MobileMoE-M-SFT MobileMoE-L-SFT
QAT (INT4) MobileMoE-S-QAT MobileMoE-M-QAT MobileMoE-L-QAT
QAT (INT4), ExecuTorch MobileMoE-S-PTE MobileMoE-M-PTE MobileMoE-L-PTE
model.pte 0.95 GB 2.12 GB 4.01 GB

model.pte is about a third larger than model.safetensors because ExecuTorch's INT4 kernels store the same weights with extra data per group of weights (scales in higher precision); the weight values don't change.

For the detailed technical report: πŸ“ MobileMoE: Scaling On-Device Mixture of Experts

For more versions, check out the πŸ€— MobileMoE Collection

MobileMoE establishes a new Pareto frontier for on-device LLMs

MobileMoE establishes a new Pareto frontier for on-device LLMs. Average benchmark accuracy, computed over 14 benchmarks spanning commonsense, knowledge, science, comprehension, and reasoning, is plotted against (a) per-token inference compute Finf = 2Nact (GFLOPs) and (b) total parameters Ntotal (B); in (b), x-axis tick labels show total params (B) | projected INT4 memory (GB). Accuracy is shown for the instruction-tuned models.

Key Features

  • A new Pareto frontier for on-device LLMs. Across 14 foundational benchmarks, MobileMoE matches or exceeds leading on-device dense LLMs at 2–4Γ— fewer inference FLOPs, and matches or surpasses the state-of-the-art MoE OLMoE-1B-7B with up to 60% fewer parameters.
  • Scaling-law-derived architecture. The architecture is derived from an on-device MoE scaling law that jointly optimizes under mobile memory and compute constraints, identifying an on-device sweet spot: moderate sparsity, with fine-grained experts and shared expert.
  • Four-stage recipe. Pre-training β†’ mid-training β†’ instruction fine-tuning β†’ INT4 quantization-aware training, all on open-source datasets.
  • Ready to run on phones. model.pte carries the INT4 QAT weights unchanged and runs on the CPU of Android phones with ExecuTorch 1.6.0.

Repository Contents

MobileMoE-S-PTE/
β”œβ”€β”€ mobilemoe-s-pte/            # runs on a phone (ExecuTorch)
β”‚   β”œβ”€β”€ model.pte                # graph and INT4 weights, 953 MB
β”‚   β”œβ”€β”€ tokenizer.json
β”‚   β”œβ”€β”€ tokenizer_config.json
β”‚   └── special_tokens_map.json
β”œβ”€β”€ mobilemoe-s-qat/            # the INT4 QAT checkpoint model.pte is converted from (transformers)
β”‚   β”œβ”€β”€ model.safetensors        # 714 MB
β”‚   β”œβ”€β”€ config.json, generation_config.json
β”‚   β”œβ”€β”€ configuration_mobilemoe.py, modeling_mobilemoe.py
β”‚   └── tokenizer and license files, the figures of this card
β”œβ”€β”€ export_pte.py                # converts mobilemoe-s-qat into model.pte
β”œβ”€β”€ LICENSE
└── README.md

In mobilemoe-s-qat, every INT4 weight, the routed experts included, is quantized along the same axis: in groups of 32 along the input dimension, like the shared expert and the attention. The MobileMoE-S-QAT repository groups the routed experts along the output dimension instead. The input-dimension layout is the one of ExecuTorch's INT4 kernels, so model.pte holds the 4-bit codes and FP16 scales of mobilemoe-s-qat without requantizing them; the modeling_mobilemoe.py in mobilemoe-s-qat reads this layout.

Model Information

Model: MobileMoE-S-PTE (MobileMoE-S INT4 QAT as an ExecuTorch program)
Active Parameters: 272M
Total Parameters: 1.3B
Layers: 20
Model Dimension: 768
Attention Heads: 12
KV Heads: 4 (GQA)
Head Dimension: 64
Routed Experts: 60 (fine-grained, FFN hidden dim 384 each)
Active Experts per Token: 4 (top-k sigmoid routing, with normalization)
Shared Expert: 1, always on (FFN hidden dim 1536)
Vocabulary Size: 128,256
Other Features: QK-Norm, tied input/output embeddings, RoPE (ΞΈ = 500,000)
Input Modality: Text
Output Modality: Text
Languages: English
Chat Template: Yes (end-of-turn token <|eot|>)
Training Stages: Pre-training β†’ mid-training β†’ SFT β†’ INT4 QAT
Context Length: 8,192 tokens
Format: ExecuTorch program (model.pte) for ExecuTorch 1.6.0; arm64 CPU (Android)
Precision: INT4 weights (symmetric, group size 32 along the input dimension; FP16 scales); router stored and routing computed in FP32; activations quantized to 8 bits per token at every INT4 matmul
model.pte Size: 0.95 GB
Projected INT4 Weight Memory: 0.68 GB
Model Developer: Meta
License: MobileMoE is FAIR NC licensed

Quantization

INT4 quantization-aware training is applied to the SFT checkpoint. Weights are quantized as

WΜƒg = sg Β· clamp(round(Wg / sg), βˆ’8, 7),    sg = 2Β·max(|Wg|) / (2^b βˆ’ 1),   b = 4

where Wg is a contiguous group of 32 weights along the input dimension sharing one scale sg.

component precision
Attention (q/k/v/o), routed experts, shared expert, embeddings INT4, symmetric, group size 32 along the input dimension
Router Stored and routing computed in FP32
RMSNorm weights, expert bias BF16 (stored as FP32 in model.pte, same values)

Note: model.pte is about a third larger than model.safetensors (0.95 vs 0.71 GB) because the kernels' format keeps each FP16 scale as FP32 together with the sum of its group's 4-bit values: 24 bytes per 32 weights instead of 18. On the phone the INT4 matmuls quantize their inputs to 8 bits per token; the KV cache and activations come on top of the file size.

Training

MobileMoE uses a four-stage recipe. mobilemoe-s-qat is the output of stage 4 (INT4 QAT), with the routed experts quantized along the input dimension.

MobileMoE four-stage training recipe

MobileMoE four-stage training recipe: pre-training (PT) β†’ mid-training (MT) β†’ instruct supervised fine-tuning (SFT) β†’ quantization-aware training (QAT) with INT4 precision.

Pre-training Mid-training SFT QAT
Context length 2,048 8,192 8,192 8,192
Total tokens ~6T ~500B ~126B ~21B
Peak learning rate 4Γ—10-4 4Γ—10-5 4Γ—10-6 4Γ—10-6
LR schedule Cosine Linear Cosine Cosine
Token dispatch drop-and-pad drop-and-pad dropless dropless

How to use

mobilemoe-s-pte/ runs on Android phones with ExecuTorch's command-line Llama runner; iPhones are not covered yet. mobilemoe-s-qat/ runs in transformers, and export_pte.py converts it into model.pte.

Download

The repo is gated: accept the license on this page, then:

pip install -U huggingface_hub
hf auth login
hf download facebook/MobileMoE-S-PTE --local-dir MobileMoE-S-PTE

To fetch one folder only, add --include "mobilemoe-s-pte/*" (the phone files, 1.0 GB) or --include "mobilemoe-s-qat/*" (0.7 GB).

Run on an Android phone

model.pte runs on the phone's CPU in ExecuTorch's command-line Llama runner, llama_main: you build the runner on a computer, copy it to the phone with the files of mobilemoe-s-pte/, and run it over adb. The steps follow Step 4: Run benchmark on Android phone in ExecuTorch's Llama README, with two more kernel libraries built in. ExecuTorch's prebuilt Android library (org.pytorch:executorch-android on Maven Central) is built without the torchao low-bit kernels that model.pte needs, so it cannot load it.

You need:

  • an arm64 Android phone with USB debugging on (Settings β†’ Developer options) and room for model.pte (1.0 GB);
  • a computer with git, Python 3.12, adb, the Android NDK r28c and internet access during the build, which fetches some dependencies.

Verified on a Samsung Galaxy S25, building on x86-64 Linux with:

Package Version
ExecuTorch 1.6.0
torch (CPU) 2.15.0
Android NDK r28c
CMake 3.31.10
Python 3.12

1. Build the runner

Run this in the folder that holds MobileMoE-S-PTE/, so that executorch/ ends up next to it.

1.1 Set up ExecuTorch 1.6.0, the release that exported model.pte.

python3 -m venv et-build && . et-build/bin/activate     # Python 3.12 (ExecuTorch 1.6.0 supports 3.11 to 3.15)
pip install torch==2.15.0 --index-url https://download.pytorch.org/whl/cpu
pip install executorch==1.6.0 "cmake>=3.26,<4"

git clone -b v1.6.0 --recursive https://github.com/pytorch/executorch.git
cd executorch
export ANDROID_NDK=/path/to/android-ndk-r28c

1.2 Build ExecuTorch for Android with the torchao low-bit kernels and the fused MoE kernel:

TORCH_CMAKE=$(python -c "import torch; print(torch.utils.cmake_prefix_path)")
TORCH_LIB=$(python -c "import torch, pathlib; print(pathlib.Path(torch.__file__).parent / 'lib' / 'libtorch.so')")

cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \
    -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=android-23 \
    -DCMAKE_INSTALL_PREFIX=cmake-out-android -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=python \
    -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON -DEXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR=ON \
    -DEXECUTORCH_BUILD_EXTENSION_MODULE=ON -DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
    -DEXECUTORCH_BUILD_EXTENSION_NAMED_DATA_MAP=ON -DEXECUTORCH_BUILD_EXTENSION_LLM=ON \
    -DEXECUTORCH_BUILD_EXTENSION_LLM_RUNNER=ON -DEXECUTORCH_ENABLE_LOGGING=1 \
    -DEXECUTORCH_BUILD_XNNPACK=ON -DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \
    -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON -DEXECUTORCH_BUILD_KERNELS_LLM=ON \
    -DEXECUTORCH_BUILD_KERNELS_TORCHAO=ON -DEXECUTORCH_BUILD_KERNELS_LLM_QUANTIZED_MOE_OPTIMIZED=ON \
    -DTorch_DIR=$TORCH_CMAKE/Torch -DCaffe2_DIR=$TORCH_CMAKE/Caffe2 -DTORCH_LIBRARY=$TORCH_LIB \
    -Bcmake-out-android .
cmake --build cmake-out-android -j16 --target install --config Release

Compared with ExecuTorch's README, this adds:

  • EXECUTORCH_BUILD_KERNELS_TORCHAO=ON: the kernels of the INT4 linears and the tied embedding / LM head; without them the runner stops with Missing operator: [8] torchao::_linear_8bit_act_4bit_weight.out, then Failed to load method 'forward';
  • EXECUTORCH_BUILD_KERNELS_LLM_QUANTIZED_MOE_OPTIMIZED=ON: the fast kernel of the routed experts (8-bit activations times INT4 weights); without it they fall back to dequantizing and an FP32 matmul;
  • Torch_DIR, Caffe2_DIR and TORCH_LIBRARY: the torchao kernels' build reads PyTorch's CMake files on the computer, and these point it to the CPU-only PyTorch of step 1.1 (the default Linux PyTorch wheel asks for a CUDA toolkit).

1.3 Build the Llama runner:

cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \
    -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=android-23 \
    -DCMAKE_INSTALL_PREFIX=cmake-out-android -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=python \
    -DEXECUTORCH_BUILD_XNNPACK=ON -DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \
    -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON -DEXECUTORCH_BUILD_KERNELS_LLM=ON -DSUPPORT_REGEX_LOOKAHEAD=ON \
    -Bcmake-out-android/examples/models/llama examples/models/llama
cmake --build cmake-out-android/examples/models/llama -j16 --config Release

The runner is executorch/cmake-out-android/examples/models/llama/llama_main.

2. Format the prompt

The model is instruction-tuned, and the runner takes the prompt with the chat template already applied. For a single question, in MobileMoE-S-PTE/mobilemoe-s-pte/:

printf '<|begin_of_text|><|header_start|>user<|header_end|>\n\nWho are you?<|eot|><|header_start|>assistant<|header_end|>\n\n' > prompt.txt

For a conversation, let the tokenizer files apply the template (pip install transformers, then run this in MobileMoE-S-PTE/mobilemoe-s-pte/):

from transformers import AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained(".")
messages = [
    {"role": "user", "content": "Who are you?"},
    {"role": "assistant", "content": "I'm MobileMoE, an on-device language model developed by Meta AI."},
    {"role": "user", "content": "What can you help me with?"},
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
with open("prompt.txt", "w") as f:
    f.write(prompt)

3. Copy the files to the phone

Connect the phone over USB (adb devices should list it; with more than one device attached, export ANDROID_SERIAL=<its serial>), then from MobileMoE-S-PTE/mobilemoe-s-pte/:

adb shell mkdir -p /data/local/tmp/mobilemoe
adb push model.pte tokenizer.json tokenizer_config.json special_tokens_map.json prompt.txt \
  ../../executorch/cmake-out-android/examples/models/llama/llama_main /data/local/tmp/mobilemoe/

For another prompt, write a new prompt.txt (step 2), push only that file with adb push prompt.txt /data/local/tmp/mobilemoe/ and run step 4 again.

4. Run

adb shell "cd /data/local/tmp/mobilemoe && ./llama_main --model_path model.pte --tokenizer_path . \
  --prompt_file prompt.txt --temperature 0 --max_new_tokens 256 --cpu_threads 4"
option
--tokenizer_path . the folder with tokenizer.json and tokenizer_config.json
--prompt_file the prompt of step 2
--temperature 0 greedy decoding
--max_new_tokens the most tokens to generate; the runner also stops at the end-of-turn token `<
--cpu_threads CPU threads; the technical report's latency numbers use 4

The runner writes its log to stderr, so on the terminal it shows up around and inside the reply; add 2>/dev/null inside the quotes to hide it. Its RE2 error about (?! is expected: the tokenizer's regex has a lookahead that RE2 does not support, so the runner compiles it with PCRE2 instead (-DSUPPORT_REGEX_LOOKAHEAD=ON in step 1.3). With 2>/dev/null, a Samsung Galaxy S25 printed the prompt and the reply below, then a PyTorchObserver line with timings:

<|begin_of_text|><|header_start|>user<|header_end|>

Who are you?<|eot|><|header_start|>assistant<|header_end|>

I'm MobileMoE, an on-device Mixture-of-Experts language model developed by Meta AI for efficient use on mobile and edge devices.<|eot|>

Run with transformers

mobilemoe-s-qat loads like MobileMoE-S-QAT: MobileMoE is a custom architecture, so trust_remote_code=True is required, and modeling_mobilemoe.py dequantizes the INT4 weights on the first forward pass. Requirements, multi-turn chat and known issues are in that card. From the folder that holds MobileMoE-S-PTE/:

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

MODEL_ID = "MobileMoE-S-PTE/mobilemoe-s-qat"

tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
model = AutoModelForCausalLM.from_pretrained(
    MODEL_ID,
    trust_remote_code=True,
    dtype=torch.bfloat16,
)
model.to("cuda" if torch.cuda.is_available() else "cpu")
model.eval()

messages = [{"role": "user", "content": "Who are you?"}]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)

outputs = model.generate(
    input_ids=inputs["input_ids"],
    attention_mask=inputs["attention_mask"],
    max_new_tokens=256,
    do_sample=False,
    temperature=None,
    top_p=None,
    pad_token_id=tokenizer.eos_token_id,
)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))

Convert the QAT checkpoint to the PTE

export_pte.py builds model.pte from mobilemoe-s-qat with the public ExecuTorch package (Python 3.12). In MobileMoE-S-PTE/:

pip install executorch==1.6.0 safetensors huggingface_hub
python export_pte.py --model mobilemoe-s-qat --output model.pte
sha256sum model.pte   # 65bb4ba7986b92baa4d49b04ae69be684a41368f1fde34a0fc5105ed61b534fa, the same as mobilemoe-s-pte/model.pte

The script reads the checkpoint's 4-bit codes and FP16 scales and packs them as the phone's kernels read them, so no weight is requantized; the router, expert biases and norms are copied. It builds ExecuTorch's Llama model with MobileMoE's settings (sigmoid routing with expert bias, 60 experts with top-4, a shared expert, QK-norm, Llama-3 RoPE scaling), exports it with dynamic prompt length and a KV cache, and lowers it to XNNPACK. The torchao kernels it calls are only declared at export time; the phone runner provides them, so no torchao build is needed.

No GPU is needed: on a Linux x86-64 server (Python 3.12) the export took about 6 minutes and 6 GB of memory. Exporting again gives the same file.

option
--model the QAT checkpoint folder, mobilemoe-s-qat. The script stops on a checkpoint whose routed experts are grouped along the output dimension, such as the one in MobileMoE-S-QAT
--max_context_length (8192) KV cache length: prompt and reply together; the model was trained at 8,192
--max_seq_length (640) longest prefill chunk; longer prompts are prefilled in several calls

Citation

@inproceedings{chen2026mobilemoe,
  title={MobileMoE: Scaling On-Device Mixture of Experts},
  author={Chen, Yanbei and Huang, Hanxian and Chang, Ernie and Szwejbka, Jacob and Desai, Digant and Liu, Zechun and Chandra, Vikas and Krishnamoorthi, Raghuraman},
  booktitle={Advances in Neural Information Processing Systems},
  year={2026}
}

License

MobileMoE is distributed under the FAIR Noncommercial Research License.

Downloads last month
7
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for facebook/MobileMoE-S-PTE

Quantized
(1)
this model

Collection including facebook/MobileMoE-S-PTE

Paper for facebook/MobileMoE-S-PTE

⌂ 捒网址