知识卡片
计算量要分预填充与逐词解码
Transformer处理整个提示与缓存后新增一个token,计算路径不同。估算FLOPs需实际层宽、头维、序列长、前馈及缓存,不能把768维和4096方阵任意相乘,便声称每个输出固定十三万亿次乘法。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- · 查看原书依据
Check out the matrix multiplications inside Llama 2, one of the most popular large language models (LLMs). To predict a single output token, Llama2 must do nearly a million (786,432) matrix multiplications. And these attention matrices aren’t small—they are 4,096 × 4,096. Llama 2 has 32 layers, each with 32 attention matrices. Each unique attention matrix is multiplied by the 4,096 prompt token embeddings, and
参考来源
- 位置:《Natural Language Processing in Action, Second Edition》附录C《附录C:向量与线性代数》(来源项目:a19c7933-4eda-4176-aebd-30fe7e1ad292;源文件:extracted/Natural Language Processing in Action, Second Edition/_epub-src/OEBPS/Text/appendix-c.html)
- 结论依据:摘录中关于计算量要分预填充与逐词解码的定义、比较或条件支撑卡片;原书表述不严谨的范围已在覆盖记录逐项限定,不把案例结果外推为普遍结论。
- 原始内容:Check out the matrix multiplications inside Llama 2, one of the most popular large language models (LLMs). To predict a single output token, Llama2 must do nearly a million (786,432) matrix multiplications. And these attention matrices aren’t small—they are 4,096 × 4,096. Llama 2 has 32 layers, each with 32 attention matrices. Each unique attention matrix is multiplied by the 4,096 prompt token embeddings, and