Active Nerds
Gen AI Learning Stream

Gen AI Roadmap Articles & Question Stream

Browse questions, read quick answers, or expand full article breakdowns on demand. Filter by level, domain, or completion status using the sidebar dashboard.

Showing 69 of 69 questions
beginnerArchitecture & Mathematics4 min+10 XP

Subword Tokenization: How BPE Handles Out-of-Vocabulary Words and Vocab Size Trade-offs

Question

How does Subword Tokenization (e.g., Byte-Pair Encoding or WordPiece) handle out-of-vocabulary (OOV) tokens compared to character-level or word-level tokenization, and what are the system memory implications of increasing vocabulary size versus context window size?

beginnerArchitecture & Mathematics4 min+10 XP

Cosine Similarity vs. Euclidean Distance: Choosing a Metric for Text Embeddings

Question

Mathematically and concept-wise, why is cosine similarity often preferred over Euclidean distance ($L_2$) for high-dimensional text embeddings, and under what normalization condition are their rankings mathematically equivalent?

beginnerArchitecture & Mathematics4 min+10 XP

Scaled Dot-Product Attention: Why Transformers Divide by √d_k

Question

In the standard scaled dot-product attention formula $\text{Softmax}\left(\frac{QK^T}{\sqrt{d_k}}\right)V$, why is the dot product scaled by $\sqrt{d_k}$, and what happens to the gradients during backpropagation if this scaling factor is omitted as $d_k$ grows large?

beginnerArchitecture & Mathematics4 min+10 XP

Absolute vs. RoPE Positional Encoding: Why Rotary Embeddings Extrapolate Better

Question

What is the fundamental operational difference between absolute positional encodings (e.g., sinusoidal) and relative positional encodings like Rotary Position Embedding (RoPE), and why does RoPE extrapolate better to longer context lengths?

beginnerInference Engineering5 min+10 XP

Temperature, Top-K, and Top-P: Tuning LLM Sampling for Deterministic vs. Creative Output

Question

How do Temperature, Top-K, and Top-P (Nucleus) sampling mechanically alter the logit probability distribution before token generation, and what combination would you deploy to guarantee deterministic JSON output versus creative text generation?

beginnerSystem Design & Prompt Engineering4 min+10 XP

System, User, and Assistant Roles: How Prompt Structure Shapes the Context Window

Question

From an inference-engine perspective, how does structured prompt framing (e.g., System vs. User vs. Assistant roles) affect the underlying key-value structure of the context window during a multi-turn conversation?

beginnerArchitecture & Mathematics3 min+10 XP

Softmax Numerical Stability: Why Subtracting the Max Logit Prevents Overflow

Question

Why is subtracting the maximum value ($\max(x)$) from raw logits before applying Softmax ($\text{Softmax}(x_i) = \frac{e^{x_i - \max(x)}}{\sum e^{x_j - \max(x)}}$) mathematically necessary in FP16/BF16 precision arithmetic, and what numerical error occurs without this shift?

beginnerArchitecture & Mathematics4 min+10 XP

Causal Masking: How Decoder-Only Transformers Block Future-Token Leakage

Question

How does the causal mask matrix physically prevent future-token leakage in autoregressive decoder-only architectures, and how does its computational complexity compare to bidirectional encoder-only self-attention?

beginnerArchitecture & Mathematics4 min+10 XP

SwiGLU Feed-Forward Networks: Why Modern LLMs Replaced ReLU and GELU

Question

In modern Transformer architectures (e.g., LLaMA), why was the standard ReLU/GELU Feed-Forward Network replaced by SwiGLU, and how does adding a gated linear unit alter the parameter distribution and activation footprint?

beginnerInference Engineering4 min+10 XP

Token Streaming and EOS Detection: Handling SSE Output and UTF-8 Buffering

Question

How does an inference server handle token generation termination signals (e.g., `<|endoftext|>` or custom stop sequences) during Server-Sent Events (SSE) streaming, and why do multi-byte UTF-8 characters require client-side buffer management?

