Why your fine-tuning job takes longer than the FLOPs say

本文为原文前 6,000 字符的节选翻译,完整内容请查看原文。

Back to Articles Why your fine-tuning job takes longer than the FLOPs say Team Article Published November 18, 2026 Upvote 6 Bruno Duarte brunoduarte01 Follow Dharma-AI Gabriel Pimenta de Freitas Cardoso GabrielPimenta99 Follow Dharma-AI Isis F Carvalho isisfc Follow Dharma-AI Breno de Almeida Beleza BrenoBeleza Follow Dharma-AI Felipe Lima limafelipe Follow Dharma-AI Predicting end-to-end fine-tuning time on shared GPU clusters, from 272 production runs. A preview of our upcoming paper, Predicting End-to-End Fine-Tuning Time for Generative Language Models. The full version will be on arXiv soon.

回到文章:为什么你的微调任务耗时比 FLOPs 计算出的更长。团队文章,发布于 2026 年 11 月 18 日。本文基于 272 次生产运行,预测共享 GPU 集群上的端到端微调时间。这是我们即将发表的论文《预测生成式语言模型的端到端微调时间》的预览,完整版本即将发布在 arXiv 上。

GPUs are among the most expensive and scarcest resources in AI today. Anyone running a shared cluster has to decide, every day, which jobs go on which GPUs and in what order. That plan is only as good as the estimate of how long each job will take. When a job finishes hours early, GPUs sit idle until the next one is dispatched. When it runs hours late, everything queued behind it slips, experiments wait and delivery dates move. Better duration estimates turn this into planning instead of guesswork: what runs, when, and on how many GPUs, with less idle capacity in between.

GPU 是当今人工智能领域最昂贵且最稀缺的资源之一。任何运营共享集群的人每天都必须决定哪些任务在哪些 GPU 上运行以及运行顺序。该计划的好坏取决于对每个任务耗时的预估。当任务提前数小时完成时,GPU 会闲置直到下一个任务被调度;当任务延迟数小时时,排在后面的所有任务都会顺延,实验被迫等待,交付日期也会推迟。更好的持续时间预估能将此过程从猜测转变为规划:明确什么任务、何时、在多少个 GPU 上运行,从而减少中间的闲置容量。

Yet the estimate most teams use is a back-of-the-envelope FLOP calculation. It says nine hours, and the job finishes the next afternoon. We wanted to know how far off that math really is, and whether we could do better before a job is even dispatched. So we took 272 real supervised fine-tuning (SFT) jobs from our production pool of NVIDIA H200 GPUs, about 7,382 GPU-hours in total, and compared analytical estimates against learned predictors.

然而,大多数团队使用的预估方法只是粗略的 FLOP 计算。它显示需要九小时,但任务却在第二天下午才完成。我们想知道这种计算方法到底偏差有多大,以及在任务调度之前我们是否能做得更好。因此,我们从 NVIDIA H200 GPU 的生产池中选取了 272 个真实的监督微调 (SFT) 任务,总计约 7,382 个 GPU 小时,并将分析预估与学习型预测器进行了比较。

The short version: the usual FLOP-based estimate explains little of what we observed (R² = 0.31, MAE 12.41 h). A CatBoost regressor that only sees information available before dispatch reaches R² = 0.98, with a mean absolute error of 1.71 h and a median error of 0.51 h in 5-fold cross-validation. The gap comes from two things a closed-form estimate cannot do. The regressor sees more training-specific signals, such as evaluation cadence, checkpoint policy, per-GPU load and fine-tuning regime, and it learns the nonlinear interactions between them from past runs.

简而言之:通常基于 FLOP 的预估对我们观察到的结果解释力很弱(R² = 0.31,MAE 12.41 小时)。一个仅查看调度前可用信息的 CatBoost 回归器达到了 R² = 0.98,在 5 折交叉验证中平均绝对误差为 1.71 小时,中位数误差为 0.51 小时。这种差距源于封闭式预估无法做到的两件事:回归器能看到更多特定于训练的信号,例如评估节奏、检查点策略、单 GPU 负载和微调方案,并且它能从过去的运行中学习这些因素之间的非线性相互作用。

The estimate everyone uses is compute-only. For a dense Transformer, training costs roughly 6·P·D floating-point operations, where P is the parameter count and D the number of training tokens. Divide that by what your GPUs can deliver and you get a training-loop time: T_theoretical = (6 · P · D) / (N_GPU · FLOPS_peak · MFU). Here N_GPU is the number of GPUs, FLOPS_peak is the peak throughput of one GPU from its spec sheet, and MFU (Model FLOPs Utilization) is the fraction of that peak the training actually achieves. Real jobs never run at peak because of memory traffic, communication and kernel inefficiencies, so MFU typically sits somewhere between 30% and 60%, and the right value for a given job is not known in advance.

每个人使用的预估方法仅考虑计算。对于密集型 Transformer,训练成本大约为 6·P·D 次浮点运算,其中 P 是参数数量,D 是训练 token 数量。将其除以 GPU 的处理能力,即可得到训练循环时间:T_theoretical = (6 · P · D) / (N_GPU · FLOPS_peak · MFU)。其中 N_GPU 是 GPU 数量,FLOPS_peak 是规格表中单个 GPU 的峰值吞吐量,MFU(模型 FLOP 利用率)是训练实际达到的峰值比例。由于内存流量、通信和内核效率低下,实际任务永远不会以峰值运行,因此 MFU 通常在 30% 到 60% 之间,而特定任务的正确数值在事先是未知的。

