Appearance
延伸資源
Llama 2 相關
原始論文
Llama 2: Open Foundation and Fine-Tuned Chat Models (2023)
- https://arxiv.org/abs/2307.09288
- Meta 的 Llama 2 論文,詳細介紹架構設計、訓練方法
Llama: Open and Efficient Foundation Language Models (2023)
- https://arxiv.org/abs/2302.13971
- 原始 Llama 論文,引入了許多架構創新
Meta 官方資源
- https://github.com/facebookresearch/llama
- Llama 2 官方程式碼與權重申請
關鍵技術論文
Attention
- Attention Is All You Need (Vaswani et al., 2017)
- https://arxiv.org/abs/1706.03762
- Transformer 原始論文
RoPE
- RoFormer: Enhanced Transformer with Rotary Position Embedding (Su et al., 2021)
- https://arxiv.org/abs/2104.09864
- RoPE 的原始論文
RMSNorm
- Root Mean Square Layer Normalization (Zhang & Sennrich, 2019)
- https://arxiv.org/abs/1910.07467
- RMSNorm 的原始論文
GQA
- GQA: Training Generalized Multi-Query Transformer Models from Multi-Head Checkpoints (Ainslie et al., 2023)
SwiGLU
- GLU Variants Improve Transformer (Shazeer, 2020)
- https://arxiv.org/abs/2002.05202
- SwiGLU 激活函數的原始論文
KV Cache
- Efficient Transformers: A Survey (Tay et al., 2022)
- https://arxiv.org/abs/2009.06732
- 詳細介紹各種 Transformer 效率優化技術
TinyStories
- TinyStories: How Small Can Language Models Be and Still Speak Coherent English?
- https://arxiv.org/abs/2305.07759
- 證明了小型 LLM 在限定領域的強大性能
Chinchilla
- Training Compute-Optimal Large Language Models (Hoffmann et al., 2022)
- https://arxiv.org/abs/2203.15556
- 指導模型參數與訓練 token 數的最佳比例
相關專案
推理引擎
- llama.cpp — https://github.com/ggerganov/llama.cpp
- 高效 LLM 推理的 C/C++ 實作(llama2.c 的靈感來源)
- llama2.c 各語言移植
- 見
README.md的 notable forks 章節
- 見
Karpathy 其他專案
- nanoGPT — https://github.com/karpathy/nanoGPT
- llama2.c 的前身,PyTorch GPT 訓練/推理
- micrograd — https://github.com/karpathy/micrograd
- 微型自動微分引擎
- makemore — https://github.com/karpathy/makemore
- 自迴歸字元級語言模型
Karpathy 教學影片
- Neural Networks: Zero to Hero
- https://karpathy.ai/zero-to-hero.html
- 從零開始的神經網路教學系列
學習資源
LLM 推理最佳化
- llama.cpp PR #183 — 討論各種編譯最佳化 flags
- PyTorch CPU 最佳化指南
採樣策略
- https://peterchng.com/blog/2023/05/02/token-selection-strategies-top-k-top-p-and-temperature/
- https://docs.cohere.com/docs/controlling-generation-with-top-k-top-p
- https://huggingface.co/blog/how-to-generate
量化技術
- LLM.int8() (Dettmers et al., 2022) — https://arxiv.org/abs/2208.07339
- GPTQ (Frantar et al., 2022) — https://arxiv.org/abs/2210.17323
Transformer 視覺化
- https://bbycroft.net/llm — LLM 架構的 3D 視覺化
- https://jalammar.github.io/illustrated-transformer/ — Illustrated Transformer
工具
- SentencePiece — https://github.com/google/sentencepiece
- BPE / unigram 語言模型分詞器
- Weights & Biases — https://wandb.ai
- 實驗追蹤與視覺化
- Hugging Face Hub — https://huggingface.co
- 模型與資料集託管