beginnerSystem Design & Prompt Engineering4 min+10 XP

Logit Bias: How Adjusting Log-Odds Steers Token Sampling (and Breaks It)

Question

How does applying a positive or negative `logit_bias` value dynamically adjust the log-odds of target tokens during sampling, and why does extreme logit biasing cause unexpected decoding degradation?

beginnerInference Engineering4 min+10 XP

Left-Padding vs. Right-Padding: Why Batched Decoder Inference Requires Left-Padding

Question

Why must batch inference for autoregressive decoder-only models strictly utilize left-padding instead of right-padding, and how does incorrect padding placement corrupt positional embedding calculations?

beginnerArchitecture & Mathematics4 min+10 XP

Subword Tokens and the Spelling Problem: Why LLMs Struggle to Count Letters and Do Arithmetic

Question

Why do LLMs operate on subword tokens (via BPE or similar) rather than whole words or raw characters, and what practical problems does this cause when a model has to reason about things like spelling, counting characters, or arithmetic on numbers?

beginnerArchitecture & Mathematics3 min+10 XP

Token Embeddings: How Vector Geometry Encodes Semantic Meaning

Question

What does it actually mean for a token to be represented as a high-dimensional embedding vector, and why does the geometric relationship between vectors (distance, direction) end up encoding semantic meaning?

beginnerArchitecture & Mathematics4 min+10 XP

Self-Attention vs. RNNs: The Scaling Problem Transformers Solved

Question

In plain engineering terms, what problem does the self-attention mechanism solve that fixed-window or recurrent (RNN/LSTM) architectures could not solve efficiently at scale?

beginnerArchitecture & Mathematics4 min+10 XP

Query, Key, and Value: What Each Matrix Represents in an Attention Head

Question

Walk through, at a conceptual level, what the Query, Key, and Value matrices represent in an attention head, and why the dot product between Query and Key is a reasonable way to compute "relevance" between tokens.

beginnerArchitecture & Mathematics4 min+10 XP

Context Window Limits: Why You Can't Just Increase the Number in a Config File

Question

Why does a model's context window have a hard upper limit, and why does simply "increasing the number" in a config file not scale for free from an engineering standpoint?

beginnerInference Engineering5 min+10 XP

Temperature vs. Top-P: Choosing the Right Lever for Code Generation vs. Creative Writing

Question

From a systems perspective, what is actually happening to the model's output probability distribution when you lower temperature versus when you apply top-p (nucleus) sampling — and why would you choose one lever over the other for a production use case like code generation vs. creative writing?

beginnerInference Engineering4 min+10 XP

Greedy Decoding's Repetition Problem: Why the 'Most Confident' Choice Backfires

Question

Why does greedy decoding (always picking the highest-probability token) often produce worse or more repetitive output than sampling-based decoding, even though it looks like the "most confident" choice at every step?

beginnerArchitecture & Mathematics4 min+10 XP

Diffusion Models: How Iterative Denoising Turns Noise Into a Coherent Image

Question

At a mechanical level, how does an image diffusion model turn random noise into a coherent image, and why is the training objective (predicting noise) different from what happens during inference (iterative denoising)?

beginnerArchitecture & Mathematics4 min+10 XP

Latent Diffusion: Why Stable Diffusion Denoises in Compressed Space, Not Pixels

Question

Why do most modern diffusion image models (e.g., Stable Diffusion-style architectures) perform the denoising process in a compressed latent space rather than directly on pixels, and what's the engineering trade-off being made?

beginnerPrompt Engineering & Application Design4 min+10 XP

