Back to all posts

Everything You Need to Know About AI

This post is for people who know nothing about AI. If you already know what AI is and most of the terms below, you can skip it. It's here because I plan to write future posts about AI that require knowing all or most of this, and I'd rather link to this post than explain the basics each time.

What is AI?

AI stands for artificial intelligence, and it is an umbrella term used to describe algorithms that seem "intelligent." Its meaning has changed over time as technologies improved, though, so it really refers to novel technologies. For instance, autocomplete (usually based on Markov chains) used to be considered artificial intelligence, but the meaning has shifted towards mostly neural networks (from now on I will refer to them as NNs). That includes image and video generation models using diffusion; complicated hybrid models and technologies like Waymo self-driving cars; and language models, specifically large language models (LLMs), which are usually GPTs, a specific LLM architecture.

Terms Worth Knowing

  1. NNs (Neural Networks): A computer system modeled after the human brain that learns to recognize patterns and make decisions by processing examples instead of following a strict set of rules.

    A simple neural network. Data goes in on the left and the answer comes out on the right.

  2. Model: A computer program or mathematical system that has been trained on data to recognize patterns, make predictions, or generate new content. Types of models include vision models, language models, vision language models, decision models, etc.

  3. Training: The process of teaching an AI model to recognize patterns and improve performance by adjusting its internal parameters using data.

  4. Loss (Loss Function): A number that measures how wrong a model's output is compared to the right answer. Training is basically trying to make this number as small as possible. A loss function is how this is calculated. A common one is mean squared error, loss=(prediction−answer)2\text{loss} = (\text{prediction} - \text{answer})^2, and LLMs use cross-entropy loss, loss=−log⁡p(right token)\text{loss} = -\log p(\text{right token}).

  5. Pretraining: The initial training phase in which a model learns general patterns and capabilities from large datasets, typically using self-supervised learning.

  6. Self-Supervised Learning: A way of training where the data provides its own answers, so no human has to label anything. For example, a model can hide the next word of a sentence, try to guess it, and then check against the real word. This is how pretraining usually works.

  7. Post-Training: Additional training performed after pretraining to improve a model's usefulness, reasoning abilities, instruction-following, and alignment with human preferences.

    Pretraining makes the base model, post-training makes it useful, and inference is actually using it.

  8. Fine-Tuning: Further training an existing model on specialized data to improve its performance on particular tasks or behaviors.

  9. Distillation: Training a smaller model (the student) to copy the outputs of a bigger model (the teacher). The student ends up much cheaper to run while keeping a lot of what the teacher can do (paper).

    The small model gets trained to give the same answers as the big one.

  10. Inference: Using a trained model to generate predictions, answers, or outputs from new inputs.

  11. Tokens: Small units of data processed by AI models. In language models, tokens can represent words, parts of words, or punctuation.

    How a sentence might get split into tokens. Each token gets a number. These numbers are made up, every model has its own.

  12. Embeddings (Vector Spaces): A way of turning things like tokens, words, or images into lists of numbers (vectors) so a model can work with them. Each vector is a point in a space with hundreds or thousands of dimensions, and similar things end up close to each other, so "dog" ends up near "wolf" and far from "banana." Directions in the space can mean things too. The classic example from word2vec is that going from "man" to "woman" is about the same move as going from "king" to "queen." This idea is useful even outside of AI. You can think of anything as a point in a giant space of all possible things, with one dimension for every property it could have, which is sometimes called thingspace. A category like "bird" is then just a cluster of points in that space.

    Similar words end up close together. Real embeddings have way more than 2 dimensions though.

  13. Parameters: Numerical values, primarily weights and biases, learned during training that determine how a neural network processes information.

  14. Quantization: Using fewer bits to represent each parameter. This makes models smaller and faster, but loses quality.

    One parameter stored with fewer and fewer bits. Each dot is a bit, filled is 1 and empty is 0. Sizes are for a 7 billion parameter model.

  15. Attention: A mechanism that allows a neural network to weigh the relevance of different parts of its input when generating outputs. This is the main idea behind transformers.

    Thicker line means more attention. "It" pays the most attention to "animal," since that's what "it" is (made up numbers).

  16. Transformer: A neural network architecture built around attention, introduced in the 2017 paper Attention Is All You Need. Almost all modern LLMs are transformers.

  17. Backpropagation: An algorithm that calculates how each parameter contributes to a model's error, enabling the model to learn through adjustments. It was popularized for NNs by this 1986 paper.

    Make a guess, see how wrong it was, then go backwards and adjust the weights.

  18. Gradient Descent: An optimization algorithm that updates a model's parameters in the direction that reduces its loss (error). Each step is θ←θ−α∇L(θ)\theta \leftarrow \theta - \alpha \nabla L(\theta), where θ\theta is the parameters, α\alpha is the learning rate (how big each step is), and ∇L(θ)\nabla L(\theta) is the gradient (which way is uphill, so you go the other way). Most models today use a version of it called Adam, which keeps a running average of the past steps so it moves more smoothly and takes the right size of step for each parameter.

    gt=∇L(θt−1)the gradientmt=β1mt−1+(1−β1) gtrunning average of the directionvt=β2vt−1+(1−β2) gt2running average of the sizem^t=mt1−β1t,v^t=vt1−β2tfix the averages early onθt=θt−1−α m^tv^t+ϵtake the step\begin{aligned} g_t &= \nabla L(\theta_{t-1}) && \text{the gradient} \\ m_t &= \beta_1 m_{t-1} + (1 - \beta_1)\, g_t && \text{running average of the direction} \\ v_t &= \beta_2 v_{t-1} + (1 - \beta_2)\, g_t^2 && \text{running average of the size} \\ \hat{m}_t &= \frac{m_t}{1 - \beta_1^t}, \quad \hat{v}_t = \frac{v_t}{1 - \beta_2^t} && \text{fix the averages early on} \\ \theta_t &= \theta_{t-1} - \alpha \, \frac{\hat{m}_t}{\sqrt{\hat{v}_t} + \epsilon} && \text{take the step} \end{aligned}

    Here tt is the step number, β1\beta_1 and β2\beta_2 control how long the running averages remember (usually 0.9 and 0.999), and ϵ\epsilon is a tiny number that stops division by zero.

    Each step goes downhill until it hits the lowest loss.

  19. Overfitting: When a model memorizes its training data instead of learning general patterns, so it does great on the data it trained on and worse on new data. It's like a student who memorizes the answers to the practice test instead of learning the material.

    The line gets the general trend. The 7th-degree polynomial hits every training point but misses the new data.

    Side note: Double Descent. The classic idea in machine learning was that once a model is too big for its training data, it overfits and does worse on new data. Double descent is the observation that if you keep making the model bigger past that point, the error on new data goes back down, often lower than before. It has been seen in many kinds of models, including NNs (paper, paper for deep learning), and it can also show up when training for longer. It helps explain why very large models can still do well on data they haven't seen.

    Error goes down, spikes when the model is just big enough to memorize the training data, then goes back down.

  20. Scaling Laws: The observation that bigger means better in AI.

  21. Large Language Model (LLM): An AI model trained on large amounts of data to understand and generate human language.

  22. Next-Token Prediction: The main thing LLMs actually do. Given some text, the model guesses what token comes next, adds it to the text, and repeats. Everything an LLM writes, from a poem to code, comes out one token at a time like this.

    Guess the next token, add it to the text, repeat.

  23. Temperature (Sampling): LLMs don't output a next token, they output next-token probabilities. Temperature is how often they pick the top one compared to the other ones, in other words, the randomness.

    The same guesses at different temperatures. Higher temperature means more random.

  24. GPT (Generative Pre-trained Transformer): A type of LLM that is a transformer pretrained on huge amounts of text to predict the next token. OpenAI introduced the first one in 2018. ChatGPT is the most well known, but most chatbots today, like Claude and Gemini, are built the same basic way.

    A simplified GPT. Words become token IDs, then embeddings, go through the transformer block a bunch of times, and come out as next-token probabilities.

  25. Multimodal: Models that can handle more than one type of data, like text, images, audio, or video. Most big chatbots today are multimodal, so you can send them a picture and ask about it.

  26. Diffusion: A way of generating images (and video) by starting with pure random noise and removing a little bit of it at a time until a picture appears. The model is trained to guess what noise to remove at each step (paper).

    Start with noise and remove a little each step until there's an image.

  27. Reasoning Models: LLMs that have the ability to generate "thinking tokens." Think of this as giving the LLM a scratchpad before it answers to write its ideas down and draft answers.

    It thinks it through first, then answers.

  28. MoE (Mixture of Experts): A type of LLM where, rather than being dense, the model is broken up into smaller pieces called experts, so only a few of them need to be run for each token. This makes the model faster and more efficient. The modern version comes from this 2017 paper.

    The router picks 2 of the 8 experts for each token.

  29. Open Weights vs. Closed Models: Open-weights models are ones where the parameters are released publicly, so anyone can download them and run them on their own computer, like Llama, DeepSeek, or Qwen. Closed models, like the ones behind Claude, ChatGPT, and Gemini, can only be used through the company's app or API.

  30. AI Agents: Models that are given tools to interact with various systems. For example, an LLM with access to writing files to a disk and running code would be a coding agent.

    The model picks an action, a tool does it, and the result goes back to the model. Repeat until it's done.

  31. Tool Use: The ability of AI to interact with external systems, such as search engines, calculators, databases, or software, to perform tasks.

  32. RAG (Retrieval-Augmented Generation): Before answering, the model looks up relevant information (from search results, documents, or a database) and gets it added to its prompt, so it can answer with information it wasn't trained on (paper).

  33. Autonomy: The degree to which an AI system can make decisions and execute tasks independently without continuous human direction.

  34. Context Window: The maximum amount of information, measured in tokens, that an AI model can process at once.

    The model can only see what's inside the window.

  35. Context Compaction: When the context window starts to fill up, older parts of the conversation get summarized so the model can keep going.

    Once the window fills up, the old messages get turned into a short summary.

  36. Prompt: The instructions, questions, or information provided to an AI model to guide its response. Models are given the current thing the user asks, along with previous messages and a system prompt that acts as instructions for how to act.

  37. Jailbreak / Prompt Injection: A jailbreak is tricking a model into doing something it's supposed to refuse. Prompt injection is hiding instructions in something the model reads, like a web page or an email, so it follows them instead of the user (paper).

  38. Hallucination: When an AI model generates information that is false, fabricated, or unsupported while presenting it as factual. This is a big problem in agentic research and chatbots.

  39. Reinforcement Learning (RL): A machine learning approach in which an AI system learns to make better decisions by optimizing its behavior based on rewards or feedback.

    • RLHF (Reinforcement Learning from Human Feedback): A training method that uses human preferences or evaluations to guide a model toward more helpful, accurate, or desirable responses (paper).
    • RLVR (Reinforcement Learning with Verifiable Rewards): A training method that rewards models based on objectively checkable outcomes, such as correct mathematical answers or passing code tests. Particularly useful for improving reasoning capabilities. The name comes from the Tülu 3 paper.
    • RLAIF (Reinforcement Learning from AI Feedback): A training method that uses evaluations or preferences generated by another AI model rather than relying entirely on human feedback (paper).
  40. Reward Hacking: When a model finds a loophole that gets it the reward without actually doing what was intended. For example, a coding model that gets rewarded for passing tests might edit the tests so they pass instead of fixing the code (paper). The classic example is OpenAI's boat racing experiment, where the AI was rewarded for points instead of finishing the race. It found a spot where it could drive in circles hitting the same targets over and over, crashing and catching on fire, and never finished the race, but still scored higher than human players.

    https://www.youtube.com/watch?v=tlOIHko8ySg

  41. Supervised Fine-Tuning (SFT): A post-training method in which a model learns from examples of desired inputs and outputs, such as questions paired with high-quality answers.

  42. Interpretability: The study of understanding and explaining how AI models make decisions, produce outputs, and represent information internally.

  43. Mechanistic Interpretability: A branch of interpretability that attempts to reverse-engineer neural networks by identifying the internal features, computations, and circuits responsible for their behavior.

  44. Alignment: The process of ensuring AI systems behave in ways consistent with intended human goals, values, instructions, and safety requirements.

  45. AI Safety: The research and engineering field focused on preventing AI systems from causing unintended harm, including through misuse, failures, or loss of control.

  46. AGI (Artificial General Intelligence): A proposed form of AI capable of performing a broad range of intellectual tasks at or above average human-level ability. Its definition is contested, particularly regarding what qualifies as human-level intelligence and generality.

  47. ASI (Artificial Superintelligence): A hypothetical form of AI that significantly exceeds human intellectual capabilities across virtually all cognitive domains. Its definition is contested, particularly regarding how intelligence beyond human capabilities should be measured.

  48. P(doom) (Probability of Doom): A subjective estimate of the probability that advanced AI causes an existential catastrophe, such as human extinction or permanent human disempowerment. Estimates vary widely, and there is no universally accepted definition of what counts as "doom" or the relevant timeframe.

  49. Existential Risk (X-Risk): The risk of an event that could cause human extinction or permanently destroy humanity's potential for future development.

  50. Recursive Self-Improvement (RSI): A hypothetical process in which an AI system repeatedly improves its own capabilities, potentially enabling increasingly powerful subsequent improvements.

  51. AI Takeoff: A hypothetical period during which AI capabilities advance rapidly, potentially transitioning from human-level intelligence to superintelligence. The possible speed and likelihood of such a transition are debated.