What a Model Actually Is: A File of Numbers That Learned a Shape

Open the folder, look inside, and the mystery shrinks to something you can hold

Contents

Download a model from a public model hub and you get a folder. Inside sit a few small text files and one or more very large ones with names like model-00001-of-00004.safetensors. That is the whole object. There is no hidden server, no database of facts, no rulebook of grammar. A folder, a pile of numbers, and a short description of how to multiply them together.

This post opens a series called The Model Shelf, where I will take the models people talk about one at a time and explain the vocabulary around them. Everything later in the series leans on one idea, so it is worth getting it solid first: a model is a shape, stored as numbers. Once that lands, terms like parameters, quantisation, context window and fine-tuning stop sounding like jargon and start sounding like descriptions of a file.

If you want the wider orientation first, what AI actually is covers the marketing layer. This post goes underneath it.

Two ingredients: a recipe and a pile of numbers

Every neural-network model has two parts that can be separated, and you can see them in the folder.

The first part is the architecture: the recipe. It says how many layers exist, how wide each one is, how tokens get turned into vectors, how attention is wired. This is small, human-readable and usually lives in a config.json plus some code in a library. For a Mistral-style model the config is a few dozen lines: a hidden size, a number of layers, a vocabulary size and some details of the attention.

The second part is the weights: the pile of numbers. Each weight is a single decimal number, and a model has a lot of them. The Mistral 7B paper describes a “7-billion-parameter language model”, meaning seven billion of those numbers. They are grouped into big grids called tensors, and each tensor has a name such as the weights of the third layer’s attention query projection.

The two parts only make sense together. The recipe without the numbers is an empty building with all the rooms laid out and no furniture. The numbers without the recipe are furniture in a skip, with no way to know which piece goes where. That coupling is why model downloads ship both.

Architecturethe shape: codeWeightsthe numbers: a fileRuntimeloads and multipliesText outone token at a time
The architecture says what to multiply in what order. The weights are the values to multiply by.

What is physically in the file

The common container today is safetensors, created by Hugging Face so that a model file could be loaded without executing arbitrary code, which the older pickle-based format allowed. The safetensors documentation describes it as a simple format for storing tensors that is also fast, with zero-copy loading.

Structurally it is plain. The file starts with a small header, written in JSON, that lists every tensor: its name, its numeric type, its shape and where its bytes sit in the file. After the header comes the raw numbers back to back. A reader can look up one tensor by name and jump straight to it. Nothing is compressed in a clever way and nothing is executable.

A magnetic-core memory plane, a grid of tiny wired rings each storing one bit.
Core memory, an early physical store of numbers; a model file is the same idea at vastly larger scale, billions of stored values. Photo: Mémoire à tores Bull Gamma 60 - Musée des arts et métiers by Tieum512, CC BY 3.0, via Wikimedia Commons.

The local-model world has a sibling format, GGUF, used by llama.cpp and the tools built on it. It packs the tensors, the tokeniser and the metadata into a single file and is designed to be memory-mapped. When someone tells you to “grab the GGUF”, they are choosing a packaging that a particular runtime reads happily. The numbers inside are the same kind of numbers.

You can read a header yourself, which demystifies things quickly. Here is a short Python session against any .safetensors file you have downloaded:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
import json, struct

with open("model.safetensors", "rb") as f:
    header_len = struct.unpack("<Q", f.read(8))[0]   # first 8 bytes: header size
    header = json.loads(f.read(header_len))

for name, info in list(header.items())[:4]:
    if name == "__metadata__":
        continue
    print(name, info["dtype"], info["shape"])

Typical output for a transformer looks like a list of names ending in .weight, with shapes such as [4096, 4096]. A grid of sixteen million numbers, labelled with where it belongs. Multiply the shapes together across every tensor, add them up, and you have the parameter count. The next post, Parameters, Weights and Layers, does exactly that sum for a 7B model.

How the numbers got there: training

Before training, the numbers are random. A freshly built model with the same architecture as a famous one produces gibberish, because the shape it will eventually hold has not been carved yet.

Training is the carving. The recipe is simple to state. Show the model a piece of text with the next word hidden. Let it guess. Measure how wrong the guess was with a single number called the loss. Nudge every weight a tiny amount in whichever direction would have made the guess slightly less wrong. Repeat this across trillions of words, in batches, for weeks on thousands of accelerators.

The nudging step is called gradient descent, and the arithmetic that works out which way to nudge each weight is called backpropagation. You do not need either in detail yet. What matters for the picture is that no human ever decides what a given weight should be. Nobody sets the number in row 211, column 3,904 of a grid. The values emerge from the pressure of an enormous number of small corrections.

That is the sense in which the model “learned a shape”. The loss function acts like a sculptor’s feedback: warmer, colder, warmer. After enough rounds, the cloud of numbers settles into a configuration that predicts text well, and the structure that does the predicting is smeared across all the weights at once. Cut the file in half and the result is a broken model, because the shape lives in the relationships between values.

Scale matters to how good the shape gets. The Chinchilla paper from DeepMind found that for compute-optimal training, model size and the number of training tokens should be scaled equally, and that many large models of the time were significantly undertrained. A 70-billion-parameter model trained on about four times the data of its larger predecessor, Gopher, matched or beat it. The lesson for a file-of-numbers view: size is only one dial. The amount of data the carving drew on decides how well the numbers were set.

