CoolFace
Modelpublic

mllmTeam/PhoneLM-1.5B

sourceHugging Faceapache-2.0updated 2y agoView on Hugging Face
0likes27downloads
Model Card

PhoneLM-1.5B is a 1.5 billion parameter decoder-only language model pre-trained on 1.1 trillion tokens.

Usage

python
from transformers import AutoTokenizer, AutoModelForCausalLM

model_name = 'mllmTeam/PhoneLM-1.5B'
model = AutoModelForCausalLM.from_pretrained(model_name, device_map='cuda', trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained(model_name)

inp = tokenizer("Machine Learning is ", return_tensors="pt")
inp = {k: v.to('cuda') for k, v in inp.items()}
out = model.generate(**inp, 
                     max_length=256,
                     do_sample=True,
                     temperature=0.7,
                     top_p=0.7
                     )
text = tokenizer.decode(out[0], skip_special_tokens=True)
print(text)

Model Details

  • Developed by: mllmTeam
  • Model type: PhoneLM 1.5B models are auto-regressive language models based on the transformer decoder architecture.
  • Language(s): English
  • Paper: [PhoneLM Technical Report]()
  • Library: PhoneLM

Model Architecture

The model is a decoder-only transformer architecture with the following modifications:

Hidden SizeLayersHeadsSequence Length
256019162048
  • Position Embeddings: Rotary Position Embeddings (Su et al., 2021) applied to the first 25% of head embedding dimensions for improved throughput following Black et al. (2022). PhoneLM quantized the sin and cos values in Rotary Position Embeddings to 8-bit integers.
  • Normalization: LayerNorm (Ba et al., 2016) with learned bias terms as opposed to RMSNorm (Zhang & Sennrich, 2019).
  • Biases: We remove all bias terms from the feed-forward networks and multi-head self-attention layers, except for the biases of the query, key, and value projections (Bai et al., 2023).
  • ReLU Activation Function: ReLU(Glorot et al., 2011) activation functions are adopted in feed-forward networks.
  • Tokenizer: We use the SmolLM(Allal et al., 2024)'s tokenizer with a vocabulary size of 49,152.

Training Dataset

The training dataset PhoneLM used is comprised of a filtered mixture of open-source large-scale datasets available on the HuggingFace Hub: DCLM-baseline(Li et al., 2024), StarCoder (Li et al., 2023), OpenWebMath (Paster et al., 2023) and Dolma (Soldaini et al., 2024).

Evaluation Results

ModelHellaSwagWinoGrandePIQASciQBoolQARC EasyARC ChallengeAverage
PhoneLM-1.5B66.963.077.388.865.569.739.967.31
Pythia-1.4B52.057.271.179.263.253.928.357.84
OPT-1.3B53.759.071.078.157.251.328.056.90
BLOOM-1.1B43.054.967.274.659.145.425.652.83
TinyLlama-1.1B59.158.973.082.358.655.731.059.80
MobileLLaMA-1.4B56.159.473.081.956.755.830.359.03
MobiLlama-1B62.259.374.882.860.356.431.761.07
OpenELM-1.1B64.861.775.683.663.655.432.362.43
DCLM-1.4B53.666.377.094.071.474.841.268.33
SmolLM-1.7B49.660.975.893.266.076.443.566.49
Qwen 1.5-1.8B60.960.574.289.466.559.134.763.61
Galactica-1.3B41.054.463.887.762.058.630.556.86
StableLM 2-1.6B68.864.175.176.980.060.339.266.34
Cerebras-GPT-1.3B38.451.966.873.059.345.825.351.50
MiniCPM-1B67.563.775.191.070.562.938.166.97
MiniCPM-2B67.263.976.192.574.669.042.769.43
Gemma-2B71.465.278.491.469.972.342.070.09
Gemma 2-2B55.068.778.796.073.680.346.971.31

License

  • This repository is released under the Apache-2.0 License.

Citation

@misc{yi2024phonelmanefficientcapablesmall,
      title={PhoneLM:an Efficient and Capable Small Language Model Family through Principled Pre-training}, 
      author={Rongjie Yi and Xiang Li and Weikai Xie and Zhenyan Lu and Chenghua Wang and Ao Zhou and Shangguang Wang and Xiwen Zhang and Mengwei Xu},
      year={2024},
      eprint={2411.05046},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2411.05046}, 
}