Tensor by Tensor

02.30 · UNIT 08 · Train, evaluate, and serve your transformer · Lesson

Checkpoints, inference, and responsible model reuse

Reliable reuse saves learned tensors plus the configuration that gives them meaning.

PLAIN-LANGUAGE INTRODUCTION

What is this?

Reliable reuse saves learned tensors plus the configuration that gives them meaning.

One simple example

A fixed input returns logits [1.2,−0.4,0.8] before saving. Reloading in evaluation mode should match them.

What goes in?

A checkpoint, matching model structure, tokenizer, and fixed test input.

What comes out?

Reproducible logits or documented fine-tuning results.

Why does it matter?

A reload check catches missing parameters and configuration mismatches.

What is it not?

A weight file alone does not define preprocessing or label meanings.

WORK THROUGH THE IDEA

See the idea in more detail

  1. Logits are raw output scores. This illustration uses [1.2,−0.4,0.8] for one fixed input.
  2. Save the state dictionary plus model configuration, vocabulary, and special-token IDs.
  3. Recreate the same architecture. Load the tensors. Set evaluation mode and disable gradient recording.
  4. Run the fixed input again. Compare all logits within a stated numeric tolerance.
  5. Common mistake: dropout in training mode can make two correct runs produce different logits.
Open the detailed notes ↗