AI 与机器学习2024arxiv.org
TinyLlama:一个开源的小型语言模型
TinyLlama: An Open-Source Small Language Model
进阶 · 约 30 分钟读完前置知识:Transformer 基础、语言模型预训练、分布式训练基础
导读
TinyLlama 是一个开源的小型语言模型(1.1B 参数),采用 Llama 2 的架构和分词器,在约 1 万亿 token 上训练而成。论文展示了小模型在有限算力下也能取得有竞争力的表现,且训练仅需 16 张 A100 GPU 跑约 90 天,便于社区复现和后续微调。
HN 关注点:是因为小模型可以在 CPU 上以 FP16 轻松运行,同时训练成本和能耗数据引发了关于 LLM 算力门槛的讨论。
HN 评论精选
这几条评论里:质疑 1 补充 1 亲历 1
亲历亲测 TinyLlama 表现不输 OpenLLaMA 3B,且可在 CPU 上以 FP16 运行
我一直在用较早的 checkpoint 给一个 Llama 实现做基准测试。纯凭个人体验,我觉得它至少不输甚至优于早期的 OpenLLaMA 3B。当然两者都不适合 RAG 或需要更强能力的场景,只是说作为小模型它是有竞争力的,而且 FP16 下就能在 CPU 上跑(无需重度量化)。
andy99查看英文原文
I've been using one of the earlier checkpoints for benchmarking a Llama implementation. Completely anecdotally I feel at least as good or better about this one than the earlier openllama 3B. I wouldn't use either of them for RAG or anything requiring more power, just to say that it's competitive as a smaller model, whatever you use those for, and easy to run on CPU at FP16 (meaning without serious quantization).
质疑围观训练过程:loss 下降极慢,建议对 Chinchilla 最优模型用更激进的学习率退火
实时围观 TinyLlama 公开的 loss 曲线很有意思,但也挺让人着急的:即使多训了一万亿 token,loss 曲线几乎不动(注意 X 轴是对数刻度)。不过它确实在下降,这才是关键。对于追求 Chinchilla 最优的模型,或许应该用更激进的学习率退火,而不是像现在所有模型那样只用 cosine-with-warmup。
minimaxir查看英文原文
It was fun to follow the public TinyLlama loss curves in near real-time, although it showed that it can be frustrating since the loss curves barely moved down even after an extra trillion tokens: https://wandb.ai/lance777/lightning_logs/reports/metric-train_loss-23-09-04-23-38-15---Vmlldzo1MzA4MzIw?accessToken=5eu2sndit2mo6eqls8h38sklcgfwt660ek1f2czlgtqjv2c6tida47qm1oty8ik9 (note the log-scaled X-axis) But they did move down and that's what's important. There should probably be more aggressive learning rate annealing for models trying to be Chinchilla-optimal instead of just cosine-with-warmup like every other model nowadays.
补充训练能耗直观化:16 张 A100 跑 90 天,耗电约等于一个美国家庭一年用电
GitHub README 里写道:用 16 张 A100-40G GPU 只需 90 天就能完成训练。我早知道训练 LLM 需要的算力很夸张,但更大的模型数字大到无法直观理解,而这个规模我能想象出机房里 16 台机器满负荷运转 90 天的样子……再想想更大的模型就有点可怕了。补充算了一下:仅 GPU(每张 250W)就耗电约 8.64 MWh,接近一个美国家庭一年的用电量(10.5 MWh)。
TheCoreh查看英文原文
From the GitHub repo Readme: > we can achieve this within a span of "just" 90 days using 16 A100-40G GPUs I knew the computational power required to train LLMs was absurd, but seeing the figures of larger networks (which are just too large to intuitively understand) it didn't really register. With this one I could actually imagine the 16 machines with A100 GPUs sitting on a server room running at full blast for 90 days so it was more tangible... And now to think about the larger ones is kinda scary Edit: Did the math and just the GPUs (at 250W each) consumed around 8.64 MWh, which is at the same ballpark of the power consumption of the average US home in one year (10.5MWh)
相关资源
从这篇论文所有 HN 讨论帖的全部评论里整理出来的链接。
历次讨论
- 2024Hacker News 讨论帖143 分 · 44 评
同领域还值得读
DeepSeek-R1:通过强化学习激励 LLM 的推理能力
DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via RL
研究如何用强化学习激励大语言模型的推理能力,提出 DeepSeek-R1,并探讨 RL 训练对模型推理表现的影响。
AI 与机器学习2025 · 1,351 分 · 1,056 评 · 引用 30进阶 · 约 80 分钟编辑精选1-bit LLM 时代:面向低成本计算的三值参数
The Era of 1-bit LLMs: ternary parameters for cost-effective computing
提出用三值参数 {-1, 0, 1} 替代 LLM 中的浮点权重,即所谓“1-bit LLM”。
AI 与机器学习2024 · 1,040 分 · 447 评 · 引用 19进阶 · 约 45 分钟编辑精选DeepSeek-V3.2:推进开放大语言模型的前沿
DeepSeek-v3.2: Pushing the frontier of open large language models
这是 DeepSeek-V3.2 的技术报告,延续了 DeepSeek 开源权重模型的路线,目标是让开放模型继续逼近甚至追平前沿闭源模型。
AI 与机器学习2025 · 982 分 · 465 评进阶 · 约 90 分钟编辑精选通过自我对弈与通用强化学习掌握国际象棋和将棋(AlphaZero)
Mastering Chess and Shogi by Self-Play with General Reinforcement Learning
DeepMind 的 AlphaZero 论文:用通用强化学习算法(自我博弈 + MCTS + 神经网络),从零开始仅数小时训练便在国际象棋和将棋上击败了世界顶级引擎 Stock…
AI 与机器学习2017 · 539 分 · 270 评 · 引用 13进阶 · 约 90 分钟编辑精选用强化学习发现更快的矩阵乘法算法
Discovering faster matrix multiplication algorithms with reinforcement learning
论文提出 AlphaTensor,用强化学习搜索矩阵乘法算法。
AI 与机器学习2022 · 518 分 · 111 评专业 · 约 90 分钟编辑精选