Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Hugging Face 9 min read Research hardMaster

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

FLOP-based estimates of fine-tuning time (6·P·D divided by GPU throughput times MFU) explain little of real end-to-end duration: across 272 production SFT runs on shared H200 clusters (about 7,382 GPU-hours), the best MFU setting gives R² = 0.31 and a 12.41 h MAE, and the Calculon analytical model does worse. A CatBoost regressor trained only on pre-dispatch configuration reaches R² = 0.98, MAE 1.71 h and median error 0.51 h. It uses overhead-aware features such as total evaluation samples, checkpoint saves and per-GPU token volume, plus the FLOP estimate as an input. Evaluation volume and checkpoint I/O rank among the most important features, which shows that work outside the optimization loop dominates. The main limits are that the data covers SFT only, a single GPU type, and few runs longer than 60 hours.

Assumes: LLM fine-tuning basicsModel FLOPs Utilizationgradient boosting regressionGPU cluster scheduling

Related posts

  • 20x Faster TRL Fine-tuning with RapidFire AI

    Hugging Face mediumAdept

    Hugging Face TRL now integrates RapidFire AI, which runs multiple SFT, DPO or GRPO fine-tuning configurations concurrently, even on a single GPU. It shards the dataset into chunks and cycles configs through GPUs at chunk boundaries, using shared-memory adapter spilling and loading for checkpointing. That gives early apples-to-apples metric comparisons and lets you stop, resume or clone-and-modify runs mid-flight with warm starts. Reported benchmarks on A100s with ~1B models show 15–20× faster time to a comparable best training loss than sequential config sweeps. Setup is a drop-in swap of TRL configs for RFSFTConfig, RFDPOConfig or RFGRPOConfig, with an MLflow-based dashboard.

  • Productizing Large Language Models

    Replit mediumAdept

    Replit runs transformer models from ~100M parameters (search, spam) through 1-10B (GhostWriter code autocomplete) to 100B+ in production, and shares lessons on making them usable. Nonsense and repetition loops are handled with temperature and frequency penalty tuning, cycle detection, multi-temperature sampling, reranking with a second model, and fine-tuning on user feedback. Quality is tracked with HumanEval, loop and nonsense rates, and A/B tests. Inference cost is cut with FasterTransformer, distillation and quantization, and GPUs are run at 70-80% utilization on Kubernetes so request queues stay bounded while autoscaling has headroom.

  • Fine-tuning Llama 2 70B using PyTorch FSDP

    Hugging Face hardMaster

    Full fine-tuning of Llama 2 70B across two nodes of 8×A100 80GB GPUs with PyTorch FSDP, Hugging Face Accelerate, Transformers and TRL, addressing three obstacles. CPU RAM exhaustion (~2TB if every rank loads the model) is avoided by loading weights only on rank 0 via the meta device and broadcasting with sync_module_states. Slow, NCCL-timeout-prone checkpointing is fixed by saving intermediate checkpoints as SHARDED_STATE_DICT and switching to FULL_STATE_DICT only for the final save. Flash Attention V2 (kernel fusion, tiling, online softmax) plus gradient checkpointing cut VRAM and time; the run finished in ~13.5 hours, with a paged AdamW optimizer needed on a single node.

  • Large Language Models: A New Moore's Law?

    Hugging Face easyNovice

    Megatron-Turing NLG 530B and the 10x-per-year growth in language model size look like a new Moore's Law heading for diminishing returns, with roughly $100M of DGX A100 hardware, 6.5 kW per server and a large carbon footprint buying only small benchmark gains. Most teams are better served by starting from pretrained models and choosing the smallest one that meets their accuracy target. Distilled or compact models such as DistilBERT (97% of BERT's language understanding, 40% smaller, 60% faster) and T0 (beats GPT-3 on many tasks at 16x smaller) show this is practical. Fine-tuning instead of training from scratch, running on cloud infrastructure, and applying pruning, layer fusion and quantization further cut cost and energy.

  • GEM Training: How Meta Doubled the Efficiency of Its LLM-Scale Ads Foundation Model

    Meta Engineering hardMaster

    Meta doubled end-to-end training efficiency of GEM, its LLM-scale ads recommendation foundation model, to 20–25% MFU while scaling training FLOPs 4x in a year, by co-designing kernels, precision, parallelism, networking and memory. Compute efficiency came from custom recommendation kernels: Jagged Flash Attention (no padding, subtraction-based masking, split-dQ backward, TLX warp specialization), GDPA unifying non-softmax attention variants (up to 3.5x over FA4 on short K/V), and 64-token BlockAttention with fused RoPE, plus MXFP8 attention and MLP that avoid CTR/CVR quality regressions. Scaling efficiency came from topology-aware 5D parallelism (2D FSDP + expert parallelism for dense, fully sharded 2D model parallelism for sparse embeddings) with SM-free collectives. Framing E2E MFU as local MFU × scaling ratio turned a sprawling co-design effort into separable optimization levers.

The quest for software engineering knowledge.

Look:
Layout: