1.6 Models, inputs, and outputs

Week 1
Pick a depth · ✨ generates it for this lecture

Models, inputs, and outputs

Strip away the mystique and a model is one thing: a function that turns an input into an output, where the rule connecting them was learned from data rather than written by a person.

The shape of the function

Every AI application can be described by naming its input and its output. A spam filter takes an email (input) and returns spam or not-spam (output). A translation model takes English text in and returns French text out. A medical model takes an X-ray and returns a probability of disease. Get into the habit of asking, for any AI product, "what goes in, and what comes out?" It demystifies the whole thing and is the first question an engineer asks too.

Training time vs. inference time

There are two distinct phases in a model's life, and confusing them causes endless misunderstanding. Training is the expensive, one-time (or occasional) process of learning the parameters from data — it can take weeks and enormous compute. Inference is using the finished model to make a prediction on a new input — it is fast and cheap by comparison. When you ask a chatbot a question, you are doing inference on a model that was trained months earlier. The model is not learning from your question; its parameters are frozen.

Parameters, again

The learned numbers inside the function are its parameters. Their count is a rough proxy for a model's capacity — you will hear "a 7-billion-parameter model." More parameters mean more ability to capture complex patterns, but also more data and compute needed to train, and more risk of overfitting if data is scarce.

A worked example

Take a sentiment classifier. Input: the text of a product review. Output: a label, "positive" or "negative." During training it saw thousands of reviews with human-applied labels and adjusted its parameters until its guesses matched. At inference, you hand it a brand-new review and it outputs a label in milliseconds, using the frozen parameters it learned earlier. Input, function, output — that is a model.

Tip: highlight any passage above to ask the tutor about it, or to generate practice problems specifically on what you selected.
Ask the tutor for an explanation, a worked example, or a hint. Highlight a passage on the left to ground the question in that text.