Learn / Lessons

Inside a model: weights, tensors and safetensors

What is a model, really? Let's open one up. Today we're looking at the model itself. A model is billions of numbers it learned, called weights.

Chapters

  1. 0:00Introduction
  2. 0:04Where this fits: The AI stack
  3. 0:08First: What is a model?
  4. 0:19The weights: What is a tensor?
  5. 0:30How they are stored: What is safetensors?
  6. 0:50A real one: Look inside
  7. 1:16Wrap up
Read the transcript

Introduction

What is a model, really? Let's open one up.

Where this fits: The AI stack

Today we're looking at the model itself.

First: What is a model?

A model is billions of numbers it learned, called weights. Small settings files say how to use them. A model server loads it all, and then you can ask questions.

The weights: What is a tensor?

The weights are organised into tensors. A tensor is a block of numbers with a shape. A row of numbers is one kind. A table, with rows and columns, is another.

How they are stored: What is safetensors?

Safetensors is a format from Hugging Face for storing tensors. First comes a header. For each tensor it lists a name, a number type, a shape, and where its numbers start. Then come the numbers. It holds no program code, so opening one doesn't run anything, unlike Python's older pickle format.

A real one: Look inside

This is from NVIDIA's Qwen 3.6 35B. One tensor is a table of 248,320 rows by 2,048 columns: a row for each token the model knows. The whole model has 124,468 tensors, in three safetensors files. Config and tokenizer files come too. The server needs them all.

Wrap up

Weights in tensors, stored as safetensors.

Sources

More lessons