Skip to main content
Albero Academy

Generative AI & LLMs Cheat Sheet

Transformers · RAG · prompting · fine-tuning

Transformers, embeddings, RAG, prompting, fine-tuning vs context — the 2026 must-know reference for AI builders.

All sheets
PDF quick reference

GenerativeCheat sheet

Sections
4
Snippets
5
Pages
2
01

Core concepts

Glossary
Token smallest unit of text the model sees
Embedding vector representation of a token
Context all tokens the model attends to
Transformer self-attention based architecture
RAG retrieval-augmented generation
02

Prompting patterns

Zero / few / chain-of-thought
Zero-shot plain instruction
Few-shot instruction + 3-5 examples
CoT "let's think step by step"
ReAct reason + act loop with tool calls
03

Build a RAG pipeline

High-level flow
1. Chunk the docs (~500 tokens, overlap)
2. Embed each chunk (OpenAI / Cohere / local)
3. Store in a vector DB (Pinecone / pgvector / Chroma)
4. At query: embed → top-k retrieve → stuff into prompt
5. Send to LLM, return cited answer
Minimal code
from openai import OpenAI
client = OpenAI()
emb = client.embeddings.create(
model="text-embedding-3-small",
input=chunks
).data
# similarity search → top_k → prompt
response = client.chat.completions.create(
model="gpt-4o",
messages=[
{"role": "system", "content": SYSTEM},
{"role": "user", "content": question + "\n\n" + context}
]
)
04

Fine-tuning vs context

When to use which
Use context (RAG) when:
- Knowledge changes often
- Need cited sources
- Small / medium domain
Fine-tune when:
- Style / format must be consistent
- Heavy traffic + cost-sensitive
- Need to teach a new task pattern