---
title: Where does AI capability come from? Tokens, training and model weights explained
description: Learn what weights, parameters, tokenizers, pretraining, fine-tuning and LoRA mean, with practical examples for builders who use models.
date: 2026-11-22
url: https://caminhosolo.com.br/en/2026/11/how-ai-models-train-tokens-weights/
tags: [ai-models, weights, training, fine-tuning, tokens]
---


> **Reference guide — created November 22, 2026.** The core ideas remain useful, but architectures, libraries and prices change. Check current instructions before reproducing an experiment.

> **TL;DR:** A model's architecture defines the mathematical structure. Its **weights** are learned numerical values; the **tokenizer** translates inputs into manageable units. A pretrained model has already acquired patterns from data. Fine-tuning adapts that starting point. Running inference is not the same as training.

## 01 — The discovery: what is inside a model download?

A model repository contains several gigabytes of data. Is it a library of ready-made answers? For a typical language model, no. It contains a mathematical architecture and millions or billions of **parameters**, with learned numbers forming its weights.

Think of a huge mixing desk with countless controls. Their settings affect how input tokens are transformed into probabilities for output tokens. The analogy is limited: there is no single dial for accounting, another for programming and another for customer support. Learned representations are spread across many numerical relationships.

A **tokenizer** converts text into units and numerical IDs. One word can become multiple tokens depending on vocabulary. A language model predicts sequences of tokens and decoding turns them back into text. That is why a context limit in tokens cannot be translated into a fixed number of words.

### The training cycle

A simplified language-model workflow includes:

1. **Data preparation:** select, clean, deduplicate and organise examples, checking privacy, provenance and usage rights.
2. **Tokenization:** represent those examples in the format required by the model.
3. **Prediction and loss:** calculate how predictions differ from target outputs.
4. **Parameter updates:** use gradients, backpropagation and optimizers to change the learned weights.
5. **Evaluation:** use held-out examples to assess behaviour and detect weaknesses.

Real training may require distributed systems and multiple stages. Following initial pretraining, some models also go through supervised instruction tuning, preference training or other alignment methods.

[Hugging Face's training documentation](https://huggingface.co/docs/transformers/training) explains **fine-tuning** as continuing training from already learned weights rather than starting from an untrained initialization.

### Prompt, retrieval, fine-tuning and LoRA

- **Prompt and context:** guide the response at inference time without permanently changing weights.
- **RAG:** retrieves relevant external information for the model to use, also without retraining it.
- **Fine-tuning:** further trains a model for a domain, task or desired behaviour.
- **LoRA/PEFT:** updates smaller adapter components instead of all original weights, reducing trainable parameter requirements. [PEFT documentation](https://huggingface.co/docs/transformers/peft).

For a solo business, this is consequential. If a support assistant lacks current prices, **retrieving the latest catalogue** may be better than fine-tuning weights to remember information that soon becomes outdated. Training is not a universal fix for missing context.

### Why weight files are large

A hypothetical 7-billion-parameter model stored at 16 bits per parameter requires roughly **14 GB** just for its numerical weights (7 billion × 2 bytes). Quantization can store many weights using fewer bits, but real memory use also includes runtime buffers, metadata and an attention cache. **Smaller download size does not guarantee equivalent quality or that the model fits in the machine's RAM.**

Training demands more resources than inference because gradients, optimizer state, batches and activations require additional memory.

## 02 — The Solo verdict

If your goal is a document assistant or business workflow, **evaluate a pretrained model first**. Add trustworthy information, a clear task and quality checks. Training from scratch belongs to projects whose learning objective and budget justify the infrastructure.

Remember the distinction: the model learned numerical patterns; weights store parameters; tokens form its input and output representation; reliable applications also need context and validation.

## 03 — The workbench: inspect before training

1. Visit the [model catalogue](https://huggingface.co/models) and select a language model with a documented model card and licence.
2. Under **Files and versions**, look for `config.json`, tokenizer assets and `.safetensors` weights; exact structures vary.
3. Read the **Model card** for the task, intended uses, limitations and published training notes.
4. Record its parameter count and estimate theoretical weight storage: parameter count × bytes per parameter. Do not mistake this for measured GPU memory requirements.
5. Pick a business task and decide whether it needs different learned behaviour or simply access to current information.

**Explore:** [training](https://huggingface.co/docs/transformers/training), [PEFT](https://huggingface.co/docs/transformers/peft) and [model files](https://huggingface.co/docs/hub/transformers). This exercise involves inspection, not a costly training run.

