Llms
63 bites tagged Llms — interview questions with model answers, and 60-second explainers.
Masked Multi-Head Attention in Decoders
Masked multi-head attention runs parallel detectors over past tokens only, stopping a decoder from peeking ahead. It powers autoregressive models like GPT. The footgun is using the causal mask in bidirectional encoders, which silently destroys context.
Position-wise FFN: Each Token's Private Workshop
Think of the position-wise FFN as each token's private gym after attention: it bulks up features and stores facts, but never shares between seats. Cutting it to save parameters starves the model because attention cannot do this alone.
Tokenization and Input Embeddings in LLMs
Tokenization splits language into tokens, and embeddings map token IDs into vectors with meaning. Every transformer does this first. The footgun is assuming one token equals one word—token counts behave unpredictably when words merge or split.
Few-Shot Prompting
Few-shot prompting embeds task examples directly in the prompt to guide output format without retraining. It excels at niche tasks and consistent formatting, but mismatched examples degrade performance more than no examples at all.
LLM Scaling Laws: Match Parameters to Tokens
For a fixed compute budget, model size and training data must grow equally. When choosing between a larger model or more tokens for the same FLOPs, more data usually wins. The footgun is scaling parameters alone, which undertrains the model and wastes compute.
Model Pruning: Making LLMs Smaller, Not Dumber
Model pruning is surgical weight loss for an LLM, removing neurons or layers to reduce its size. It's used to create smaller, faster versions of models like LLaMA for efficient deployment. The footgun: naive pruning can cripple the model's core capabilities.
LangChain Agents: Giving LLMs a Toolkit
A LangChain Agent is an LLM given a toolkit and a goal. The agent's 'harness' prompts the model to pick tools, call them in a loop, and reason about the results until the task is complete. Use it to query databases or call external APIs.
Agent Memory: Short-Term vs. Long-Term Recall
Agent memory gives an LLM a sense of history, separating fleeting conversation context from persistent knowledge. Short-term memory tracks the current chat, while long-term memory recalls user facts across sessions.
Mixture of Experts: Scaling Models by Activating Specialists
A Mixture of Experts (MoE) model acts like a team of specialists instead of one generalist. A router sends each token to a few expert sub-networks, enabling faster training and inference for massive models.
Hugging Face Hub: The GitHub for Machine Learning
Think of the Hugging Face Hub as the GitHub for machine learning. It's a central platform to find, share, and collaborate on millions of models, datasets, and demo apps. Use it to download a pre-trained model or share your own.
Data Bias: When AI Inherits Our Flaws
Generative AI learns patterns from its training data. Data bias occurs when this data contains skewed perspectives or stereotypes, which the model then reproduces and amplifies. This is why an image generator might default to stereotypes.
ONNX Runtime: Run Any AI Model, Anywhere
ONNX Runtime is a universal engine for AI models, letting you run them efficiently on any hardware, from cloud GPUs to a user's browser. It's used to deploy models for fast inference on servers or mobile devices.
Instrumental Convergence: Why All AIs Might Act Alike
Even with different end goals, intelligent agents tend to pursue the same sub-goals like self-preservation and resource gathering. This is key in AI safety, explaining why a paperclip-making AI might compete with humans for resources, not from malice but…
Constitutional AI: Teaching Models to Govern Themselves
Constitutional AI teaches a model to self-correct against a set of principles, or a 'constitution.' This automates safety alignment for models like Claude, reducing reliance on human feedback.
Model Cards: The 'Nutrition Label' for AI Models
A model card is the nutrition label for an AI model, summarizing its ingredients, intended use, and risks. Found in model repos, it details training data, performance, and ethical guardrails.
Text-to-Image Synthesis: From Prompt to Picture
Text-to-image models translate words into pixels by learning statistical links between text and images. They power creative tools like DALL-E but don't truly understand prompts, leading to errors in logic like counting or spatial arrangement.
Hierarchical AI Agents: The Org Chart for AI
Think of a corporate org chart for AI. A top-level agent breaks a big goal into smaller tasks and delegates them to specialized, lower-level agents. This is used for complex problems like automating software development. The main risk is coordination overhead.
Task Decomposition: Teaching LLMs to Plan
Task decomposition for an LLM agent is like writing a recipe: break a big goal into a checklist of small, executable steps. It's vital for complex requests like planning a trip, but a bad initial plan can cause cascading failures that doom the entire process.
Proximal Policy Optimization (PPO): Stable RL Updates
PPO prevents destructive updates in reinforcement learning by "clipping" how much a policy can change at once, like a governor on an engine. It's a default for training LLMs with RLHF or robotics agents where stability is key.
Least-to-Most Prompting: Solving Hard Problems Incrementally
Least-to-most prompting guides an LLM by breaking a hard problem into a sequence of simpler steps. It excels at complex math or logic where chain-of-thought fails, solving each subproblem using the answer to the previous one.
Tensor Parallelism: Split Layers, Not Just Models
Tensor Parallelism splits a single large model layer, like a weight matrix, across multiple GPUs to run in parallel. This is crucial for inference with models whose layers exceed a single GPU's VRAM.
Data Parallelism: One Task, Many Data Chunks
Data parallelism splits a huge dataset across multiple processors, each running the same task on its own chunk. It's how large models are trained on massive datasets, with each GPU handling a different batch of data.
AdamW: Decoupling Weight Decay for Better Generalization
AdamW fixes a flaw in the Adam optimizer by decoupling weight decay from the gradient update, improving model generalization. It's a go-to for training large networks like Transformers. The footgun is thinking it's the same as Adam with L2 regularization.
Causal Language Modeling: The Autocomplete Engine
Causal Language Modeling is like a powerful autocomplete, predicting the next word based only on what came before. It's the engine for text generation in chatbots, creative writing tools, and coding assistants. The footgun: it can't see future words.
Get Llms bites daily.
Five a day, five minutes, offline. With quizzes so it sticks.
Open testing — you’ll join as an early tester.