This is a good description of the optimization loop. A job is more than its loop, though. Before the first step there is environment setup, model download and loading, and tokenization. During training there are periodic evaluations and checkpoint uploads. At the end, the final model goes to object storage. On a multi-tenant cluster, all of it competes with other jobs for network and storage I/O. These overheads depend on configuration, and they do not scale neatly with workload or GPU count. Two jobs with the same nominal compute can finish hours apart. To keep the comparison fair, the FLOP baseline we test counts the scheduled evaluation tokens as well as the training tokens, and we sweep MFU over a wide range.

这是对优化循环的良好描述。然而,任务不仅仅是循环。在第一步之前,有环境设置、模型下载和加载以及分词过程。在训练期间,有定期评估和检查点上传。最后,最终模型被存入对象存储。在多租户集群上,所有这些过程都会与其他任务竞争网络和存储 I/O。这些开销取决于配置,并且不会随工作负载或 GPU 数量线性扩展。两个名义计算量相同的任务完成时间可能相差数小时。为了保持比较公平,我们测试的 FLOP 基准不仅计算了训练 token,还计算了计划的评估 token,并对 MFU 进行了大范围的扫描。

What we built: We treat end-to-end duration as a supervised regression problem. Given a feature vector built from the job configuration and model metadata, predict the wall-clock time between the moment the job gets its GPUs and the moment it is done. Queue time is excluded. Two design choices shaped the work: Everything is known before dispatch. Every input comes from the submitted configuration: hyperparameters, dataset sizes, model identifiers, GPU allocation. No runtime logs, no partial progress. That is what makes the prediction usable for scheduling.

我们构建的内容:我们将端到端持续时间视为一个监督回归问题。给定一个由任务配置和模型元数据构建的特征向量,预测从任务获得 GPU 到任务完成之间的挂钟时间。排队时间被排除在外。两项设计选择决定了这项工作:一切都在调度前已知。每个输入都来自提交的配置:超参数、数据集大小、模型标识符、GPU 分配。没有运行时日志,没有部分进度。这使得该预测可用于调度。

Features that expose the overheads. On top of the raw configuration we derive quantities such as num_eval_data (samples processed across all evaluation cycles), num_saves and num_params_saved (checkpoint I/O), and per-GPU token volumes. The FLOP estimate itself, with MFU fixed at 0.45, goes in as one more feature (baseline_time), so the model starts from the compute-only number and learns the corrections. We compared Linear Regression, Ridge, XGBoost and CatBoost. Feature selection combined correlation filtering, mutual information and permutation importance across 18 candidate feature sets, followed by a grid search with MAE as the criterion. The final CatBoost model uses 24 features.

揭示开销的特征。在原始配置之上,我们导出了诸如 num_eval_data(所有评估周期内处理的样本)、num_saves 和 num_params_saved(检查点 I/O)以及单 GPU token 量等指标。FLOP 预估本身(MFU 固定为 0.45)作为另一个特征 (baseline_time) 加入,因此模型从纯计算数值开始并学习修正值。我们比较了线性回归、岭回归、XGBoost 和 CatBoost。特征选择结合了 18 个候选特征集的相关性过滤、互信息和排列重要性,随后以 MAE 为标准进行了网格搜索。最终的 CatBoost 模型使用了 24 个特征。

The data: 272 SFT runs from the operational logs of a corporate production environment, covering several model families up to 15 billion parameters, both LoRA and full fine-tuning, and a wide range of dataset sizes and hyperparameters. Shared infrastructure. Jobs ran on 1, 2 or 4 GPUs drawn from a pool of 8 to 32 H200s across 1 to 4 nodes, alongside other training and inference workloads. The measured times include real contention. Durations from 1.6 to 172.4 hours, with a mean of 23.43 h and a median of 15.29 h. Stack: Hugging Face Transformers and Unsloth. We model the stack as a categorical feature and make no assumption about a fixed speedup between the two.

数据:来自企业生产环境操作日志的 272 次 SFT 运行,涵盖了多个高达 150 亿参数的模型系列,包括 LoRA 和全量微调,以及广泛的数据集大小和超参数。共享基础设施。任务在 1、2 或 4 个 GPU 上运行,这些 GPU 取自 1 到 4 个节点上的 8 到 32 个 H200 组成的池,并与其他训练和推理工作负载并存。测量的时间包括了实际的资源争用。持续时间从 1.6 小时到 172.4 小时不等,平均值为 23.43 小时,中位数为 15.29 小时。技术栈:Hugging Face Transformers 和 Unsloth。我们将技术栈建模为一个分类特征,不对两者之间的固定加速比做任何假设。

Distribution of end-to-end duration across the 272 runs. Mean 23.43 h, median 15.29 h. Results: All numbers come from stratified 5-fold cross-validation. The first four rows are analytical and involve no fitting. Model R² RMSE (h) MAE (h) FLOP baseline (MFU 30%) 0.31 20.45 12.41 FLOP baseline (MFU 45%) 0.18 22.38 13.01 FLOP baseline (MFU 60%) 0.01 24.56 14.62 Calculon −0.51 30.40 20.36 Linear Regression 0.69 ± 0.14 13.52 ±

272 次运行的端到端持续时间分布。平均值 23.43 小时,中位数 15.29 小时。结果:所有数字均来自 5 折分层交叉验证。前四行是分析性的,不涉及拟合。模型 R² RMSE (h) MAE (h) FLOP 基准 (MFU 30%) 0.31 20.45 12.41 FLOP 基准 (MFU 45%) 0.18 22.38 13.01 FLOP 基准 (MFU 60%) 0.01 24.56 14.62 Calculon −0.51 30.40 20.36 线性回归 0.69 ± 0.14 13.52 ±