Cheat Sheets / AI Fundamentals & AI-Assisted Engineering

AI Fundamentals cheat sheet

125 commands from every lesson of AI Fundamentals — How Modern AI Works, on one page.

01 · AI, machine learning and LLMs: the map

The terms

Artificial intelligence (AI)Any technique that makes a computer do something we would call intelligent
Machine learning (ML)AI that learns patterns from examples instead of following hand-written rules
Deep learningMachine learning with large neural networks of many layers
Generative AIModels that create new content: text, images, audio, code
Large language model (LLM)A generative model trained on huge amounts of text to predict the next piece of text
Foundation modelA large general-purpose model that many products are built on
ModelA file of learned numbers (parameters) plus the program that uses them
TrainingAdjusting the parameters from examples; slow and expensive, done rarely
InferenceUsing a trained model to get an answer; done every time you ask

02 · How a large language model works

Terms

TokenA piece of text the model reads and writes: a word, part of a word, or punctuation
TokenizerTurns text into token numbers and back
Next-token predictionThe model's only basic skill: given the text so far, score every possible next token
Parameters (weights)The learned numbers inside the model; billions of them
TransformerThe neural-network design behind modern LLMs
AttentionHow the model weighs every earlier token when predicting the next one
Pre-trainingLearning to predict text from a huge general collection
Fine-tuning / instruction tuningFurther training on examples of good instructions and answers
RLHFReinforcement learning from human feedback: people rank answers, the model learns their preferences
Reasoning modelA model trained to work through steps before giving its final answer

03 · Prompts, context windows and settings

Terms

PromptEverything sent to the model for one request
System promptInstructions from the application, sent first: role, rules, tone, format
Context windowThe maximum number of tokens the model can consider at once (input plus output)
Input / output tokensTokens sent to the model / tokens it writes; both are usually billed
TemperatureHow much randomness is used when choosing the next token
Few-shot promptingIncluding a few worked examples in the prompt
StatelessThe model keeps nothing between requests; the app re-sends the history

Prompting habits that work

Say who and whyWho the answer is for and what it will be used for
Give the materialPaste the log, document or data instead of describing it
Show the formatAn example of the output you want
Allow 'I don't know'Tell it to say so when the material does not contain the answer

04 · Why models get things wrong

Failure modes

HallucinationFluent, confident output that is false or invented
Knowledge cut-offThe model knows nothing after its training data was collected
BiasPatterns in training data (including unfair ones) show up in answers
SycophancyTendency to agree with the user, even when the user is wrong
Non-determinismThe same question can produce different answers

What reduces them

Grounding (RAG)Give the model the source documents and ask it to answer only from them
ToolsLet it look things up or calculate instead of guessing
CitationsAsk for the source of each claim so a person can check
VerificationTests, policy checks and human review before anything important

05 · Embeddings: meaning as numbers

Terms

VectorAn ordered list of numbers, e.g. [0.12, -0.53, 0.88, …]
EmbeddingA vector that represents the meaning of a text (or image, or audio)
DimensionsHow many numbers in the vector; commonly a few hundred to a few thousand
Embedding modelA model whose job is to turn text into embeddings (not to chat)
Cosine similarityA score for how closely two vectors point the same way; near 1 = similar meaning
Semantic searchFinding text by meaning instead of by matching words

06 · Vector databases

Terms

Vector databaseStores vectors with their text and metadata, and finds the nearest ones to a query vector
Nearest-neighbour searchFind the stored vectors closest to the query vector
ANN (approximate nearest neighbour)Very fast search that returns almost-always the true nearest results
Index (e.g. HNSW)The structure that makes ANN fast, like a map of shortcuts between points
Top-kHow many nearest results to return, e.g. the best 5
Metadata filterRestrict results by fields such as product, date, language, or who may see them
Hybrid searchSemantic (vector) search combined with keyword search

Common options

pgvectorExtension that adds vector search to PostgreSQL
OpenSearch / ElasticsearchSearch engines with vector search alongside keyword search
Qdrant, Weaviate, Milvus, ChromaPurpose-built vector databases, self-hosted or managed
Pinecone and cloud servicesFully managed vector search

07 · RAG: retrieval-augmented generation

The pipeline