Training versus running

The sibling post Training vs inference goes into the economics. Here is the version you need to hold the picture.

Training changes the numbers. It needs the weights, plus extra memory for the gradients and optimiser state, plus a mountain of data, plus a cluster. It happens once per model version, at a lab.

Inference leaves the numbers alone. The runtime loads the file, takes your prompt as a list of token IDs, pushes them through the layers using the stored values, and out comes a probability for every possible next token. It picks one, appends it, and repeats. Every word of a chat reply is one more full trip through the layers.

This split explains a lot of everyday experience. When a model “doesn’t know” about last month, the file was frozen before last month. When two people run the same downloaded model with the same settings, they are running the same numbers, so differences in output come from the sampling randomness and the prompt. When a company ships a new model, they ship a new file.

It also explains why you can run these things at home. The expensive carving happened elsewhere. What lands on your disk is the finished sculpture, and using it needs memory and arithmetic, with no data centre involved. I’ve run Llama and Mistral on an Apple Silicon Mac and on an NVIDIA GPU box, and the experience in both places is the same: point a runtime at a file, wait for it to load, and the thing talks.

Size on disk follows from the count

Because the file is mostly raw numbers, the arithmetic of its size is straightforward. Multiply the parameter count by the bytes per number.

Models are commonly released in 16-bit formats (such as bfloat16), which use 2 bytes per weight. A 7-billion-parameter model is therefore about 14 gigabytes: 7 billion times 2 bytes. A 70-billion model is about 140 GB. A 405-billion model, such as the largest Llama 3 model, is about 810 GB before you do anything clever.

The clever thing is quantisation: storing each number with fewer bits. A 4-bit version uses roughly half a byte per weight, so that 7B model shrinks to somewhere near 4 GB, with a small loss in quality. Quantisation changes the precision of each number and leaves the shape alone, which is why a squeezed model still holds together. It gets its own post later in the series.

Mixture-of-experts models, such as Mixtral 8x7B, add a wrinkle. The paper says each token has access to 47 billion parameters but only uses 13 billion of them per step. The file still contains all 47 billion numbers, so the disk and memory bill follows the larger count, while the per-token arithmetic follows the smaller one.

What the file does not contain

A few things people assume live in the model do not.

No facts table. Ask a model for the capital of France and nothing is looked up. The weights have been shaped so that, given that prompt, the most probable continuation is “Paris”. The knowledge is real but diffuse, which is also why a model can state something false with total fluency: there is no row to check against.

No memory of your conversation. The file never changes during a chat. The runtime re-sends the whole conversation each turn as the input. The context window is the size of that input, and it has a real cost.

No internet. Unless a tool is wired up around it, the model sees only the text you give it. Retrieval systems, covered in RAG explained, get around this by pasting relevant documents into the input.

No guarantee of the licence you hope for. Files carry a licence. Mistral 7B was released under Apache 2.0, a permissive licence. Other families use custom terms with usage conditions. Read the card on the hub page before you build anything on top.

Why this view helps

Holding “a model is a file of numbers that learned a shape” makes a surprising number of claims easy to judge.

Someone says a model has “reasoning built in”. The file has the same kind of structure as any other, and what it does is a property of the learned shape. Someone says a model was “retrained overnight”. Either the numbers were all recalculated, which takes weeks on a cluster, or a small set of extra numbers was added or adjusted, which is fine-tuning and takes hours. LoRA fine-tuning works exactly that way: a small side file of adjustments that sits on top of the big one.

Someone says a model is “open”. Check what is in the folder. Open weights means you can download the numbers and run them. Open source in the full sense would also include the training data and code, and most releases leave that out.

A local setup is then easy to read as a stack of pieces: the file, a runtime that multiplies, a server that exposes it and a front end for humans. The anatomy of a local AI setup lays that out piece by piece.

Where the series goes next

The next two posts zoom into the file. Parameters, Weights and Layers counts what “7B” means and why the number on the box varies so wildly between models. Vectors and Embeddings explains the first thing the model does with your words: turn them into points in space. After that the series turns to attention, the architecture that made the current wave possible, and then to the individual models on the shelf.

The takeaway for now fits in one sentence. Every model you will meet in this series is the same kind of object: a recipe that a runtime can follow and a file of numbers, set by a long run of small corrections, that makes the recipe produce something useful.

Sources: Mistral 7B paper (Jiang et al., 2023) · safetensors documentation, Hugging Face · Training Compute-Optimal Large Language Models (Hoffmann et al., 2022) · The Llama 3 Herd of Models (Meta, 2024) · Mixtral of Experts (Jiang et al., 2024)

Smarc
Written by Smarc

Founder and editor of Aside House. A lifelong tinkerer who self-hosts far more than is sensible, hardens Linux boxes for fun, and prods the latest AI tools to see what they can really do. The how-to guides here are the notes Smarc wishes had existed the first time round.

Smarc is the editor of Aside House. The homelab, the hardware and the opinions are real; the guides are drafted with AI assistance. Infrastructure details are genericised on purpose.