Tokens
A tokenizer breaks text into pieces that a model can represent as numeric IDs. A piece can be a whole word, part of a word, punctuation or bytes.
Understand how models, retrieval and agents work. Practise the calculations, write the supporting code and explain your design decisions.
0/40 lessons marked complete · 0 bookmarks
New to GenAI? Follow the modules in order. If you already build RAG systems, start with retrieval quality, evaluation and production engineering, then revisit weak foundations. Depth follows your relevant experience, not a guaranteed question quota or hiring outcome.
40 concepts shown
A tokenizer breaks text into pieces that a model can represent as numeric IDs. A piece can be a whole word, part of a word, punctuation or bytes.
An embedding maps an input to a numeric vector. A retrieval system compares those vectors to find related content. Similarity is useful evidence for ranking, not proof of truth.
Attention combines token representations using weights computed from queries and keys. It helps a token use information from other allowed positions.
An autoregressive model produces a distribution over possible next tokens, chooses one under a decoding rule, appends it and repeats.
Temperature changes the sharpness of a sampling distribution by scaling logits. Lower values concentrate probability; higher values spread it.
The context window limits how much tokenized information a model request can accommodate. Applications choose what to include and what to leave out.
A hallucination is generated content that is unsupported or false in the task context. A confident style does not make it reliable.
Some models are trained to spend more computation on difficult problems before producing an answer. Extra reasoning can improve results but cannot guarantee correctness.
A system prompt provides high-priority behavioral instructions in APIs that support instruction roles. It shapes responses but is not a security boundary.
Few-shot prompting includes examples that demonstrate a desired input-output pattern without updating model weights.
Structured output constrains an answer to a shape such as a JSON schema. Correct structure and correct meaning are separate requirements.
Tool calling lets a model propose a named operation with arguments. Application code validates and executes permitted operations, then returns the result.
Context engineering selects and organizes the instructions, evidence, state and tool information supplied to a model for a particular task.
Some long-context experiments find lower retrieval performance when relevant information appears in the middle. This is an observed behavior to test, not a rule for every model or task.
Agent memory is application-managed information retained across steps or sessions. It can include temporary state, past events, facts or procedures, with explicit storage and retention rules.
Prompt caching can reuse computation for a compatible repeated prompt prefix. It is different from storing and returning a previously generated answer.
Retrieval-augmented generation supplies relevant external evidence to a model before it answers. The application must retrieve authorized material and verify that the answer uses it correctly.
Document parsing turns source files into usable text and structure while preserving reading order, headings, tables and provenance. Bad parsing can break retrieval before a model sees the content.
Chunking divides documents into retrievable units. Useful boundaries preserve enough context for an answer without filling the prompt with unrelated text.
Vector search retrieves stored representations near a query vector under a similarity metric. Approximate indexes trade some recall for speed and memory.
Hybrid search combines complementary retrieval methods, commonly lexical and semantic search, to handle both exact terms and paraphrases.
A reranker scores a smaller candidate set against the query to improve ordering after retrieval. Better ordering can improve evidence quality, at additional compute cost.
Query rewriting transforms a question into a search-friendly form while preserving the user intent and known facts. It must not invent details.
Abstention means declining to assert an answer when the available evidence is insufficient. It differs from refusing a disallowed request for safety reasons.
A workflow follows application-defined steps; an agent lets a model choose some next actions based on observations. Both need limits and reliable application controls.
An agent loop repeatedly observes state, chooses a permitted action, receives a result and decides whether to stop. The application enforces budgets and permissions.
Model Context Protocol standardizes how AI applications connect to capabilities such as tools and resources. It does not grant permission to every connected system.
Human review pauses a workflow before a consequential action or uncertain decision. Approval must refer to the specific action the reviewer sees.
Planning breaks a task into dependencies and selects an execution order. Independent work may run together; dependent work must wait for the results it needs.
Reflection is a review step that checks an output against criteria and may propose a revision. Repeating self-criticism does not prove the final answer is correct.
A multi-agent design assigns work to multiple model-driven roles or processes. It can help some decomposable tasks but adds coordination, cost and failure paths.
A multi-step task can fail even when each step usually succeeds. Long chains make it important to measure whole-task outcomes and recovery.
Evaluations test defined behaviors on representative examples with explicit labels or scoring criteria. They help compare changes and detect regressions before and after deployment.
An LLM judge scores another output using a rubric. It can scale review but can exhibit position, verbosity and model-preference biases.
Prompt injection occurs when untrusted content attempts to redirect model behavior or tool use. Retrieved documents and tool responses can carry instructions that conflict with the actual task.
Guardrails are layered controls that constrain inputs, outputs and actions. They reduce specific risks but need measurable coverage and cannot guarantee every attack is stopped.
Token cost depends on measured usage, the applicable input and output rates, cache rules and any additional service fees. Estimate with explicit assumptions and verify against actual billing.
A KV cache stores attention keys and values from previous tokens so decoding need not recompute them for each new token. Its memory grows with workload and model architecture.
Quantization represents weights or activations using lower-precision formats. It can save memory and change speed, with quality and hardware-dependent trade-offs.
Fine-tuning changes model parameters for a task. LoRA trains smaller low-rank updates while keeping selected base weights frozen. It is different from adding facts through retrieval.