# MFU 与模型 FLOPs 计算资源清单

## Knowledge

- [PaLM: Scaling Language Modeling with Pathways](https://arxiv.org/abs/2204.02311) (Chowdhery et al., 2022)
  MFU 概念的发源地。Appendix B 给出了 Transformer 训练 FLOPs 的经典公式 6N + 12lhqt，并强调 MFU 只算必要前反向、不算重计算。
- [torchtitan: MFU 计算代码](https://github.com/pytorch/torchtitan/blob/main/torchtitan/tools/metrics.py)
  当前工业界最常被引用的 MFU 实现之一，展示了如何把 tokens/s 与单 token FLOPs 结合起来。
- [DeepSpeed Flops Profiler 文档](https://www.deepspeed.ai/tutorials/flops-profiler/)
  微软官方教程，讲解如何在训练流程中模块级地统计 FLOPs，以及 MFU 与 HFU 的区别。
- [calflops (GitHub)](https://github.com/MrYxJ/calculate-flops.pytorch)
  2023 年后比较推荐的开源库，严格区分 FLOPs 与 MACs，支持 HuggingFace 模型、tokenizer 自动构造输入、CNN / RNN / GCN / Transformer 等多种网络。
- [fvcore (GitHub)](https://github.com/facebookresearch/fvcore)
  Meta 官方维护的基础工具库，Detectron2 用它统计模型 MACs。`FlopCountAnalysis` 是 hook-based profiler 的典型实现，适合 CV 模型快速估算。
- [ptflops (GitHub)](https://github.com/sovrasov/flops-counter.pytorch)
  轻量 CNN FLOPs/MACs 估算工具，API 极简。对标准 CV 模型友好，但对 LLM / 复杂 attention 结构支持较弱。
- [How to Calculate the Number of FLOPs in Transformer Based Models](https://www.gaohongnan.com/playbook/training/how_to_calculate_flops_in_transformer_based_models.html)
  对 Transformer FLOPs 逐项拆解，适合用于验证 6N / 12lhqt 的推导。
- [Measuring useful GPU work with model FLOPs utilization and model bandwidth utilization](https://www.zettabyte.space/blog/gpu-utilization-mfu-mbu)
  讲清楚为什么 GPU Utilization 会误导人，以及 MFU 与 MBU（Model Bandwidth Utilization）该分别在什么场景看。
- [Lambda MFU Whitepaper](https://lambda.ai/hubfs/4.%20Resources/White%20Papers/Lambda%20MFU.pdf)
  工程视角的 MFU 参考，包含常见模型的基准数字和优化建议。

## Wisdom (Communities)

- [r/MachineLearning](https://reddit.com/r/MachineLearning)
  高信噪比的 ML 讨论区，适合抛出训练效率数字让别人帮忙挑刺。
- [PyTorch Performance Tuning Discord / Forums](https://discuss.pytorch.org/c/developer/performance/15)
  PyTorch 官方性能板块，适合问具体代码里的 MFU 异常。
- [Hacker News "Ask HN" threads on LLM training](https://news.ycombinator.com/search?q=llm+training+mfu)
  常有从业者分享真实集群的 MFU 数字和踩坑经验。
- 知乎 / 掘金 上的 LLM 训练效率专栏
  中文一手经验较多，但需要对营销内容保持警惕，优先看带具体配置和代码的帖子。

## Gaps

- 公开资料中对 **ViT / CNN 与 LLM 在 MFU 口径上的系统对比** 较少，多数资源只讲其中一类模型。
- 对 **推理阶段 prefill vs decode 的 MFU 计算** 缺乏统一标准，不同论文/框架口径不一。
