Skip to content
AI360Xpert
Cheat Sheets
Cheat sheet

Generative Ai

A comprehensive guide for Generative Ai

🧠 Generative AI — Complete Cheat Sheet

1. Foundational Concepts
TermDefinition
AI (Artificial Intelligence)Broad field of building systems that perform tasks requiring human-like intelligence.
ML (Machine Learning)Subset of AI where systems learn patterns from data instead of explicit rules.
DL (Deep Learning)Subset of ML using multi-layered neural networks to learn complex representations.
Generative AIAI that creates new content (text, images, audio, video, code) rather than just classifying/predicting existing data.
Discriminative ModelLearns to distinguish between classes (e.g., spam vs. not spam).
Generative ModelLearns the underlying data distribution to generate new, similar samples.
Foundation ModelLarge model pre-trained on broad data, adaptable to many downstream tasks (e.g., GPT, Claude, Gemini).
2. Neural Network Basics
TermDefinition
Neuron/NodeBasic computational unit; applies weights, bias, and an activation function.
Weights & BiasesLearnable parameters adjusted during training.
Activation FunctionIntroduces non-linearity (ReLU, GELU, Sigmoid, Softmax).
BackpropagationAlgorithm to compute gradients and update weights via chain rule.
Gradient DescentOptimization method that adjusts weights to minimize loss.
Loss FunctionMeasures the difference between predicted and actual output (e.g., cross-entropy).
EpochOne full pass through the training dataset.
Overfitting/UnderfittingModel too closely fits training data / fails to capture patterns at all.
3. The Transformer Architecture
ComponentRole
Self-AttentionLets each token weigh the importance of every other token in the sequence.
Multi-Head AttentionRuns several attention mechanisms in parallel to capture different relationships.
Positional EncodingInjects word-order information since transformers process tokens in parallel, not sequentially.
Feed-Forward LayersDense layers applied after attention to transform representations.
EncoderProcesses input into contextual representations (used in BERT, translation).
DecoderGenerates output tokens one at a time (used in GPT-style models).
Encoder-DecoderCombines both (used in T5, translation models).
Layer NormalizationStabilizes training by normalizing activations.
Residual ConnectionsSkip connections that help gradients flow through deep networks.
4. LLM Fundamentals
TermDefinition
LLM (Large Language Model)Transformer-based model trained on massive text corpora to predict/generate text.
TokenSmallest unit of text a model processes (word, sub-word, or character piece).
TokenizationProcess of splitting text into tokens (e.g., BPE, WordPiece, SentencePiece).
Context WindowMax number of tokens a model can process at once (input + output).
ParametersLearned weights in the model; roughly indicates model "size"/capacity.
EmbeddingDense vector representation of a token/word/sentence capturing semantic meaning.
LogitsRaw, unnormalized output scores before softmax converts them to probabilities.
Autoregressive GenerationModel predicts the next token based on all previous tokens, one at a time.
PerplexityMetric measuring how well a model predicts a sample; lower = better.
5. Training Stages
StagePurpose
PretrainingModel learns general language patterns from massive unlabeled text (next-token prediction).
Fine-TuningFurther training on a smaller, task-specific labeled dataset.
Instruction TuningFine-tuning on (instruction, response) pairs so the model follows commands well.
RLHF (Reinforcement Learning from Human Feedback)Aligns model outputs with human preferences using a reward model + RL (e.g., PPO).
RLAIFLike RLHF, but AI-generated feedback replaces/augments human feedback.
DPO (Direct Preference Optimization)Simpler alternative to RLHF; directly optimizes on preference data without a separate reward model.
Constitutional AIModel is trained to self-critique and revise outputs based on a set of guiding principles.
6. Fine-Tuning & Adaptation Techniques
TechniqueDescription
Full Fine-TuningUpdates all model weights — expensive, most flexible.
PEFT (Parameter-Efficient Fine-Tuning)Updates only a small subset of parameters — cheaper, faster.
LoRA (Low-Rank Adaptation)Injects small trainable low-rank matrices into layers instead of updating full weights.
QLoRALoRA combined with quantization for fine-tuning on limited hardware.
AdaptersSmall trainable modules inserted between layers of a frozen pretrained model.
Prompt TuningLearns soft, continuous prompt embeddings instead of changing model weights.
Prefix TuningPrepends trainable vectors to each transformer layer's input.
7. Prompt Engineering
TechniqueDescription
Zero-Shot PromptingAsking the model to perform a task with no examples.
Few-Shot PromptingProviding a few examples in the prompt to guide output format/style.
Chain-of-Thought (CoT)Prompting the model to reason step-by-step before answering.
Self-ConsistencySampling multiple reasoning paths and choosing the most consistent answer.
ReActCombines reasoning and tool-use actions in an interleaved loop.
System PromptInstructions defining the model's role, tone, and constraints for a session.
Prompt InjectionAdversarial input that tries to override intended instructions (a security risk).
TemperatureControls randomness: low = deterministic, high = creative/random.
Top-k SamplingRestricts next-token choice to the k most likely tokens.
Top-p (Nucleus) SamplingRestricts choice to the smallest set of tokens whose cumulative probability ≥ p.
8. Retrieval-Augmented Generation (RAG)
TermDefinition
RAGCombines an LLM with an external knowledge retriever to ground responses in real/updated data.
Vector DatabaseStores embeddings for fast similarity search (e.g., Pinecone, Weaviate, Chroma, FAISS).
Embedding ModelConverts text into vectors for semantic search (e.g., OpenAI `text-embedding`, Cohere Embed).
ChunkingSplitting documents into smaller pieces before embedding, for better retrieval granularity.
Semantic SearchFinds results based on meaning/similarity rather than exact keyword match.
RerankingSecond-pass model that reorders retrieved documents by relevance.
Hybrid SearchCombines keyword (BM25) search with vector search for better accuracy.
9. AI Agents & Tool Use
TermDefinition
AgentAn LLM-driven system that plans, uses tools, and takes multi-step actions to reach a goal.
Tool/Function CallingModel outputs structured calls to external functions/APIs to fetch data or perform actions.
PlanningBreaking a complex goal into smaller sub-tasks/steps.
Memory (Agents)Short-term (context window) or long-term (external store) retention of information across interactions.
OrchestrationCoordinating multiple LLM calls, tools, and agents to complete a workflow.
Multi-Agent SystemMultiple specialized agents collaborating (e.g., planner, coder, reviewer).
MCP (Model Context Protocol)Open standard letting AI models connect to external tools/data sources uniformly.
10. Multimodal & Generative Content Types
TypeDescriptionExample Models
Text GenerationProducing coherent written content.GPT, Claude, Gemini, Llama
Image GenerationCreating images from text prompts.DALL·E, Midjourney, Stable Diffusion, Imagen
Diffusion ModelsGenerate images by learning to reverse a noise-adding process step by step.Stable Diffusion
GAN (Generative Adversarial Network)Generator vs. discriminator compete to produce realistic data.StyleGAN
VAE (Variational Autoencoder)Encodes data into a latent space and decodes to generate new samples.
Audio GenerationText-to-speech, music, voice cloning.ElevenLabs, MusicLM
Video GenerationText-to-video synthesis.Sora, Runway, Veo
Multimodal ModelProcesses/generates across multiple data types (text, image, audio) in one model.GPT-4o, Gemini, Claude (vision)
11. Model Evaluation
Metric/MethodUse
BLEU/ROUGEMeasure text overlap for translation/summarization quality.
PerplexityMeasures how "surprised" a model is by test data; lower is better.
Human EvaluationHuman raters judge quality, helpfulness, safety.
Benchmark SuitesStandardized tests (MMLU, HumanEval, HellaSwag, GSM8K, TruthfulQA) to compare models.
HallucinationConfident but factually incorrect or fabricated model output.
A/B TestingComparing model versions on live traffic to measure real-world performance.
LLM-as-a-JudgeUsing a strong LLM to evaluate/grade outputs of another model.
12. Key Model Families (2026 landscape)
ProviderModel Family
AnthropicClaude (Haiku, Sonnet, Opus, Mythos tiers)
OpenAIGPT series, o-series (reasoning models)
Google DeepMindGemini
MetaLlama (open-weight)
Mistral AIMistral, Mixtral (open-weight)
xAIGrok
Stability AIStable Diffusion
13. Deployment & Optimization
TermDefinition
InferenceRunning a trained model to generate predictions/output.
QuantizationReducing numerical precision (e.g., FP16 → INT8/INT4) to shrink model size and speed up inference.
DistillationTraining a smaller "student" model to mimic a larger "teacher" model.
LatencyTime taken to generate a response.
ThroughputNumber of requests/tokens processed per unit time.
BatchingGrouping multiple requests together to improve GPU efficiency.
StreamingSending generated tokens to the user as they're produced, rather than all at once.
APIInterface allowing developers to send prompts and receive model outputs programmatically.
14. Safety, Ethics & Alignment
TermDefinition
AlignmentEnsuring model behavior matches human intentions and values.
GuardrailsRules/filters that constrain model input/output to prevent harmful content.
BiasSystematic skew in outputs due to imbalanced/unrepresentative training data.
Red TeamingDeliberately probing a model for weaknesses, harmful outputs, or vulnerabilities.
JailbreakingAttempting to bypass a model's safety restrictions via crafted prompts.
Explainability/InterpretabilityUnderstanding <i>why</i> a model produced a given output.
Data PrivacyEnsuring training/inference doesn't leak sensitive or personal information.
WatermarkingEmbedding detectable signals in AI-generated content to identify its origin.
15. Popular Tools & Frameworks
CategoryTools
LLM OrchestrationLangChain, LlamaIndex, Haystack
Model Hosting/HubHugging Face, Replicate
Vector DatabasesPinecone, Weaviate, Chroma, Milvus, FAISS
Fine-TuningPEFT, Axolotl, Unsloth
Agent FrameworksAutoGPT, CrewAI, LangGraph
Experiment TrackingWeights & Biases, MLflow
Serving/InferencevLLM, TensorRT-LLM, Ollama
16. Quick Glossary
  • Context Length — max tokens a model can "see" at once.
  • Few-Shot Learning — learning a task from a handful of examples.
  • Grounding — anchoring model output in verified/external data (reduces hallucination).
  • In-Context Learning — model adapts behavior based on examples/instructions given within the prompt, without weight updates.
  • Latent Space — compressed internal representation of data learned by a model.
  • MoE (Mixture of Experts) — architecture where only a subset of "expert" sub-networks activate per input, improving efficiency at scale.
  • Reasoning Model — LLM variant optimized for extended step-by-step reasoning before answering.
  • System 1 / System 2 thinking — fast intuitive response vs. slow deliberate reasoning (used to describe reasoning model behavior).
  • Synthetic Data — AI-generated data used to augment or replace real training data.
  • Zero-shot / One-shot / Few-shot — number of examples given to guide the model's task performance.