Skip to main content
QUICK REVIEW

[Paper Review] TinyLlama: An Open-Source Small Language Model

Peiyuan Zhang, Guangtao Zeng|arXiv (Cornell University)|Jan 4, 2024
Natural Language Processing TechniquesComputer Science57 citations
TL;DR

TinyLlama is a compact 1.1B decoder-only language model pretrained on ~3 trillion tokens (≈3 epochs) using Llama 2 architecture and open-source speedups, achieving strong performance among open-source models of similar size.

ABSTRACT

We present TinyLlama, a compact 1.1B language model pretrained on around 1 trillion tokens for approximately 3 epochs. Building on the architecture and tokenizer of Llama 2, TinyLlama leverages various advances contributed by the open-source community (e.g., FlashAttention and Lit-GPT), achieving better computational efficiency. Despite its relatively small size, TinyLlama demonstrates remarkable performance in a series of downstream tasks. It significantly outperforms existing open-source language models with comparable sizes. Our model checkpoints and code are publicly available on GitHub at https://github.com/jzhang38/TinyLlama.

Motivation & Objective

  • Evaluate whether a small 1.1B model can achieve strong performance with very large pretraining data.
  • Leverage open-source efficiencies to improve training speed and memory usage.
  • Compare TinyLlama to existing open-source models of similar size on commonsense and reasoning tasks.
  • Demonstrate openness and reproducibility by releasing data, code, and checkpoints.

Proposed method

  • Use Llama 2-style decoder architecture and tokenizer.
  • Pretrain on a mixture of SlimPajama natural language data and Starcoderdata code data (~950B tokens).
  • Train for ~3 epochs with about 3 trillion tokens total.
  • Apply speed/efficiency optimizations: Fully Sharded Data Parallel (FSDP), FlashAttention, xFormers adjustments, and grouped-query attention.
  • Use RoPE positional embeddings and RMSNorm with SwiGLU activations.
  • Pretraining follows autoregressive LM objective with AdamW, cosine lr schedule, warmup, and 2,000 warmup steps.

Experimental results

Research questions

  • RQ1Can a 1.1B parameter model achieve competitive performance when trained on an unusually large dataset (~3T tokens)?
  • RQ2Do open-source efficiency improvements enable faster training and lower memory use without sacrificing performance?
  • RQ3How does TinyLlama compare to other 1B-scale open-source models on commonsense reasoning and problem-solving benchmarks?

Key findings

  • TinyLlama significantly outperforms OPT-1.3B and Pythia-1.4B on several downstream tasks in zero-shot evaluation.
  • The model achieves competitive performance among similar-size open-source LMs on commonsense reasoning benchmarks (e.g., HellaSwag, OpenBookQA, WinoGrande, ARC, BoolQ, PIQA).
  • Training with ~3T tokens and efficiency optimizations yields high throughput (≈24,000 tokens/s per A100-40G) and requires fewer GPU-hours than comparable models.
  • TinyLlama demonstrates stronger problem-solving capabilities on InstructEval tasks (MMLU, BBH, HumanEval, DROP) than the baselines examined.
  • The model remains open-source, with pretraining code, intermediate checkpoints, and data processing details released.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.