LambdaA tiny function with no name, written in one line.
`lambda o: o["store"]` is the same as a function that returns an order's store. Lambdas are most often passed to `sorted(..., key=...)` to say what to sort by. Use a named function when the logic deserves a name.
Like a sticky note with a one-line instruction, instead of a full recipe card.
Learn it in: Pythonic data handling: comprehensions, JSON and None → LangChainA popular open-source Python library of building blocks for LLM apps, including loaders, splitters, retrievers and many integrations.
LangChain offers standard interfaces and hundreds of integrations with models, databases and tools. Its sister project LangGraph is used for agents and multi-step workflows. It moves quickly and has reorganised its packages more than once, so pin versions and prefer the official docs over old tutorials.
Like a huge supermarket with ingredients for any cuisine in standard packaging.
Learn it in: Loaders, chunking and retrievers with LangChain → LangflowAn open-source visual tool for building LLM apps by dragging components onto a canvas and wiring them together.
Langflow provides components for chat input and output, prompts, models, retrieval, memory and agents with tools. You can test a flow in its Playground, call it through an HTTP API and export it as JSON. It is excellent for prototypes, demos and tools owned by non-engineers, and weaker for complex logic, testing and code review.
Like building with Lego bricks that each do one job, instead of machining every part yourself.
Learn it in: LangFlow for visual workflows → LangfuseAn open-source tool for recording and reading the traces of LLM apps.
Langfuse is an LLM engineering platform whose core is MIT-licensed open source, with some enterprise features under a separate licence. You can self-host it with Docker or use Langfuse Cloud. It covers tracing, sessions, cost tracking, prompt management, datasets, scores and evaluations, and its Python SDK is built on OpenTelemetry.
Like a CCTV kit, cameras and control room together, that you can install in your own back office.
Learn it in: Langfuse, LangSmith, Braintrust and OpenLLMetry → LangGraphA library from the LangChain team for building agents and multi-step workflows as graphs of steps with saved state.
LangGraph models an application as nodes (steps) and edges (what happens next), with state that can be checkpointed and resumed. It suits agents with tools, branching and human approval steps. It is covered in depth in Module 14.
Like a flowchart that actually runs, remembering where it was if interrupted.
Learn it in: LlamaIndex vs LangChain → LangGraph StudioA visual debugger that draws your graph and lets you run it, watch its state and rewind it by clicking.
You start it locally with the LangGraph command-line tool (uv run langgraph dev) after describing your graph in a langgraph.json file. It shows each node as it runs, the state at every step and the threads you have created, and lets you fork from any checkpoint. It is a development tool, not something you ship to users.
Like a glass-walled kitchen where you can pause service and inspect every ticket on the rail.
Learn it in: Debugging stateful workflows → LangSmithA hosted service from the LangChain team that records and displays traces of LLM app runs.
Setting LANGSMITH_TRACING=true and LANGSMITH_API_KEY in the environment makes LangChain and LangGraph code send traces to LangSmith, where you can click into each step and see the exact prompt and reply. It also supports datasets and evaluations. Module 22 compares it with open alternatives.
Like a flight recorder for your app that you can replay in a web browser.
Learn it in: Debugging stateful workflows → Large language modelalso LLMA very large model trained on huge amounts of text to predict the next piece of text.
Getting extremely good at predicting the next token turns out to let a model answer questions, summarise, translate, reason through problems and write code. Claude, GPT and Gemini are LLMs. They write one token at a time, do not learn from your chats, and can be confidently wrong.
Like an autocomplete that has read a library the size of a city.
Learn it in: The 30 words you will hear everywhere → LatencyThe waiting time between sending a request and getting a response.
For AI apps people usually track two numbers: time to the first token and time to the complete answer. Latency depends on model size, prompt length, answer length and the number of round trips, such as tool calls. Lower latency often trades off against cost or quality.
Like the time between ordering and the first plate landing on your table.
Learn it in: The 30 words you will hear everywhere → Latency budgetThe total waiting time you allow for a response, divided among every step that has to happen.
For a voice agent the key number is voice-to-voice latency, from the caller stopping to hearing the reply, ideally about one second. That budget is shared by turn detection, transcription, the model's first token, the first sentence, speech synthesis, network and playback. Logging each stage shows where to spend effort.
Like planning a 30-minute delivery promise: so many minutes to bake, to box and to ride, and they must add up.
Learn it in: Speech-to-speech voice agents → Latent diffusionRunning the diffusion process on a compressed version of the image instead of on raw pixels.
A VAE encoder compresses each image into a small latent, for example 64 x 64 x 4 numbers for a 512 x 512 image, and the decoder turns the final latent back into pixels. It makes diffusion far cheaper and is the basis of Stable Diffusion.
Like sketching a design at thumbnail size before painting it full size.
Learn it in: Diffusion, Vision Transformers and CLIP → Latent spacealso latentsA compressed numerical representation of data where a model does its work, smaller than the raw pixels or sound.
Many image generators use an autoencoder (VAE) to squeeze a 512 by 512 image into a 64 by 64 by 4 grid of numbers, about 48 times fewer values, and run diffusion there before decoding back to pixels. Working in latent space makes generation far cheaper. The idea of a compressed space also underlies embeddings.
Like working from a small, detailed sketch and only painting the full-size canvas at the end.
Learn it in: Visual Q&A, diffusion, inpainting and video → Layer normalisationalso LayerNorm, Layer normA step that rescales each token's numbers to a steady average and spread.
Layer norm subtracts the average of a vector's numbers, divides by their spread, then applies a learned scale and shift. It stops values drifting too large or too small as they pass through many layers. Most modern models apply it before each sub-layer ("pre-norm").
Like a thermostat that keeps every oven at a steady temperature no matter how busy the kitchen gets.
Learn it in: Masked attention and the full transformer → LCELalso LangChain Expression Language, RunnableLangChain's way of joining steps with the | character so the output of one feeds the next.
Each piece (a prompt template, a model, an output parser) is a Runnable with an invoke() method. Writing prompt | llm | StrOutputParser() creates a chain that fills the prompt, calls the model and extracts the text. The chain is itself a Runnable, so it can be invoked, streamed or used inside a graph node.
Like a conveyor belt where each machine takes what the previous one produced and passes its result along.
Learn it in: Designing complex agent graphs → Leaky abstractionA simplifying layer whose hidden details still affect you, usually at the worst moment.
Frameworks hide details so you can think at a higher level, but when something breaks you often need to understand those details anyway, plus the framework's own layers. A page-numbering convention inside a loader is a typical example. Knowing where the leaks are is part of choosing a framework.
Like a car you never needed to understand until it broke down on the highway.
Learn it in: LlamaIndex vs LangChain → Learning rateThe number that sets how big a step training takes on each update.
Too small and training crawls; too large and it overshoots, bounces around or diverges to nan. It is usually the single most important setting to tune, often by trying values a factor of 3 to 10 apart. Schedulers change it during training, typically large early and small late.
Like your stride length walking downhill: tiny steps take forever, giant leaps overshoot the valley.
Learn it in: Gradient descent → Least privilegeGiving each part of a system only the access it needs to do its job.
For AI tools this means narrow, specific tools rather than general ones like "fetch any URL", read access before write access, and no secrets in what the model sees. It limits the damage a confused model or a malicious message can do.
Like giving the delivery rider the key to the dispatch room, not to the safe.
Learn it in: Calling external APIs from the model loop → Lethal trifectaThe dangerous combination of private data, untrusted content and a way to send data out, all available to one agent.
With all three, a hidden instruction in untrusted content can make the agent read private data and leak it. The term was coined by Simon Willison. The defence is to remove at least one leg, for example by making a web-reading agent read-only with no way to send messages.
Like leaving a safe open, a stranger in the room and the back door unlocked: any two are risky, all three are a robbery.
Learn it in: Web search and data access tools → Likert scaleA rating scale such as "rate from 1 to 5", common in surveys.
Likert scales feel richer than yes or no, but for evaluating AI output they cause problems: raters disagree about the middle values, averages hide dangerous cases, and a score does not say what to fix. Most practitioners now prefer binary evals per failure mode.
Like rating a kitchen "3.7 for cleanliness": it sounds precise, but nobody knows what to scrub tomorrow.
Learn it in: Binary pass/fail evaluations → Linear layeralso dense layer, fully connected layer, nn.LinearA layer that multiplies its inputs by a weight matrix and adds a bias.
A linear layer computes y = Wx + b for a whole batch at once. nn.Linear(in, out) holds out × in weights plus out biases. Stacking linear layers only becomes more powerful than one layer when activation functions sit between them.
Like a panel of tasters, each with their own opinion of how much every feature matters.
Learn it in: PyTorch tensors, layers and parameters → ListAn ordered collection of values that you can add to, remove from and change.
Written with square brackets, like `["croissant", "plum cake"]`. Positions start at 0, and lists can hold duplicates. A chat with an LLM is sent as a list of message dictionaries.
Like the ticket rail in a kitchen: orders in sequence, and you can add or pull tickets.
Learn it in: Python basics: variables, collections, loops and functions → LiteLLMAn open-source library and proxy that lets you call many model providers through one OpenAI-style interface.
LiteLLM translates a single request format into the APIs of more than a hundred providers, selected by model strings like "anthropic/..." or "openai/...". Run as a proxy server, it adds fallbacks, retries, per-key budgets and spend tracking through configuration. It is a common off-the-shelf alternative to writing your own gateway.
Like a universal travel adapter that fits your plug into sockets in every country.
Learn it in: A multi-provider LLM gateway with fallback → Little's lawA simple rule: the average number of jobs in progress equals the arrival rate times the time each job takes.
If 3.3 questions arrive per second and each takes 3.1 seconds, about 10 are being worked on at any moment, so you need at least that many workers to keep up. Below that number the queue grows for as long as the burst lasts; above it, extra workers sit idle. Add headroom because arrivals are lumpy.
Like working out how many tables a café needs from how many guests arrive per hour and how long each stays.
Learn it in: Sync vs async RAG architectures → Llama GuardA free safety classifier model from Meta that labels messages or replies as safe or unsafe.
Llama Guard reads a user message, or a user message plus the assistant's reply, and outputs "safe" or "unsafe" with hazard category codes such as S10. It is designed for content safety (violence, hate, self-harm and similar) and can run locally, for example through Ollama. It is not built to detect prompt injection.
Like a smoke detector: excellent for smoke, no use against a polite burglar.
Learn it in: Schema validation, HITL and guardrail models → LlamaIndexAn open-source Python framework focused on connecting LLMs to your own data for retrieval and question answering.
LlamaIndex gives standard names and defaults to each RAG stage: readers, documents, nodes, indexes, retrievers and query engines. It is strong at ingesting many formats and at retrieval add-ons. Its defaults, including which model provider to use, should be set explicitly for production.
Like a meal kit for one cuisine: pre-measured, quick and very good at its speciality.
Learn it in: LlamaIndex fundamentals → LLM gatewayalso model gateway, AI gateway, LLM routerOne layer that sits between your app and several model providers and hides their differences.
An LLM gateway exposes one interface, translates it into each provider's request and response format through adapters, and chooses which provider to call. It is the natural home for fallback chains, circuit breakers, retries, budgets and logging of which provider answered. It can be a small module in your code, an open-source proxy such as LiteLLM, or a hosted service.
Like a purchasing clerk who knows every flour mill's order form, so store managers only say what they need.
Learn it in: A multi-provider LLM gateway with fallback → LLM-as-judgealso LLM judgeUsing a language model to grade another model's outputs.
Judges work best on narrow questions such as "is this sentence supported by this paragraph?" and poorly on vague ones such as "rate this answer out of 10". They can be wrong and can favour their own style, so spot-check their verdicts and prefer a judge from a different model family.
Like asking a colleague to proofread: useful, but you still check their corrections.
Learn it in: RAGAS metrics and the "I don't know" rate → LLMOpsMLOps for apps built on large language models, focused on prompts, retrieval, tools and model choice.
Most teams rent an LLM through an API rather than training it, so LLMOps manages what surrounds the model: versioned prompts, retrieved knowledge, tools, evals, staged rollouts, cost and feedback. It runs in three phases, ideation, development and operations, and loops back as new failures are found. The vendor’s model can also change, so pinning versions matters.
Like managing a brilliant contract chef: you cannot change their training, but you control the brief, the ingredients, the tools and the tasting before plates go out.
Learn it in: The LLMOps lifecycle → Lock filealso uv.lockA file that records the exact version of every package your project uses, so installs are identical everywhere.
Without a lock file, a reinstall can quietly pull newer versions that rename or remove things you depend on. uv writes uv.lock for you; commit it, and upgrade deliberately on a branch with your tests as a safety net.
Like a recipe that says "Amul butter, 100 g" rather than "some butter".
Learn it in: LlamaIndex vs LangChain → LoggingRecording what a program does, with timestamps and severity levels, so you can investigate later.
Python's `logging` module has levels from `DEBUG` to `CRITICAL`, and you choose which levels to keep. `logger.exception(...)` records the full traceback. Never log secrets or personal data.
Like the kitchen logbook: every entry has a time, who wrote it and how serious it was.
Learn it in: Errors, logging and debugging → Logistic regressionA simple, classic machine learning method that learns boundaries between categories and gives a probability for each.
Logistic regression learns a weight for each input number per label and turns the weighted sum into a probability. Trained on embeddings, it is fast, needs only hundreds of examples and is often the most accurate simple classifier. Its probabilities let you set thresholds, such as sending unsure cases to a person.
Like an experienced sorter who has learned where the invisible fences between departments run, rather than comparing every letter to old ones.
Learn it in: Classification with embeddings → LogitsThe raw scores a model gives every possible next token, before they are turned into probabilities.
Higher scores mean more likely tokens. A formula called softmax turns logits into probabilities that add up to 100%. Temperature works by dividing the logits before softmax, which sharpens or flattens the resulting probabilities.
Like judges' raw marks before they are converted into each contestant's share of the vote.
Learn it in: Sampling, temperature and top-p → Long-horizon taskA task that takes many steps and a long time, where early decisions affect later ones.
Writing a researched report, refactoring a codebase or planning a product launch are long-horizon tasks. Agents struggle with them because context fills up, goals drift and failures midway lose work. Plans, files, checkpoints, budgets and human check-ins make them manageable.
Like baking a wedding cake over two days rather than toasting a slice of bread.
Learn it in: Deep agents and deep research agents → Long-term memoryInformation an agent keeps outside the model, between conversations, and brings back when it is relevant.
Because a model forgets everything between calls, long-term memory lives in an external store such as a database or vector database. It works as a loop: decide what to write, retrieve what is relevant to a new message, and inject it into the prompt. Factual, episodic, semantic and procedural memories are all kinds of long-term memory.
Like a filing cabinet behind the counter: the assistant pulls out the right card when a regular customer walks in.
Learn it in: Short-term, long-term, episodic and semantic memory → Look-ahead biasAccidentally using information in a test that would not have been available at the time of the decision.
Look-ahead bias makes backtests look far better than reality. It creeps in through signals computed over the full dataset, news timestamps in the wrong time zone, revised data, and, for LLMs, models that have already read about the period being tested. Defences include cutting data at the as-of date in code and tests that tamper with future data.
Like "predicting" yesterday’s cricket score after reading this morning’s newspaper.
Learn it in: Bonus project: AI trading research agent → LoRAalso Low-rank adaptationA fine-tuning method that freezes the model and trains small correction matrices added to its layers.
Each chosen weight matrix gets a correction written as the product of two thin matrices, B and A, scaled by alpha over r. Only these are trained, usually under 1% of the parameters. After training the correction can be merged into the weights with no slowdown, or kept as a small swappable file.
Like clipping sticky notes of adjustments onto every recipe instead of rewriting the recipe book.
Learn it in: LoRA, QLoRA and parameter-efficient fine-tuning → Lossalso loss function, errorA single number that measures how wrong a model's predictions are; training tries to make it small.
A common loss is the mean squared error: square each prediction's miss, then average them. In the delivery example the loss started at 733.6 with both knobs at zero and fell to almost 0 after training. Choosing what the loss measures decides what the model gets good at.
Like a score from a tasting panel, where lower means closer to the recipe.
Learn it in: What is a model? Training vs inference in plain words → Loss functionalso loss, cost function, objectiveA formula that turns “how wrong is the model?” into a single number to minimise.
Training is the search for parameters that make the loss small. Mean squared error is common for predicting quantities; cross-entropy is common for classification, and punishes confident wrong answers hard. Choosing the loss is choosing what the model cares about.
Like a scorecard that gives one total penalty for every mistake made on a tray of pastries.
Learn it in: Gradient descent → Loss weightingChoosing how much each head’s loss counts in a multi-output model’s total loss.
The total loss is a weighted sum of each head’s loss. If one loss is on a much larger scale, its gradients dominate and other heads stop learning. Put losses on comparable scales first (for example by standardising regression targets), then tune the weights on each head’s validation metric; automatic schemes such as uncertainty weighting exist for many heads.
Like converting every judge’s scores to the same scale, then deciding how much each judge’s opinion matters.
Learn it in: Multi-input and multi-output models → Lost in the middleThe tendency of models to use information at the start and end of a long input better than information buried in the middle.
Researchers found that answer quality can drop when the relevant fact sits in the middle of a very long context. Newer models handle long inputs much better, but the lesson remains: a short, relevant context usually beats a huge one.
Like remembering the first and last pages of a long report better than page 97.
Learn it in: Context windows and why LLMs forget → Low rankDescribing a big table of numbers using only a few underlying patterns.
A matrix of rank r can be written as the product of a tall matrix with r columns and a wide matrix with r rows. LoRA bets that the change needed to adapt a model has low rank, so a few patterns, mixed in different amounts, describe it well.
Like adjusting hundreds of recipes with the same three ideas: less sugar, a pinch more salt, extra vanilla.
Learn it in: LoRA, QLoRA and parameter-efficient fine-tuning → Low-codealso no-code, visual builderBuilding software mostly by arranging and configuring ready-made pieces instead of writing code line by line.
Low-code tools let people who are not programmers build useful apps quickly and let engineers prototype fast. The trade-off is that anything the ready-made pieces do not cover is hard to express, and testing, versioning and reviewing changes are weaker than in code. Many teams prototype low-code and rebuild proven ideas in code.
Like assembling flat-pack furniture rather than doing carpentry: fast and tidy, until you need a shape the kit does not include.
Learn it in: LangFlow for visual workflows → LSTMalso long short-term memory, cell state, forget gateA recurrent network with a separate long-term memory and gates that decide what to keep, add and output.
An LSTM keeps a cell state updated by multiplying by a forget gate and adding new content through an input gate, while an output gate controls what is exposed. Because the cell state is not squashed at every step, memory and gradients survive much longer than in a plain RNN. It dominated sequence modelling before transformers.
Like a recipe binder with an eraser, a pen and a reading lamp, each controlled by the baker.
Learn it in: RNNs, LSTMs and GRUs →