Few-Shot Prompting: Why Good Examples Beat Longer Instructions (Until They Don't)

Question

Why does providing a few well-chosen examples (few-shot prompting) often outperform a longer, more detailed zero-shot instruction, and in what scenarios does adding more examples actually hurt performance?

beginnerPrompt Engineering & Application Design4 min+10 XP

Chain-of-Thought Prompting: Why Generated Tokens Act as the Model's Working Memory

Question

Why does asking a model to "think step by step" measurably improve accuracy on multi-step reasoning tasks, and what does this imply about how the model uses its own generated tokens as working memory?

beginnerArchitecture & Mathematics4 min+10 XP

Why Self-Attention Needs Positional Encoding to Understand Token Order

Question

Since self-attention has no inherent sense of token order, why is positional information necessary at all, and what breaks in a model's behavior if positional encodings are removed or corrupted? *RAG Architecture, Vector DBs & Indexing, PEFT (LoRA/QLoRA), Quantization, Function Calling / Tool Use*

intermediateRAG & Data Systems6 min+15 XP

HNSW vs. IVF-Flat: Vector Index Trade-offs in Recall, Latency, and RAM

Question

What are the computational trade-offs between Hierarchical Navigable Small World (HNSW) and Inverted File Index (IVF) vector indexes in terms of recall accuracy, build time, query latency, and RAM footprint during peak ingestion?

intermediateRAG & Data Systems6 min+15 XP

Hybrid Search: How Reciprocal Rank Fusion Combines BM25 and Dense Vector Retrieval

Question

Why does pure dense-vector retrieval struggle with exact-keyword queries (such as product SKUs or error codes), and how does Reciprocal Rank Fusion (RRF) combine sparse search (BM25) with dense vector search mathematically?

intermediateModel Training & Fine-Tuning6 min+15 XP

LoRA Weight Decomposition: Why Merged Adapters Add Zero Inference Latency

Question

How does Low-Rank Adaptation (LoRA) decompose weight updates ($\Delta W = A \cdot B$), and why does merging these adapter weights back into the frozen base model prior to inference result in zero added latency compared to runtime adapters?

intermediateModel Training & Fine-Tuning7 min+15 XP

QLoRA: How NF4 Quantization and Double Quantization Enable 4-Bit Fine-Tuning

Question

How does QLoRA achieve 4-bit fine-tuning without significant loss in downstream performance, and what role do NormalFloat4 (NF4) data types and Double Quantization play in reducing memory overhead?

intermediateInference Engineering7 min+15 XP

GPTQ, AWQ, and GGUF: Comparing Weight-Only Quantization Formats Across Hardware

Question

Compare weight-only quantization techniques (e.g., AWQ, GPTQ) with CPU/GPU hybrid formats like GGUF. What are the key differences in how weights and activations are quantized (e.g., INT4/INT8 vs. FP16), and how do they impact execution speed across edge devices versus data-center GPUs?

intermediateAgentic Systems6 min+15 XP

Function Calling Under the Hood: How Open-Weight Models Signal Tool Calls from JSON Schemas

Question

How do modern open-weights models implement Function Calling under the hood? Specifically, how are JSON schemas mapped to prompt tokens, and how does the model signal a tool execution call versus a final user response?

intermediateRAG & Data Systems7 min+15 XP

Product Quantization: Compressing Vector Embeddings with Symmetric vs. Asymmetric Distance

Question

How does Product Quantization (PQ) compress high-dimensional vector embeddings into compact byte codes, and what is the difference between Symmetric Distance Computation (SDC) and Asymmetric Distance Computation (ADC) during vector retrieval?

intermediateRAG & Data Systems6 min+15 XP

Parent Document Retrieval: Balancing Chunk Precision with Full-Context Synthesis in RAG

Question

How does Parent Document / Small-to-Big Retrieval balance small chunk granular search precision with large context generation synthesis, and how does it prevent information fragmentation in RAG pipelines?

intermediateRAG & Data Systems6 min+15 XP

Bi-Encoders vs. Cross-Encoders: Why Re-Ranking Costs Quadratic Attention

Question

Why are Bi-Encoders used for initial vector candidate generation while Cross-Encoders are reserved for re-ranking, and what are the quadratic self-attention costs ($O(N^2)$) associated with Cross-Encoder re-ranking?

intermediateModel Training & Fine-Tuning6 min+15 XP

Prefix Tuning vs. LoRA: Parameter Placement and the KV Cache Cost of Virtual Tokens

Question

How does Prefix Tuning differ from LoRA in terms of parameter location and virtual token prepending, and why does Prefix Tuning decrease available effective context length and KV cache capacity during serving?

intermediateAgentic Systems6 min+15 XP

Tool Choice Enforcement: How Logit Masking Guarantees Valid Function Calls

Question

When forcing a model to execute a specific tool (e.g., `tool_choice: "required"`), how does the runtime engine enforce token masking on the initial generated tokens to guarantee a valid function header before parsing parameters?

intermediateRAG & Data Systems6 min+15 XP

Fixed-Size vs. Semantic Chunking: Failure Modes in RAG Pipelines

Question

When designing a chunking strategy for a RAG pipeline over long technical documents, what are the concrete failure modes of fixed-size chunking (e.g., splitting mid-table or mid-procedure), and how do semantic or structure-aware chunking strategies address them at the cost of what added complexity?

intermediateRAG & Data Systems7 min+15 XP

ANN Search in Vector Databases: Tuning HNSW's ef_construction and M

Question

Why do production vector databases rely on approximate nearest neighbor (ANN) algorithms like HNSW or IVF instead of exact k-NN search, and what specific trade-off between recall, latency, and memory footprint are you tuning when you adjust an HNSW graph's `ef_construction` and `M` parameters?

intermediateRAG & Data Systems6 min+15 XP

Hybrid Search: Why Dense Retrieval Alone Misses Exact-Match Queries

Question

Why does pure dense-vector semantic search often underperform on queries involving exact terms (product SKUs, error codes, acronyms), and how does a hybrid retrieval architecture (dense + BM25/sparse, followed by a cross-encoder reranker) mitigate this without collapsing latency?

intermediateRAG & Data Systems6 min+15 XP

Embedding Model Upgrades: Why You Can't Just Swap a Production Vector Index

Question

If you upgrade your embedding model in a production RAG system, why can't you simply swap the model and keep the existing vector index, and what does a safe migration path actually require?

intermediateModel Training & Fine-Tuning6 min+15 XP

LoRA Fine-Tuning: How Low-Rank Decomposition Cuts Trainable Parameters

Question

Mechanically, how does LoRA reduce trainable parameters by decomposing weight updates into low-rank matrices, and why does this approach preserve the base model's original capabilities better than full fine-tuning on a narrow dataset?

Quick Answer

LoRA freezes the original weight matrix entirely and trains a small pair of low-rank matrices whose product approximates the weight update, so only a tiny fraction of parameters are ever touched — and because the base weights never change, the model's original capabilities stay structurally intact.

Detailed Answer

Full fine-tuning updates every parameter in a weight matrix W (dimensions d × k) directly — for a matrix with thousands of rows and columns, that's millions of trainable values per layer, multiplied across every layer being tuned. LoRA replaces that direct update with a low-rank decomposition: instead of learning a full ΔW of shape d × k, it learns two much smaller matrices, B (shape d × r) and A (shape r × k), where the rank r is deliberately small — typically 8 to 64 — compared to d and k, which are often in the thousands.

The forward pass becomes:

h = Wx + (B·A)x · scaling

W stays frozen throughout training — gradients never touch it. Only A and B receive gradient updates, and their combined parameter count, r·(d + k), is orders of magnitude smaller than d·k for realistic values of r. B is typically initialized to all zeros (with A initialized randomly), so at the start of training B·A = 0 and the adapted model behaves identically to the unmodified base model — training then gradually grows a small, targeted correction on top of it.

Why this preserves the base model's capabilities better than full fine-tuning on a narrow dataset: full fine-tuning lets gradients from a narrow dataset push every parameter in the network, including ones that encode broad, general capabilities that have nothing to do with the fine-tuning task — this is the mechanism behind catastrophic forgetting, where a model gets sharper on the new narrow task but measurably worse at things it could previously do well. LoRA constrains every possible update to lie within a low-rank subspace of the full parameter space. That's a much smaller space of functions the model can move into, which acts as a strong implicit regularizer: the adapter can't reshape the model's behavior nearly as freely as full fine-tuning can, so it's far less able to overwrite general capabilities in the process of fitting a narrow dataset. It's also trivially reversible — remove or zero the adapter, and the original base model is recovered exactly, byte-for-byte, since it was never modified.

Key Takeaway

LoRA doesn't just save memory — constraining updates to a low-rank subspace is itself a regularizer against catastrophic forgetting, which is why it tends to generalize better than full fine-tuning on small, narrow datasets.

intermediateModel Training & Fine-Tuning7 min+15 XP

QLoRA: Combining 4-Bit Quantization with Full-Precision Adapters

Question

How does QLoRA combine 4-bit quantization of frozen base weights with full-precision LoRA adapters to make fine-tuning large models feasible on a single GPU, and what specific technique (e.g., double quantization, paged optimizers) is doing the heavy lifting to prevent memory spikes during training?

intermediateModel Training & Fine-Tuning6 min+15 XP

Choosing a LoRA Rank: Expressiveness vs. Overfitting Trade-offs

Question

When choosing a LoRA rank (r) and target modules for a fine-tuning job, what is the practical trade-off between rank size, adapter expressiveness, and overfitting risk on a small domain-specific dataset?

intermediateInference Engineering7 min+15 XP

GPTQ vs. AWQ vs. GGUF: Choosing a Quantization Format for Your Hardware

Question

What are the fundamental differences in approach between GPTQ, AWQ, and GGUF-style quantization, and why would you pick one format over another based on your target hardware (GPU-only server vs. CPU/edge deployment) and acceptable accuracy loss?

intermediateInference Engineering6 min+15 XP

Quantization Accuracy Trade-offs: Why INT4 Hurts Reasoning More Than Fluency

Question

Why does quantizing a model to lower precision (e.g., INT4) degrade some capabilities (like precise numerical reasoning) more than others (like general fluency), and how would you empirically validate that a quantized model is still fit for your production use case rather than trusting benchmark averages?

intermediateAgentic Systems6 min+15 XP

Function Calling Internals: How Models Decide to Invoke a Tool

Question

Under the hood, how does a model "decide" to emit a function call rather than natural language, and what failure modes emerge in production when the tool schema is ambiguous, overly nested, or when two tools have overlapping semantic purpose?

intermediateAgentic Systems6 min+15 XP

Tool Call Error Handling: Preventing Hallucinated Results After a Failure

Question

When a tool call fails or returns an unexpected schema at runtime, what design patterns prevent the model from hallucinating a plausible-looking result instead of correctly reporting the failure back through the conversation?

intermediateRAG & Data Systems6 min+15 XP

RAG Context Stuffing: Why More Retrieved Chunks Can Hurt Answer Quality

Question

Why does naively increasing the number of retrieved chunks fed into the context window not monotonically improve RAG answer quality, and what evaluation methodology (e.g., faithfulness/groundedness scoring) would you use to detect when retrieval is actually hurting generation? *Transformer Internals, FlashAttention, KV Caching, Alignment (DPO/RLHF), Multimodal Architectures, Structured Outputs*

advancedArchitecture & Mathematics9 min+20 XP

FlashAttention: How Tiling and Online Softmax Cut Memory from O(N²) to O(N)

Question

How does FlashAttention reduce memory overhead from $O(N^2)$ to $O(N)$ and accelerate runtime using tiling and online softmax, without calculating the full attention matrix in High Bandwidth Memory (HBM)?

advancedInference Engineering9 min+20 XP

KV Cache Memory Bottleneck: How MQA and GQA Reduce Inference Footprint

Question

Explain the memory bottleneck introduced by the Key-Value (KV) Cache during the autoregressive decoding phase. How do Multi-Query Attention (MQA) and Grouped-Query Attention (GQA) trade off parameter overhead and retrieval quality to alleviate KV cache memory footprints?

advancedModel Training & Fine-Tuning8 min+20 XP

PPO vs. DPO: Architectural Differences in LLM Alignment Pipelines

Question

What are the mathematical and pipeline architectural differences between Proximal Policy Optimization (PPO)-based RLHF and Direct Preference Optimization (DPO)? Why does DPO eliminate the need for a separate reward model during training?

advancedArchitecture & Mathematics8 min+20 XP

Vision-Language Fusion: Projection Layers vs. Cross-Attention in Multimodal Models

Question

In vision-language models (e.g., LLaVA or Flamingo), how are continuous visual representations mapped into the textual embedding space, and what are the trade-offs between projection-layer architectures versus cross-attention fusion mechanisms?

advancedInference Engineering8 min+20 XP

Constrained Decoding: How Grammar Engines Enforce JSON Schema at the Token Level

Question

How do structured output engines (e.g., Outlines, Guidance) enforce JSON Schema or Context-Free Grammar (CFG) constraints at the token level during the forward pass logits calculation without retries or post-processing?

advancedRAG & Data Systems8 min+20 XP

Lost in the Middle: Why Long-Context Models Lose Track of Mid-Sequence Information

Question

What causes the "Lost in the Middle" phenomenon in ultra-long context windows ($100\text{k}+$ tokens), and what architectural or retrieval techniques (e.g., Semantic Chunking, Context Compression) mitigate performance degradation at high context fill rates?

advancedArchitecture & Mathematics8 min+20 XP

Sliding Window Attention: Bounding KV Cache While Preserving Long-Range Context

Question

How does Sliding Window Attention (SWA) bound the KV Cache memory footprint to a fixed window size $W$, and how can hidden states in layer $L$ still retain a theoretical receptive field of $L \times W$ tokens?

advancedArchitecture & Mathematics8 min+20 XP

Sparse MoE Routing: Top-k Gating and Load-Balancing Loss in Mixtral

Question

In Sparse Mixture-of-Experts (MoE) models (e.g., Mixtral), how does the top-$k$ gating router select active experts, and why is an auxiliary load-balancing loss required to prevent expert collapse during training?

advancedModel Training & Fine-Tuning7 min+20 XP

KTO vs. DPO: Aligning Models with Unpaired Binary Feedback

Question

How does Kahneman-Tversky Optimization (KTO) formulate alignment training using unaligned binary feedback (thumbs up / thumbs down) compared to DPO's requirement for pairwise preference datasets ($y_w \succ y_l$)?

advancedArchitecture & Mathematics9 min+20 XP

Speech-to-Speech LLMs: Aligning Audio Encoders with Discrete Tokens for Low-Latency Streaming

Question

How do end-to-end speech-to-speech multimodal models align continuous frame-level audio features from a speech encoder (e.g., Whisper) with discrete LLM target tokens, and how is streaming latency minimized during speech synthesis?

advancedInference Engineering7 min+20 XP

FP8 E4M3 vs. E5M2: Choosing the Right Format for Activations and Gradients

Question

Compare the FP8 format variants: `E4M3` (1 sign bit, 4 exponent bits, 3 mantissa bits) vs. `E5M2`. Why is `E4M3` preferred for neural network forward-pass activations/weights while `E5M2` is reserved for gradients?

advancedRAG & Data Systems8 min+20 XP

RAG Evaluation Metrics: Formulating Faithfulness and Context Precision with LLM-as-a-Judge

Question

How do automated RAG evaluation frameworks mathematically formulate Faithfulness (verifying response facts against retrieved context) and Context Precision, and how are bias/hallucination risks controlled when using LLM-as-a-Judge?

advancedArchitecture & Mathematics7 min+20 XP

Self-Attention Complexity: Why the Attention Matrix Drives Quadratic Memory Growth

Question

Derive why standard self-attention has O(n²) time and memory complexity with respect to sequence length, and explain precisely which intermediate tensor is responsible for the quadratic memory blowup during both training and naive inference.

advancedInference Engineering8 min+20 XP

FlashAttention: I/O-Aware Tiling for Faster, Memory-Efficient Attention

Question

How does FlashAttention achieve faster wall-clock performance and lower memory usage without changing the mathematical result of attention, and why is this fundamentally an I/O-aware algorithm (tiling and recomputation to minimize HBM reads/writes) rather than a reduction in FLOPs?

advancedInference Engineering8 min+20 XP

KV Cache and Memory Bandwidth: Why Decoding Becomes Bandwidth-Bound at Scale

Question

Explain why KV caching turns autoregressive decoding from a compute-bound problem into a memory-bandwidth-bound problem, and quantify (conceptually) how KV cache size scales with batch size, sequence length, number of layers, and hidden dimension — and why this becomes the dominant constraint on serving concurrency.

advancedInference Engineering7 min+20 XP

MQA vs. GQA: Trading Attention Quality for Smaller KV Caches

Question

How do Multi-Query Attention (MQA) and Grouped-Query Attention (GQA) reduce KV cache memory pressure compared to standard Multi-Head Attention, and what quality trade-off is being accepted in exchange for that memory savings?

advancedModel Training & Fine-Tuning9 min+20 XP

RLHF Pipeline: SFT, Reward Modeling, and PPO Against Reward Hacking

Question

Walk through the three-stage RLHF pipeline (SFT, reward model training, PPO optimization against the reward model) and explain specifically why PPO's clipped objective and KL-divergence penalty against the reference policy are necessary to prevent reward hacking.

advancedModel Training & Fine-Tuning8 min+20 XP

Direct Preference Optimization: Eliminating the Reward Model and RL Loop

Question

How does Direct Preference Optimization (DPO) eliminate the need for an explicit reward model and RL loop entirely, and what implicit assumption about the reward function does its loss derivation rely on — and in what scenarios does that assumption break down compared to full RLHF?

advancedModel Training & Fine-Tuning7 min+20 XP

Detecting Reward Hacking in Preference-Tuned Models Before Deployment

Question

In a production alignment pipeline, what concrete signs indicate a model is "reward hacking" against its preference-tuning objective (e.g., DPO or RLHF) rather than genuinely improving, and what evaluation setup would catch this before deployment?

advancedArchitecture & Mathematics8 min+20 XP

Vision-Language Fusion: Early Joint Embeddings vs. Late Cross-Attention Bridging

Question

In a typical vision-language model architecture, how do image patch embeddings from a vision encoder get aligned into the same representational space as text token embeddings, and what are the engineering trade-offs between early fusion (joint embedding space) and late fusion (cross-attention bridging separate towers)?

advancedArchitecture & Mathematics8 min+20 XP

MoE at Scale: Effective Capacity Gains and the Distributed Serving Costs They Introduce

Question

How does a Mixture-of-Experts (MoE) architecture achieve a larger effective parameter count without proportionally increasing inference compute, and what specific systems problems (routing imbalance, expert load skew, all-to-all communication overhead) does this introduce in distributed serving?

advancedInference Engineering7 min+20 XP

Grammar-Constrained Decoding: Guaranteeing Valid Structured Output at the Token Level

Question

How does grammar-constrained decoding (e.g., via a CFG or JSON schema compiled into a finite-state machine) guarantee valid structured output at the token level, and what is the performance cost of masking the logits at every decoding step compared to unconstrained generation with post-hoc validation/retry?