Back
Keentune
AI & LLMs curriculum 19 chapters
·
133 concepts
·
free
Everything the adaptive question bank can teach and test in AI & LLMs, from foundations through advanced practice. Work through it in order, or start practising and let the questions find your level.
Start practising AI & LLMs
New here? Read the AI & LLMs guide
A free 17-minute primer — the mental model, the mistakes beginners make, and what to practise first.
A. What the model is actually doing when it answers
•
the model emits one token at a time, each conditioned on every token before it
•
any output token can attend to any earlier token, so there is no "read order" to exploit
•
the API remembers nothing; a conversation exists only because you resend the transcript
•
output is drawn from a probability distribution, so a recalled fact and a fluent guess are produced by the same machinery
•
plausible continuation is what training optimizes; nothing in the objective rewards saying "unknown"
•
the weights freeze at a training date, so anything newer has to arrive in the prompt
•
a base model continues text; the helpful-assistant behavior is a separate training stage on top
B. Tokens, tokenization and the context window
•
text is split into subword pieces, so tokens map to neither words nor characters
•
code, JSON, URLs, rare words and whitespace all cost far more tokens per character than prose
•
the same sentence in a non-Latin script can cost several times more tokens than its English original
•
letter counting, reversal and rhyming are hard because the model never sees the characters
•
prompt and completion share one budget, so a huge prompt leaves no room to answer
•
it truncates mid-sentence when hit and never lengthens a short answer
•
a token-counting endpoint sizes and prices a request without running the model
•
recall is strongest at the start and end of a long context and weakest in the middle
C. Sampling controls and determinism
•
low values sharpen toward the likeliest token, high values flatten toward the tail
•
greedy decoding becomes likely, not reproducible; no API promises identical bytes
•
sampling is restricted to the smallest set of tokens whose probabilities sum to p
•
temperature and top-p both truncate the same distribution, so tuning them together is uninterpretable
•
extraction and classification want near-zero; brainstorming wants variety
•
generation halts on a literal string, and the matched string is not part of the returned text
D. The Messages API surface
•
a request is an ordered list of user and assistant turns
•
durable role and rules go in the top-level system field, not in a fake first user turn
•
a turn's content is an array of blocks (text, image, document, tool_use, tool_result), not a string
•
appending each response to your own history is what creates continuity
•
end_turn, max_tokens, stop_sequence and tool_use each require a different next action
•
the response reports the input and output tokens you were billed for
•
an exact model id makes behavior reproducible; an alias silently changes under you
•
the version header pins the response shape, so upgrading is a deliberate, dated act
E. Streaming, batches and long-running requests
•
the response arrives as incremental events your client assembles into a message
•
message start, content-block deltas and message stop carry different information and must be handled separately
•
streaming improves time-to-first-token; it does not shorten the request
•
a streamed tool input or JSON object is invalid until its block closes
•
a successful response header does not promise a complete message
•
beyond a size threshold a non-streaming request is rejected or times out
•
asynchronous bulk submission costs substantially less per token than real-time calls
•
each request in a batch succeeds or fails independently and is reconciled by its custom id
•
a cache hit requires an identical prefix from the very start of the prompt
•
tools, system prompt and long documents go before anything that varies per request
•
you place explicit cache markers, and everything up to a marker is the cacheable unit
•
an entry expires after an idle window, and each hit extends its life
•
the first call pays a premium so repeated calls pay a fraction of the input price
•
changing a byte near the top discards the cache for everything after it
•
the model has no access to your intent, only your words; name the goal, the audience and the format
•
a handful of worked examples conveys a format that prose description cannot
•
if every example shares an incidental trait, the model reproduces that trait
•
asking for reasoning first raises multi-step accuracy and raises latency and price with it
•
put the thinking in its own section so the caller can strip it before use
•
two focused calls outperform one prompt carrying a dozen competing rules
•
a positive instruction outperforms a prohibition, which still puts the forbidden idea in context
•
a prompt tuned on tidy hand-picked examples breaks on the production distribution
H. Output shape: formatting, prefill and structure
•
tagged regions make the prompt unambiguous to the model and the response easy to slice
•
seeding the reply with an opening token or heading forces the shape without asking for it
•
it is the reliable cure for "Sure, here is the JSON you asked for"
•
a declared schema makes validity a property of generation, not of the prompt wording
•
hitting the output cap yields syntactically invalid data, so parse-then-repair is mandatory
•
forcing pure JSON removes the scratchpad, so give reasoning its own field or its own call
I. Tool use and function calling
•
it emits a structured request; your code runs the function and owns every side effect
•
assistant emits tool_use, you send back a tool_result with the matching id, then call the model again
•
the tool's name and description are what teach the model when to reach for it
•
enums, required fields and formats stop the model from inventing argument values
•
independent calls can be issued in one turn; a call needing another's output cannot
•
auto, any tool, one named tool, or none, chosen per request
•
returning the failure as a tool_result lets the model correct itself; throwing ends the loop
•
tool definitions are re-billed on every request, so an unused tool is a recurring cost
J. Agents and the agent loop
•
an agent runs the model with tools in a loop, choosing its own next step until a stop condition
•
a fixed code path is cheaper and more predictable; an agent is warranted only when the path is unknown in advance
•
a done signal plus hard step, token and wall-clock ceilings, because a loop can fail by never stopping
•
every iteration resends the whole history, so spend rises superlinearly with steps
•
a child agent explores in its own window and returns only a summary to the parent
•
long runs wander, so the objective and success criteria have to be restated, not just stated once
•
a checkable signal (tests, a schema, a diff) beats more planning
•
require approval in proportion to how irreversible the action is
K. Context and memory management
•
everything in the window competes for attention, so relevance beats volume
•
compact older turns into a summary and keep the most recent turns verbatim
•
decide in advance which commitments and constraints must survive compaction
•
identity, policy and hard requirements live outside the compactible region
•
stale tool results are usually the largest and most disposable share of context
•
write facts to a store and retrieve the few that matter instead of resending everything
L. Retrieval-augmented generation
•
it supplies fresh, private, citable facts; it does not change how the model writes or behaves
•
small chunks retrieve precisely and lose surrounding context, large chunks do the reverse
•
cutting at headings, sections or function boundaries keeps a chunk a complete thought
•
a sentence split across two chunks is retrievable from neither without overlap
•
prefixing each chunk with its document and section identity measurably raises retrieval accuracy
•
the nearest chunk can be on-topic and still contain nothing that answers the question
•
instruct the model to use only the supplied passages and to say when they are insufficient
•
a stale index produces a confident wrong answer with a citation attached, which is worse than no answer
M. Embeddings, vector search and reranking
•
nearby vectors mean similar meaning, which is why paraphrases retrieve and keyword search misses them
•
similarity uses the angle between vectors, not their magnitude
•
query and documents must be embedded by the same model or the distances are meaningless
•
a new embedding model invalidates every stored vector
•
vector indexes trade recall for speed, and that tradeoff is the tuning knob
•
lexical search still wins on ids, error codes and rare names, so production fuses both rankings
N. Model Context Protocol
•
one protocol replaces an N×M matrix of bespoke integrations between apps and tool providers
•
the host application runs clients, and each client maintains one connection to one server
•
requests, responses and notifications travel in a defined message envelope
•
the model decides to invoke a tool, subject to host approval
•
URI-addressed context the host chooses to attach, not something the model calls
•
reusable templates a user invokes deliberately, such as a slash command
•
stdio for a local subprocess, streamable HTTP for a remote server
•
an eval starts from a written description of a good answer, not from a metric
•
a fixed, versioned set of inputs and expected outputs is what makes two runs comparable
•
exact match, schema validity and assertions are cheap and unambiguous wherever they apply
•
a model grades open-ended output against an explicit rubric when code cannot
•
judges systematically favor longer answers, their own phrasing, and whichever candidate is shown first
•
agreement with human labels on a sample is what licenses using the judge at all
•
one run is a single sample, so report a pass rate over repeated runs
•
prompt, model and tool changes rerun the suite before shipping, because a fix elsewhere silently breaks a case here
P. Prompt injection, jailbreaks and output safety
•
the model sees one token stream, so retrieved text is data to be reported on and never obeyed
•
the payload arrives inside a fetched page, file, or tool result rather than from the user
•
tagging untrusted text lowers the odds but does not make it inert
•
private data, untrusted content and an outbound channel together turn an injection into a breach
•
scope credentials and tool permissions so a successful injection can accomplish little
•
role-play, hypothetical framing and gradual escalation are variations on the same policy bypass
•
input screening, system-prompt rules and output filtering fail in different ways, so run all three
•
redact identifiers on the way in and keep them out of prompts, logs and traces
Q. Fine-tuning versus prompting
•
prompt, then retrieval, then tuning, because each step costs more and is harder to reverse
•
style, format and task behavior transfer; knowledge belongs in retrieval
•
a few hundred consistent, correct examples beat thousands of noisy ones
•
training on clean inputs and serving messy ones is the classic tuning failure
•
without a held-out measure you cannot distinguish improvement from overfitting
•
every upgrade of the underlying model means retraining and re-evaluating
•
LoRA and other adapters train a small set of extra weights, so one base model serves many tasks by swapping them
R. Cost and latency engineering
•
output tokens cost a multiple of input tokens, which changes what is worth trimming
•
cost per turn grows with history length, not with the length of the new message
•
route easy steps to a small model and hard steps to a large one instead of paying top price throughout
•
shortening the response is a bigger latency lever than shortening the prompt
•
hashing an identical request is safe; serving a merely similar one can return the wrong answer
S. Reliability and production hygiene
•
a 429 means retry with exponential backoff and jitter, not retry immediately
•
a malformed request fails identically on retry, while an overload error may not
•
a degraded but returned answer beats a hung request, so every call needs a deadline and a plan B
•
log tokens, latency and cost per call so a regression can be attributed to a stage
•
treat prompts as versioned artifacts so a behavior change can be traced to a specific edit
Keentune is not affiliated with or endorsed by the organizations whose documentation informs these maps.
Start practising AI & LLMs
All about AI & LLMs practice
All exam, test, and product names and trademarks are the property of their respective owners and are used here for identification and reference only. Keentune is independent study practice — not affiliated with, authorized, or endorsed by any of these organizations.
© 2026 SportaApp LLC