tezvyn:

LLMs & Generative AI

Large language models, chatbots, agents, prompt engineering

324 bites

More in LLMs & Generative AI — page 5

LLMs & Generative AI82 sec read

Securing tool-using LLM agents

WHAT IT TESTS: threat modeling for agentic LLMs. OUTLINE: name indirect prompt injection, data exfiltration, and unsafe tool execution, then defend with sandboxing, least-privilege scoped tools, input/output filtering, and human-in-the-loop on risky actions.

LLMs & Generative AI78 sec read

Hybrid search and re-ranking for retrieval

WHAT IT TESTS: knowledge of retrieval beyond plain vectors. OUTLINE: hybrid search fuses dense semantic and sparse keyword signals to catch exact terms dense misses; a cross-encoder re-ranker rescoring top-k boosts precision.

LLMs & Generative AI78 sec read

Evaluating a RAG system end to end

WHAT IT TESTS: ability to separate retrieval and generation quality. OUTLINE: measure retrieval with context recall or precision, and generation with faithfulness and answer relevance, attributing failures to the right stage.

LLMs & Generative AI85 sec read

Direct Preference Optimization explained

WHAT IT TESTS: understanding of DPO versus RLHF. OUTLINE: DPO reparameterizes the RLHF reward in terms of the policy itself, turning alignment into a simple classification loss on preference pairs with no separate reward model or PPO.

LLMs & Generative AI81 sec read

Reward models in RLHF and PPO

WHAT IT TESTS: understanding of the reward model in RLHF. OUTLINE: it learns from human preference comparisons to score responses, then supplies the reward signal that PPO maximizes while a KL penalty keeps the policy near the reference.

LLMs & Generative AI79 sec read

Pre-training versus fine-tuning an LLM

WHAT IT TESTS: grasp of the two-stage LLM training lifecycle. OUTLINE: pre-training is broad self-supervised next-token prediction on huge corpora at massive cost; fine-tuning adapts on small labeled data cheaply.

LLMs & Generative AI2 min read

Zero-Shot, Few-Shot, and Chain-of-Thought Trade-offs

WHAT IT TESTS: judgment about prompting strategies. OUTLINE: zero-shot is cheap but weak on reasoning, few-shot adds demos at token cost, CoT boosts multi-step accuracy but spends the most tokens and latency.

LLMs & Generative AI2 min read

FlashAttention and IO-Aware Attention

WHAT IT TESTS: hardware-aware optimization of attention. OUTLINE: FlashAttention is IO-aware, tiling and fusing attention in fast SRAM to avoid materializing the n-by-n matrix in slow HBM. RED FLAG: claiming it changes the math or lowers asymptotic compute.

LLMs & Generative AI2 min read

Causal versus Masked Language Modeling

WHAT IT TESTS: understanding LLM pre-training objectives. OUTLINE: pre-training learns general language from unlabeled text; CLM predicts the next token left-to-right, MLM predicts masked tokens using both sides.

LLMs & Generative AI2 min read

Layer Norm and Residuals in Transformer Blocks

WHAT IT TESTS: how Transformer blocks stay trainable at depth. OUTLINE: residuals preserve gradient flow, layer norm stabilizes activations per token, and it beats batch norm because it is independent of batch and sequence length.

LLMs & Generative AI2 min read

Why Multi-Head Attention

WHAT IT TESTS: rationale for splitting attention into heads. OUTLINE: multiple heads attend to different subspaces and relations in parallel, which one big head averages away. RED FLAG: claiming more heads is always better or that it raises total compute.

LLMs & Generative AI2 min read

Self-Attention versus Recurrent Architectures

WHAT IT TESTS: understanding self-attention and its edge over RNNs. OUTLINE: each token attends to all others via query-key-value, enabling parallelism and direct long-range links.

LLMs & Generative AI88 sec read

Attention in Sequence-to-Sequence Models

WHAT IT TESTS: why attention beats a fixed context vector. OUTLINE: attention computes per-step weighted sums over all encoder states, fixing the information bottleneck for long inputs. RED FLAG: describing attention but never naming the bottleneck it solves.

LLMs & Generative AI88 sec read

Vanishing Gradients and Why ReLU Helps

WHAT IT TESTS: grasp of deep-network training dynamics. OUTLINE: saturating activations shrink gradients across layers, ReLU's flat-one derivative preserves them. RED FLAG: confusing it with exploding gradients or ignoring ReLU's dead-neuron downside.

LLMs & Generative AI86 sec read

Hallucination Detection in LLMs

Hallucination detection is the set of techniques for flagging when a language model states something fluent but false or unsupported, using signals like self-consistency, model uncertainty, and grounding against retrieved evidence to catch fabrications before…

LLMs & Generative AI2 min read

Transformer Encoder-Decoder Architecture

The encoder-decoder Transformer maps an input sequence into rich contextual representations with an encoder, then a decoder generates output tokens autoregressively while attending to those representations via cross-attention, making it ideal for…

LLMs & Generative AI2 min read

Value Learning

Value learning is the AI-safety approach of having a system infer what humans actually value, rather than optimizing a hand-coded proxy, so that capable agents pursue goals aligned with human intent even in novel situations.

How does text guide Stable Diffusion via U-Net cross-attention?
LLMs & Generative AI2 min read

How does text guide Stable Diffusion via U-Net cross-attention?

Tests whether you know text embeddings condition the U-Net through cross-attention. Good answers explain that image features query text keys and values at every layer. Red flag: claiming the prompt is concatenated to the image latent.

LLMs & Generative AI2 min read

What is GAN mode collapse, its causes, and two mitigations?

WHAT IT TESTS: GAN dynamics and divergence. ANSWER OUTLINE: Define mode collapse as diversity loss to few modes; cite discriminator imbalance and lenient JS loss; give two fixes: WGAN and mini-batch discrimination.

LLMs & Generative AI2 min read

Explain Denoising Diffusion models and forward/reverse processes.

This tests if you see diffusion as iterative latent generation, not GANs. Forward: add Gaussian noise over T steps until data is pure noise. Reverse: a network iteratively denoises random noise into data.