Back to Notes

GenAI Vocabulary

GenAI Vocabulary for Interviews

Know a one-line definition + one trade-off for each. Deeper theory: [[Learning/AI & ML/LLM Fundamentals]], [[Learning/AI & ML/Karpathy - Deep Dive into LLMs]].

Model fundamentals

TermDefinition / trade-off
TokenUnit a model reads/writes (subword, BPE). ~0.75 English words per token. Pricing, context limits, latency all counted in tokens.
Transformer / attentionEach token attends to earlier tokens. Attention cost grows with the square of sequence length → long context is expensive.
Context windowMax input + output tokens per call. Bigger helps, but facts in the middle of very long prompts get missed ("lost in the middle").
Pretraining → SFT → RLHF/DPONext-token prediction on web text → supervised tuning on instruction examples → preference tuning. DPO trains on preference pairs directly, no separate reward model.
EmbeddingFixed-length vector of meaning; similar texts are close under cosine similarity. Core of semantic search and RAG.
Temperature, top-pTemperature 0 picks most likely token (near-deterministic). Top-p samples from smallest set with cumulative probability p.
HallucinationFluent output not supported by facts/context. Mitigate: RAG grounding, citations, constrained output, verification.
Mixture of Experts (MoE)Only a few expert sub-networks run per token → compute per token ≪ total params. Memory still holds all experts.
MultimodalImage/audio/video encoded into the same token space as text.

Inference and serving

TermDefinition / trade-off
Prefill vs decodePrefill processes the whole prompt in parallel, compute-bound → sets TTFT. Decode generates one token at a time, memory-bandwidth-bound → sets TPOT.
KV cacheStored attention keys/values for past tokens so decode doesn't recompute. Often the main GPU memory consumer at high concurrency.
PagedAttentionvLLM: KV cache in fixed-size blocks like OS pages → no fragmentation, many more concurrent sequences.
Continuous batchingNew requests join the running batch every decode step. Big throughput gain over static batching.
Prefix / prompt cachingReuse KV cache for a shared prefix (system prompt, long doc). Cuts TTFT and cost.
QuantizationWeights in int8/fp8/4-bit instead of fp16 → ½–¼ memory, faster decode, small quality cost (measure it).
Speculative decodingSmall draft model proposes tokens; big model verifies several in one pass. Same output distribution, lower latency.
Tensor / pipeline parallelismSplit one model across GPUs: tensor = split each layer (needs NVLink); pipeline = split layers into stages.
DistillationTrain small student to imitate big teacher. Path to cheap, fast narrow models.
Model routing / cascadeEasy requests → small model, hard → big; or try small first and escalate on low confidence.
Structured outputConstrain decoding to a JSON schema/grammar so downstream code always parses.

Retrieval (RAG)

TermDefinition / trade-off
RAGRetrieve relevant docs at query time and put them in the prompt. Fresh, private, citable knowledge without retraining.
ChunkingSplit docs into retrievable pieces. Too small loses context; too large dilutes relevance and wastes tokens. Structure-aware > fixed size.
Vector DB / ANNApproximate nearest neighbour. HNSW: graph, high recall, memory-heavy. IVF-PQ: clustered + compressed, cheaper, lower recall. DiskANN: SSD-resident, billion scale.
Vector quantizationStore embeddings in fewer bits: int8 (4×), binary (32×), PQ (16–64×). Oversample + rescore to recover recall. Deep dive: [[Vector Quantization]].
Hybrid searchBM25 keywords + dense vectors. Keywords catch exact IDs, error codes, acronyms. Merge with Reciprocal Rank Fusion (RRF).
RerankerCross-encoder scores (query, passage) jointly. More accurate, slow → only on top 50–100.
Query rewritingLLM turns vague/follow-up question into standalone query, or multiple queries (multi-query, HyDE).
GraphRAGEntity-relationship graph from docs for cross-document / global questions.

Adapting models

TermDefinition / trade-off
Prompt engineeringSystem prompt, few-shot, chain-of-thought. Cheapest lever, always first.
Fine-tuningGood for style, format, narrow skills. Bad for frequently changing facts (use RAG).
LoRA / PEFTTrain small low-rank adapters, not all weights. Cheap; one base model can serve many adapters (multi-LoRA).
Synthetic dataStrong model generates training/eval data. Filter + human spot-check.

Agents and tools

TermDefinition / trade-off
Tool / function callingModel emits structured call (name + JSON args); your code executes, result goes back into context.
Agent loopthink → call tool → observe, until done. Needs step limits, timeouts, cost caps.
Workflow vs agentWorkflow = code-defined path with LLM steps; agent = model picks the path. Prefer workflows when path is known.
MCPModel Context Protocol: open standard for exposing tools/data to LLM apps. See [[Learning/AI & ML/MCP]].
System One model (Jev)TypeSafe AI's Jev (Sept 2026): non-autoregressive model that returns only typed decisions (choice/score/yes-no) with calibrated probabilities in 70–500 ms. Use for routing, classification, tool-call risk checks; can't generate text. See [[Learning/AI & ML/LLM Frontier Learning Path]].
MemoryShort-term = conversation in context; long-term = external store retrieved when relevant.

Safety and evaluation

TermDefinition / trade-off
GuardrailsInput/output checks: moderation, PII detection/redaction, topic restrictions, schema validation.
Prompt injectionMalicious instructions in user input or retrieved/tool content. Treat as untrusted data; least-privilege tools; confirm risky actions.
LLM-as-judgeStrong model grades against a rubric. Biases: position, length, self-preference → calibrate on human labels.
Golden setCurated, versioned inputs + expected outputs/rubrics; run on every prompt/model change like regression tests.
RAG metricsRetrieval: recall@k, MRR, nDCG. Generation: faithfulness, answer relevance, citation accuracy.
Online metricsThumbs, regenerate rate, acceptance rate, task completion, escalation rate, cost + latency per request.

Related: [[GenAI SD Framework]] · [[GenAI Capacity Math]] · [[index|GenAI index]]