CoolFace
Modelpublic

PeytonT/mobilellm-paretoq-350m-modelstack-nf4-iphone

sourceHugging Faceotherupdated 2mo agoView on Hugging Face
0likes10downloads
Model Card

Model Details

The quantized MobileLLM models is introduced in: "ParetoQ: Scaling Laws in Extremely Low-bit LLM Quantization"

Model Developer: Meta

Model Architecture: ParetoQ is the first unified framework that facilitates rigorous comparisons across 1-bit, 1.58-bit, 2-bit, 3-bit, and 4-bit quantization settings. By optimizing training schemes and refining quantization functions, ParetoQ surpasses all previous methods tailored to specific bit widths. Specifically, the 1.58-bit ParetoQ LLaMA-3 8B model reduces the performance gap to full precision by relatively 37.8% compared to the 1-bit Era’s 1.58-bit LLaMA-3 8B model, while using only 30% of the training tokens.

<div align=center> <img width=50% src="https://github.com/facebookresearch/ParetoQ/blob/main/mainresultternary.jpg?raw=true"/> </div>

<div align=center> <img width=100% src="https://github.com/facebookresearch/ParetoQ/blob/main/mainresult234bit.jpg?raw=true"/> </div>

With the SoTA points obtained through ParetoQ, we are able to improve the scaling law analysis. Figure (a) (b) demonstrates that sub-4-bit quantization, including binary, ternary, 2-bit, and 3-bit, often outperform 4-bit quantization. Notably, 2-bit and ternary models reside on the Pareto frontier. When considering hardware-friendliness and real-time speed, we generally recommend exploring 2-bit quantization for on-device applications.

<div align=center> <img width=100% src="https://github.com/facebookresearch/ParetoQ/blob/main/mainresultscaling_law.jpg?raw=true"/> </div>

How to use

We are providing 2 ways to run the model:

HuggingFace

ParetoQ codebase

HuggingFace

To load the pretrained model for further finetuning or evaluation:

bash
from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("facebook/MobileLLM-ParetoQ-125M-BF16", use_fast=False)
model = AutoModelForCausalLM.from_pretrained("facebook/MobileLLM-ParetoQ-125M-BF16", trust_remote_code=True)

Note that the default tokenizer does not contain special tokens. For example you can use:

bash
tokenizer.add_special_tokens(
    {
        "eos_token": "</s>",
        "bos_token": "<s>",
        "unk_token": "<unk>",
    }
)

ParetoQ codebase

We provide the pretraining code in https://github.com/facebookresearch/ParetoQ

bash
> git clone https://github.com/facebookresearch/ParetoQ
> pip3 install torch
> pip install -r requirement.txt

# Specify the data path and the pre-trained full-precision model path in run_train.sh file
> Run `bash 1_run_train.sh $w_bit` E.g. `bash 1_run_train.sh 2` for 2-bit weight quantization.

Evaluation

We evaluate ParetoQ models using zero-shot commonsense reasoning task accuracy and WikiText-2 perplexity.

MethodArc-eArc-cBoolqPiqaSiqaHellaSwagObqaWinoGrandeAvg.Wiki
MobileLLM-ParetoQ-125M
MobileLLM-ParetoQ-125M-BF165634.556.365.54240.142.251.348.515.1
MobileLLM-ParetoQ-125M-1-bit43.929.161.259.239.829.833.752.743.725.8
MobileLLM-ParetoQ-125M-1.58-bit49.330.96162.14134.340.452.946.520.0
MobileLLM-ParetoQ-125M-2-bit50.732.759.863.34136.340.652.747.118.2
MobileLLM-ParetoQ-125M-3-bit53.533.756.165.641.74041.251.347.915.0
MobileLLM-ParetoQ-125M-4-bit55.435.254.166.241.740.84452.148.714.1
MobileLLM-ParetoQ-350M
MobileLLM-ParetoQ-350M-BF1665.542.357.47143.553.347.358.354.810.5
MobileLLM-ParetoQ-350M-1-bit52.731.361.663.940.938.339.552.947.617.0
MobileLLM-ParetoQ-350M-1.58-bit56.836.362.267.143.54446.355.251.414.5
MobileLLM-ParetoQ-350M-2-bit5939.463.568.843.147.344.157.552.812.5
MobileLLM-ParetoQ-350M-3-bit63.940.561.470.643.251.45056.654.710.9
MobileLLM-ParetoQ-350M-4-bit64.941.657.871.344.453.548.257.955.010.3
MobileLLM-ParetoQ-600M
MobileLLM-ParetoQ-600M-BF1668.547.660.572.544.459.551.461.458.29.1
MobileLLM-ParetoQ-600M-1-bit58.936.060.565.243.144.240.753.950.314.0
MobileLLM-ParetoQ-600M-1.58-bit65.543.862.370.644.751.347.158.855.511.5
MobileLLM-ParetoQ-600M-2-bit67.743.36372.144.853.949.858.456.610.5
MobileLLM-ParetoQ-600M-3-bit68.247.464.273.144.258.150.262.458.59.4
MobileLLM-ParetoQ-600M-4-bit69.348.964.873.244.259.551.262.159.28.9
MobileLLM-ParetoQ-1B
MobileLLM-ParetoQ-1B-BF1673.450.867.674.146.764.756.662.762.18.0
MobileLLM-ParetoQ-1B-1-bit62.640.262.169.542.849.548.854.953.812.8
MobileLLM-ParetoQ-1B-1.58-bit68.547.662.872.145.357.452.961.358.510.0
MobileLLM-ParetoQ-1B-2-bit73.349.365.774.245.960.357.461.661.09.2
MobileLLM-ParetoQ-1B-3-bit72.351.46774.545.763.453.762.161.38.4
MobileLLM-ParetoQ-1B-4-bit74.752.167.974.846.964.856.262.162.57.9
MobileLLM-ParetoQ-1.5B
MobileLLM-ParetoQ-1.5B-BF1673.951.47074.846.666.455.163.262.77.9
MobileLLM-ParetoQ-1.5B-1-bit67.942.463.470.244.554.247.457.655.911.0
MobileLLM-ParetoQ-1.5B-1.58-bit70.24865.873.447.361.855.362.460.59.0
MobileLLM-ParetoQ-1.5B-2-bit73.347.570.174.146.864.655.562.561.88.3
MobileLLM-ParetoQ-1.5B-3-bit72.649.970.675.747.76656.264.562.98.0
MobileLLM-ParetoQ-1.5B-4-bit74.451.771.875.347.367.257.66363.67.6

Acknowledgement

This code is partially based on HuggingFace Transformers repo under Apache License.

Citation

If you find our code useful for your research, please consider citing:

@article{liu2025paretoq, title={ParetoQ: Scaling Laws in Extremely Low-bit LLM Quantization}, author={Liu, Zechun and Zhao, Changsheng and Huang, Hanxian and Chen, Sijia and Zhang, Jing and Zhao, Jiawei and Roy, Scott and Jin, Lisa and Xiong, Yunyang and Shi, Yangyang and others}, journal={arXiv preprint arXiv:2502.02631}, year={2025} }

License

ParetoQ is FAIR NC licensed as of now