Fine-Tuning, and When Not ToLesson 56 of 84

Module 6 · The mechanics of a run

Reproducibility, and the noise floor

In this lesson

  • 9 min read
  • 6 reading sections
  • Knowledge check
  • Lesson 9 of 10 in this chapter

This chapter’s goalConfigure and launch a fine-tuning job with the correct chat template, masking and tokenizer handling, and diagnose from the logs alone whether a run is not learning, diverging, or memorising.

This chapter’s media

The film explains chapter ideas. The audiobook narrates the complete teaching text.

FormatEnglishहिंदी
Chapter filmNot availableNot available
Full audiobookNot availableNot available

A little at a time

Explore an idea, try it, then check what stays.

Step 1 of 7Free · no account needed
Lesson steps

Bit-identical is harder than it looks

Python
from transformers import set_seed
set_seed(0)     # python, numpy, torch, cuda

That covers weight initialisation, dropout, data shuffling and sampling. It does not give you a bit-identical run, because GPU reductions are not deterministic by default: floating-point addition is not associative, and the order in which thousands of parallel threads accumulate a sum varies between executions.

Full determinism is available and it is expensive:

Python
import torch, os
os.environ["CUBLAS_WORKSPACE_CONFIG"] = ":4096:8"
torch.use_deterministic_algorithms(True)
torch.backends.cudnn.benchmark = False

This costs throughput, and some operations have no deterministic implementation at all: the call will raise rather than silently be non-deterministic, which is the right behaviour and is also how you discover that your model uses one of them.

And even with all of it, results differ across GPU models, driver versions and library versions. Reproducibility across machines is not achievable by flags.

Your place and first choices stay on this browser. Classroom credit is recorded separately.

Every lesson here is open. Your progress is recorded once you pass the Running Models Yourself exam.

Stuck on something?Ask Rafael, your AI tutor

How to cite: Addaly (2026) ‘Reproducibility, and the noise floor’, in Fine-Tuning, and When Not To. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/fine-tuning/reproducibility-and-seeds (Accessed: 29 November 2026).