In machine learning, a model is the output of training: a function that takes an input and returns a prediction.
What's Inside
A model has two parts:
- An architecture: the structure of the computation — for example a decision tree, a linear equation, or a neural network with a certain number of layers.
- Parameters (weights): the numbers learned during training. A linear model might have a handful; a large language model has billions.
Training Versus Inference
Training is the expensive process of finding good parameter values from data. Inference is using the finished model to make predictions on new inputs. Training may take hours to months; inference is usually fast.
How Models Are Stored
A trained model is saved as a file, or set of files, containing the parameters and often the architecture. Common formats include safetensors and PyTorch checkpoints for neural networks, ONNX for running models across frameworks, and pickle or joblib files for scikit-learn models. Pickle-based files can execute code when loaded, so only open ones you trust.
Models Are Not Magic
A model only captures patterns present in its training data. It has no knowledge beyond that, can be confidently wrong, and can degrade when the world changes. Treat a model as a component that needs testing, documentation and monitoring like any other.
Model Cards
Good models come with a model card describing what they are for, what data they were trained on, how they were evaluated and their known limitations. Read it before you use a model.