MobileLLM-1.5B / README.md
mikezhaocs's picture
Update README.md
3f6b4de verified
metadata
license: other
license_name: fair-noncommercial-research
extra_gated_prompt: >
  FAIR Noncommercial Research License

  Last Updated: April 17, 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
  5, 6 and 9 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 by posting a revised version at
  [https://huggingface.co/facebook/Perception-LM-8B/blob/main/LICENSE]; 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
tags:
  - facebook
  - meta
  - pytorch
  - mobilellm

Model Details

MobileLLM is introduced: "MobileLLM: Optimizing Sub-billion Parameter Language Models for On-Device Use Cases", published in ICML 2024.

Model Developer: Meta

Model Architecture: MobileLLM is an auto-regressive language model leveraging an optimized transformer architecture, specifically engineered for on-device applications with constrained resources. MobileLLM integrated several key techniques including: (1) SwiGLU activation function, (2) deep and thin architectures, (3) embedding sharing, (4) grouped-query attention. MobileLLM-125M/350M attains a remarkable 2.7%/4.3% accuracy boost over preceding 125M/350M SoTA models on zero-shot commonsense reasoning tasks. In our updated version, we further demonstrate that our design philosophy scales effectively to larger models, with SoTA results for MobileLLM-600M/1B/1.5B.

image/jpeg

# Layers # Attnetion Heads # KV Heads Token Dimension Params
MobileLLM-125M 30 9 3 576 124.6M
MobileLLM-350M 32 15 5 960 345.3M
MobileLLM-600M 40 18 6 1152 603.1M
MobileLLM-1B 54 20 5 1280 1.01B
MobileLLM-1.5B 54 25 5 1600 1.51B
Training Data Input modalities Output modalities Context Length GQA Shared Embeddings Token count
MobileLLM-125M Publicly available online data. Text Text 2k Yes Yes 1T tokens
MobileLLM-350M Publicly available online data. Text Text 2k Yes Yes 1T tokens
MobileLLM-600M Publicly available online data. Text Text 2k Yes Yes 1T tokens
MobileLLM-1B Publicly available online data. Text Text 2k Yes Yes 1T tokens
MobileLLM-1.5B Publicly available online data. Text Text 2k Yes Yes 1T tokens

How to use

We are providing 2 ways to run the model:

HuggingFace

MobileLLM codebase

HuggingFace

To load the pretrained model for further finetuning or evaluation:

from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("facebook/MobileLLM-1.5B", use_fast=False)
model = AutoModelForCausalLM.from_pretrained("facebook/MobileLLM-1.5B", trust_remote_code=True)

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

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

MobileLLM codebase

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

> git clone https://github.com/facebookresearch/MobileLLM
> pip install -r requirement.txt

# data pre-process and specify the data path in pretrain.sh
# run pretraining
> bash pretrain.sh 

We also provide evaluation script for calculating ppl of wikitext-2 test split:

> bash eval.sh

You can find more details in the GitHub repo.

Training cost

It takes the following number of days to train MobileLLM on 1T tokens using 32 NVIDIA A100 80G GPUs.

125M 350M 600M 1B 1.5B
~3 days ~6 days ~8 days ~12 days ~18 days

Evaluation

We evaluate the pretrained MobileLLM models on Zero-shot Common Sense Reasoning tasks

MobileLLM-125M

model arc_easy arc_challenge boolq piqa siqa hellaswag obqa winogrande avg.
OPT-125M 41.3 25.2 57.5 62.0 41.9 31.1 31.2 50.8 42.6
GPT-neo-125M 40.7 24.8 61.3 62.5 41.9 29.7 31.6 50.7 42.9
Pythia-160M 40.0 25.3 59.5 62.0 41.5 29.9 31.2 50.9 42.5
MobileLLM-125M 43.9 27.1 60.2 65.3 42.4 38.9 39.5 53.1 46.3
MobileLLM-LS-125M 45.8 28.7 60.4 65.7 42.9 39.5 41.1 52.1 47.0

MobileLLM-350M

model arc_easy arc_challenge boolq piqa siqa hellaswag obqa winogrande avg.
OPT-350M 41.9 25.7 54.0 64.8 42.6 36.2 33.3 52.4 43.9
Pythia-410M 47.1 30.3 55.3 67.2 43.1 40.1 36.2 53.4 46.6
MobileLLM-350M 53.8 33.5 62.4 68.6 44.7 49.6 40.0 57.6 51.3
MobileLLM-LS-350M 54.4 32.5 62.8 69.8 44.1 50.6 45.8 57.2 52.1

MobileLLM-600M

model arc_easy arc_challenge boolq piqa siqa hellaswag obqa winogrande avg.
Qwen1.5-500M 54.7 32.1 46.9 68.9 46.0 48.8 37.7 55.0 48.8
BLOOM-560M 43.7 27.5 53.7 65.1 42.5 36.5 32.6 52.2 44.2
MobiLlama-800M 52.0 31.7 54.6 73.0 43.3 52.3 42.5 56.3 50.7
MobileLLM-600M 58.1 35.8 61.0 72.3 44.9 55.9 47.9 58.6 54.3

MobileLLM-1B

model arc_easy arc_challenge boolq piqa siqa hellaswag obqa winogrande avg.
Pythia-1B 49.9 30.4 58.7 69.2 43.3 47.4 38.6 52.2 48.7
MobiLlama-1B 59.7 38.4 59.2 74.5 44.9 62.0 43.7 59.0 55.2
Falcon-1B 59.5 38.4 63.9 74.6 44.6 62.9 45.6 60.9 56.3
BLOOM-1.1B 47.6 27.3 58.6 67.0 42.4 42.2 36.6 53.8 46.9
TinyLlama-1.1B 59.2 37.1 58.1 72.9 43.9 59.1 44.7 58.8 54.2
MobileLLM-1B 63.0 39.0 66.7 74.4 45.0 61.4 46.8 62.3 57.3

MobileLLM-1.5B

model arc_easy arc_challenge boolq piqa siqa hellaswag obqa winogrande avg.
GPT-neo-1.3B 51.3 33.0 61.8 70.9 43.7 48.6 41.2 54.5 50.6
OPT-1.3B 54.4 31.7 58.4 71.5 44.7 53.7 44.6 59.1 52.3
BLOOM-1.7B 50.9 31.2 61.7 70.0 43.2 47.2 36.2 56.1 49.6
Qwen1.5-1.8B 61.1 36.5 68.3 74.1 47.2 60.4 42.9 61.2 56.5
GPT-neo-2.7B 55.8 34.3 62.4 72.9 43.6 55.6 40.0 57.9 52.8
OPT-2.7B 56.6 34.6 61.8 74.5 45.6 60.2 48.2 59.6 55.1
Pythia-2.8B 59.4 38.9 66.1 73.8 44.5 59.6 45.0 59.4 55.8
BLOOM-3B 55.1 33.6 62.1 70.5 43.2 53.9 41.6 58.2 52.3
MobileLLM-1.5B 67.5 40.9 65.7 74.8 46.4 64.5 50.5 64.7 59.4

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{liu2024mobilellm,
    title={MobileLLM: Optimizing Sub-billion Parameter Language Models for On-Device Use Cases},
    author={Liu, Zechun and Zhao, Changsheng and Iandola, Forrest and Lai, Chen and Tian, Yuandong and Fedorov, Igor and Xiong, Yunyang and Chang, Ernie and Shi, Yangyang and Krishnamoorthi, Raghuraman and others},
    journal={arXiv preprint arXiv:2402.14905},
    year={2024}
}

License

MobileLLM is FAIR NC licensed as of now