IngestCollect documents, clean them, split into chunks
Embed and storeTurn each chunk into a vector; store with text and metadata
RetrieveEmbed the question; find the nearest chunks (with permission filters)
AugmentPut the chunks into the prompt with instructions
GenerateThe LLM answers from the chunks and cites them

Quality levers

Chunk size and overlapSmall enough to be specific, large enough to keep context
Hybrid searchAdd keyword search for codes, names and exact terms
Re-rankingA second model re-orders retrieved chunks by relevance
'Answer only from the sources'Instruction that reduces made-up answers
Evaluation setReal questions with known answers, run after every change

08 · Tools and function calling

Terms

Tool / functionSomething the application can do on the model's request: search, query, calculate, create a ticket
Tool definitionName, description and input fields the model is shown
Tool callThe model's structured request: which tool, with which inputs
Tool resultWhat the application sends back after running the tool
Structured outputAsking the model to reply in an exact format such as JSON

Permission levels

Read-onlySearch, look up, list: usually safe to run automatically
Reversible writeCreate a draft, add a label: run with logging
Irreversible or externalSend, pay, delete, deploy: ask a human first

09 · Agents

Terms

AgentA model in a loop that chooses and uses tools until a goal is done
Agent loopThink → act (tool call) → observe (result) → repeat
PlanningBreaking a goal into steps, and revising the plan as results arrive
Short-term memoryThe working context of the current task
Long-term memoryNotes saved outside the model and loaded into later tasks
Multi-agentAn orchestrator hands parts of the work to specialised sub-agents
Human in the loopA person approves risky steps or reviews the result

Questions to ask about any agent

GoalWhat exactly is 'done', and how is it checked?
ToolsWhich tools, with which permissions?
LimitsMaximum steps, time and cost
ApprovalsWhich actions need a person?
AuditIs every step logged?

10 · MCP: connecting AI to systems

Parts

HostThe AI application the person uses: a chat app, an IDE, a coding agent
MCP clientThe part of the host that talks to one MCP server
MCP serverA small program that exposes a system (tickets, database, cluster) through MCP
ToolsActions the server offers, e.g. search_tickets, create_issue
ResourcesData the server offers for reading, e.g. a file or a record
PromptsReady-made prompt templates the server offers

Before connecting a server

Who wrote it?Install only from sources you trust, pinned to a version
What can it do?List its tools; prefer read-only
Whose credentials?Scoped, least-privilege, ideally per user
What needs approval?Writes and anything outward-facing

11 · Choosing and running a model

Terms

Hosted (API) modelRun by a provider; you send requests and pay per token
Open-weight modelParameters are published; you can run it on your own hardware
Self-hosting toolsOllama for laptops and small servers; vLLM and similar for production GPU serving
QuantisationStoring parameters with fewer bits so a model fits on smaller hardware, with a small quality loss
LatencyTime to first token and tokens per second
Fine-tuningFurther training a model on your examples to change its behaviour
LoRAA cheap way to fine-tune by training a small add-on instead of the whole model

Questions for a provider

Training on our data?Is it used for training, and can that be switched off?
RetentionHow long are prompts and outputs stored?
LocationWhich regions process and store the data?
ComplianceCertifications and contracts you need

12 · Risks, guardrails and evaluation

Risks

Prompt injectionInput that makes the model ignore its instructions
Indirect prompt injectionInstructions hidden in content the model reads: a web page, email, document, tool result
Data leakageSensitive data in prompts, logs, answers or retrieved documents reaching the wrong people
Excessive agencyA model with more tools or permissions than the task needs
Over-reliancePeople accepting output without checking

Controls

Least privilegeOnly the tools and data the task needs, with the user's own permissions
Human approvalFor irreversible or outward-facing actions
Input and output filtersDetect secrets, personal data, unsafe content
Evaluation setFixed questions with expected results, run on every change
Red teamingDeliberately trying to break it before attackers do

13 · Capstone: an AI assistant end to end

Review checklist for any AI feature

PurposeWhat job, for whom, and what does a good answer look like?
ModelWhich one, hosted or self-hosted, and why; where does data go?
KnowledgeWhich sources, how kept fresh, permission-filtered?
ToolsWhich ones, read or write, whose credentials?
ApprovalsWhich actions need a person?
Guard-railsInjection, data leakage, output filters, limits
EvaluationTest set, scores, who reviews, how often
OperationsLogs, cost, latency, feedback, incident plan