Question 121 · Constitutional AI: Principled AI Alignment · hard
An Indian ed-tech startup is building a JEE study-assistant chatbot using Constitutional AI (Bai et al., 2022). In its RL-from-AI-Feedback (RLAIF) stage, a preference model — trained entirely on AI-generated comparisons rather than human labels — scores candidate responses on how well they follow a written constitution (e.g., "be genuinely helpful about exam stress without dismissing the student's anxiety or feeding it"). For one student's question, the chatbot drafts two responses, A and B. The constitutional preference model assigns them raw reward scores r_A = 2.3 and r_B = 1.1. Using the Bradley–Terry logistic preference model, P(A ≻ B) = σ(r_A − r_B), where σ(x) = 1/(1+e^(−x)). What is P(A ≻ B), and what does this value represent in the pipeline?
σ(r_A − r_B) = σ(1.2) ≈ 0.769: the preference model is about 77% confident A better satisfies the constitution, and this soft probability — produced without any human label — is exactly the target used to train the reward model during the RLAIF stage.
(r_A − r_B)/(r_A + r_B) = 1.2/3.4 ≈ 0.353: since this is below 0.5, the model actually favours B, and this normalized ratio serves as the loss weight during the self-critique-and-revision step of the supervised fine-tuning stage.
r_A/(r_A + r_B) = 2.3/3.4 ≈ 0.676: the preference probability scales directly with the raw reward magnitude of A rather than with the exponentiated difference between the two scores.
σ(r_A − r_B) ≈ 0.769 is numerically right, but Constitutional AI still requires human crowdworkers to rank A against B at this stage, so the resulting label is calibrated against human judgment rather than generated by the AI itself.
Answer: A. σ(r_A − r_B) = σ(1.2) ≈ 0.769: the preference model is about 77% confident A better satisfies the constitution, and this soft probability — produced without any human label — is exactly the target used to train the reward model during the RLAIF stage.
ExplanationThe reward difference is r_A − r_B = 2.3 − 1.1 = 1.2. Passing this through the logistic (sigmoid) function gives σ(1.2) = 1/(1 + e^(−1.2)). Since e^1.2 ≈ 3.320, e^(−1.2) ≈ 1/3.320 ≈ 0.301, so σ(1.2) = 1/(1 + 0.301) = 1/1.301 ≈ 0.769. This 76.9% is a soft, continuous preference probability — not a hard 0/1 label — and it comes entirely from the AI's own scoring against the written constitution, with no human ranking involved anywhere in this step. That is the defining move of Constitutional AI's RL-from-AI-Feedback stage: a model (guided by explicit principles) generates the comparison, a Bradley–Terry-style preference model converts the reward gap into a probability via the sigmoid, and that probability becomes the training signal for the reward model used in the subsequent RL fine-tuning — replacing the human-labeled comparisons that ordinary RLHF depends on for this stage. The normalized-ratio and raw-magnitude formulas swap the correct exponential (odds-based) relationship for a linear one, which breaks basic properties a preference probability must have, such as approaching 1 as the reward gap grows large rather than saturating at (r_A)/(r_A+r_B). Reintroducing human rankers at this stage also contradicts the premise that the preference model here runs on AI-generated comparisons, which is precisely what makes the pipeline more scalable and more consistently rule-governed than pure human-feedback RLHF.
Question 122 · Sparse Attention Mechanisms · hard
An Indian NLP startup is building a regional-language chatbot using a Sparse Transformer (Child et al.'s factorized attention) instead of full dense self-attention, on a context window of n = 4096 tokens. Instead of every token attending to all n tokens, each query token attends to keys through two separate sparse patterns: a "local" pattern, where it attends to the ℓ = ⌈√n⌉ tokens immediately preceding it within its block, and a "strided" pattern, where it attends to ℓ tokens spaced ℓ positions apart going back through the whole sequence. Both patterns are computed for every query and their results are combined. Working out ℓ, the total query-key pairs scored per layer under this scheme, and the total pairs scored under full dense self-attention, by what factor does the sparse scheme cut the number of query-key score computations per layer compared to full dense self-attention?
32-fold fewer computations: combining the local and strided patterns gives 2nℓ total query-key pairs versus n² for dense attention, a factor of n/(2ℓ) = √n/2.
64-fold fewer computations: the reduction factor equals n/ℓ, treating the single span ℓ = ⌈√n⌉ as if only one attention pattern were used per query.
4096-fold fewer computations: sparse attention lowers the per-layer computation from n² pairs down to just n pairs, since each query effectively attends to one 'representative' key.
8-fold fewer computations: the reduction factor scales as n^(1/4) rather than n^(1/2) once both attention patterns are combined, since combining two sub-quadratic patterns halves the exponent again.
Answer: A. 32-fold fewer computations: combining the local and strided patterns gives 2nℓ total query-key pairs versus n² for dense attention, a factor of n/(2ℓ) = √n/2.
ExplanationFull dense self-attention scores every query against every key, giving n² = 4096² = 16,777,216 query-key pairs per layer.
Since n = 4096 = 2^12 is a perfect square, ℓ = ⌈√n⌉ = √4096 = 64.
Each query participates in two sparse patterns:
- Local pattern: attends to ℓ = 64 nearby keys within its block, contributing n·ℓ = 4096 × 64 = 262,144 pairs across all queries.
- Strided pattern: attends to another ℓ = 64 keys spaced ℓ apart going back through the sequence, contributing another n·ℓ = 262,144 pairs.
Combined, the sparse scheme scores 2nℓ = 524,288 query-key pairs per layer — the O(n√n) cost that gives Sparse Transformers their efficiency, versus dense attention's O(n²).
The reduction factor is n² / (2nℓ) = n / (2ℓ) = 4096 / 128 = 32. Equivalently, since ℓ = √n, this is √n / 2 = 64 / 2 = 32. So the sparse scheme performs 32 times fewer query-key score computations per layer than full dense self-attention, while every token can still reach every other token within two layers (one hop through the local pattern, one through the strided pattern) — the key structural insight behind factorized sparse attention.
The tempting wrong answers correspond to real slip-ups: using only n/ℓ = 64 forgets that two independent attention patterns are computed and summed, not one; treating the savings as n = 4096-fold confuses linear-cost attention with the true O(n√n) scaling and would imply each query looks at essentially one key; and 8-fold reflects mixing up the exponent, applying n^(1/4) instead of the correct n^(1/2) relationship that emerges once both patterns are accounted for.
Question 123 · Retrieval-Augmented Generation: Building Knowledge-Enhanced AI Systems · hard
An Indian EdTech startup builds a RAG-based doubt-solving assistant for CBSE Class 12 Physics. When a student asks a question, the embedding model maps it to the query vector q = (1, 1, 1) in a (simplified) 3-dimensional space. The vector store holds three candidate chunks with embeddings Chunk 1 = (3, 0, 0), Chunk 2 = (1, 1, 0), and Chunk 3 = (0, 1, 3). The retriever ranks candidates by cosine similarity with q and passes the single top-ranked chunk to the LLM as grounding context before it generates an answer. Which chunk is retrieved, and what is its cosine similarity with q, rounded to three decimals?
Chunk 2 = (1, 1, 0) is retrieved, with cosine similarity ≈0.816, the highest of the three candidates.
Chunk 3 = (0, 1, 3) is retrieved, because it has the largest dot product with q (4), and retrieval ranks candidates by that dot product.
Chunk 1 = (3, 0, 0) is retrieved, because its cosine similarity with q, ≈0.577, is the highest among the three candidates.
Chunk 2 is retrieved because it has the smallest Euclidean distance from q, namely 1.0, and Euclidean distance always ranks embeddings identically to cosine similarity.
Answer: A. Chunk 2 = (1, 1, 0) is retrieved, with cosine similarity ≈0.816, the highest of the three candidates.
ExplanationCosine similarity is cos(θ) = (q·d)/(|q||d|), which measures only the angle between two vectors, not their length. Here |q| = √(1²+1²+1²) = √3 ≈ 1.732.
For Chunk 1 = (3, 0, 0): dot product with q is 1(3)+1(0)+1(0) = 3, and |Chunk 1| = √9 = 3, so cosine similarity = 3/(3 × 1.732) ≈ 0.577.
For Chunk 2 = (1, 1, 0): dot product is 1(1)+1(1)+1(0) = 2, and |Chunk 2| = √2 ≈ 1.414, so cosine similarity = 2/(1.414 × 1.732) ≈ 0.816.
For Chunk 3 = (0, 1, 3): dot product is 1(0)+1(1)+1(3) = 4, and |Chunk 3| = √10 ≈ 3.162, so cosine similarity = 4/(3.162 × 1.732) ≈ 0.730.
Ranked by cosine similarity, Chunk 2 (0.816) beats Chunk 3 (0.730) and Chunk 1 (0.577), so Chunk 2 is the chunk retrieved and passed to the LLM as grounding context.
Chunk 3 has both the largest raw dot product (4) and the largest magnitude (√10 ≈ 3.162) — this is exactly why a retriever that ranks by unnormalized dot product instead of true cosine similarity would wrongly favor it; large-magnitude embeddings (often from longer or more repetitive chunks) dominate raw inner-product scores even when they point in a less-aligned direction. Chunk 1's cosine similarity of 0.577 is computed correctly but is the lowest of the three, not the highest, so it cannot be the retrieved chunk. As for Euclidean distance, ‖q−d‖² = |q|² + |d|² − 2(q·d) depends on |d|² in addition to the dot product, while cosine similarity is scale-invariant in d — rescale any chunk's embedding and its Euclidean-distance rank can change even though its cosine similarity does not. The two metrics coincide only when every embedding is pre-normalized to unit length; here they merely happen to agree on the winning chunk by coincidence, not because they are the same computation.
Question 124 · Vision Transformers: Applying Transformer Architecture to Computer Vision · hard
A Vision Transformer processes 224×224 RGB images by splitting them into non-overlapping square patches, flattening each patch, and linearly projecting it into a token embedding before feeding the resulting sequence to the self-attention layers, whose dominant cost — computing the QK^T score matrix — scales as O(N² · d_k) for N patch tokens and a fixed per-head dimension d_k. If the patch size is reduced from 16×16 to 8×8 while the image resolution stays at 224×224, and the class token is ignored for this estimate, by what factor does the QK^T computation cost increase?
16×, since patches quadruple (14→28 per side) and squaring that quadrupling under O(N²) attention scaling yields 16× the QK^T compute.
4×, since the token count itself only quadruples when patch resolution doubles, and this quadrupling is the full answer without any additional squaring.
8×, since halving the patch side length effectively cubes the number of tokens entering the attention block, matching an O(N³) growth in QK^T cost.
2×, since self-attention cost is proportional to N rather than N², so doubling patches per side merely doubles the QK^T computation.
Answer: A. 16×, since patches quadruple (14→28 per side) and squaring that quadrupling under O(N²) attention scaling yields 16× the QK^T compute.
ExplanationFor a 224×224 image, the number of patches along one side equals image size divided by patch size. With 16×16 patches, that is 224/16 = 14 patches per side, giving 14² = 196 total patch tokens. Shrinking the patch to 8×8 doubles the patches per side to 224/8 = 28, so the total patch count becomes 28² = 784 — a 784/196 = 4× increase in the token count N. Computing the QK^T attention score matrix requires comparing every token against every other token, so its cost scales as O(N² · d_k) for a fixed per-head dimension d_k. Squaring the 4× growth in N gives 4² = 16, so the QK^T computation becomes sixteen times more expensive, not merely four, eight, or two times. This double-squaring effect — patch count grows as the inverse square of patch size, and attention cost then grows as the square of patch count — is exactly why ViTs use relatively coarse patches such as 16×16 rather than pixel-level tokens: halving the patch side length does not just double the workload, it multiplies it by sixteen, which is also why the original ViT paper reports steep FLOP increases for its smaller-patch variants (e.g. ViT-B/16 versus ViT-B/8).
Question 125 · Multimodal Training: Unified Vision-Language Models and Cross-Modal Alignment · hard
An AI team building an ISRO Bhuvan-style satellite-image captioning tool trains a CLIP-style vision-language model with the InfoNCE contrastive objective: L = −log[ exp(sim(i,t⁺)/τ) / Σⱼ exp(sim(i,tⱼ)/τ) ]. In one training batch there are 3 image–caption pairs. All embeddings are L2-normalized, and satellite image i₀'s cosine similarities with the three captions are: t₀ (its true matching caption) = 0.8, t₁ = 0.3, t₂ = 0.5. Using the standard temperature τ = 0.1, what is the InfoNCE loss contribution from row i₀, and what reasoning correctly produces it?
≈ 0.055 nats, obtained by scaling each cosine similarity by 1/τ to get logits (8, 3, 5), then applying softmax over all three and taking the negative log of the probability assigned to the matching caption t₀
≈ 0.853 nats, obtained by applying softmax directly to the raw cosine similarities (0.8, 0.3, 0.5) without dividing by τ, then taking the negative log of the matching-caption probability
≈ 1.072 nats, obtained by multiplying each cosine similarity by τ instead of dividing by it, giving logits (0.08, 0.03, 0.05), then applying softmax and taking the negative log of the matching-caption probability
≈ 0.040, obtained by treating the loss as the squared distance (1 − cos similarity)² between image i₀ and its matching caption embedding, ignoring the other two captions in the batch entirely
Answer: A. ≈ 0.055 nats, obtained by scaling each cosine similarity by 1/τ to get logits (8, 3, 5), then applying softmax over all three and taking the negative log of the probability assigned to the matching caption t₀
ExplanationThe temperature τ controls how sharply softmax separates the similarities into a probability distribution, and it must divide the similarities, not multiply them. Dividing by τ = 0.1 turns the cosine similarities (0.8, 0.3, 0.5) into logits (8, 3, 5) — a much wider spread than the raw values, which is exactly the point of a small τ: it sharpens the model's confidence signal during training.
Applying softmax to these logits: e⁸ ≈ 2980.96, e³ ≈ 20.09, e⁵ ≈ 148.41, summing to ≈ 3149.46. The probability mass on the matching caption t₀ is 2980.96 / 3149.46 ≈ 0.9465. The InfoNCE loss for this row is the negative log of that probability: −ln(0.9465) ≈ 0.055 nats — a small loss, correctly reflecting that the model already assigns high confidence to the true image-caption pair.
Skipping the 1/τ scaling and feeding raw cosine similarities straight into softmax flattens the distribution far too much (probabilities cluster near uniform), which is why that path yields a much larger loss of ≈ 0.853 — it understates the model's actual confidence and would generate a misleadingly large gradient signal. Multiplying by τ instead of dividing does the opposite mistake: it compresses the logits toward zero (0.08, 0.03, 0.05), pushing the softmax distribution close to uniform among 3 classes and yielding an even larger loss of ≈ 1.072, wrongly suggesting the model model is barely better than chance. Both of these come from inverting or omitting the role of temperature as a divisor of the logits.
The squared-distance approach (1 − 0.8)² = 0.04 reflects a completely different objective — a regression-style embedding-matching loss used in some metric-learning setups — but it is not what InfoNCE computes: contrastive vision-language pretraining is fundamentally a classification problem (pick the correct caption out of the batch), not a distance-regression problem, so it must route through softmax over all candidates in the batch rather than looking at the matching pair in isolation.
Question 126 · Model Merging: Combining Multiple Fine-Tuned Models and TIES/DARE Methods · hard
A Bengaluru fintech is building one deployable assistant by merging three LoRA-fine-tuned copies of the same base LLM: Model A (specialized for UPI dispute triage), Model B (IRCTC ticket-query support), and Model C (KYC document parsing). They use TIES-Merging with merging coefficient λ = 1. At a specific attention-output weight, the task vectors (fine-tuned weight minus base weight) have already survived the top-k magnitude trimming step: Model A = +0.9, Model B = −0.2, Model C = −0.2. The base pretrained weight at this position is 2.0. TIES elects the sign whose total magnitude (sum of signed values) across the three task vectors is larger, then performs a disjoint merge by averaging only the values whose sign matches the elected sign, dividing by the number of models that agree. What is the final merged weight at this position?
2.9 — the elected sign is positive because the positive total (0.9) outweighs the negative total (0.4), so the disjoint merge keeps only Model A's +0.9, giving a merged task vector of 0.9/1 = 0.9 added to the base weight of 2.0.
2.17 — TIES simply averages all three task vectors together as (0.9 − 0.2 − 0.2)/3 ≈ 0.17 without any sign election, then adds this to the base weight of 2.0.
1.8 — since two of the three models (B and C) carry a negative value at this position, majority vote elects a negative sign, so the disjoint merge averages only B and C's −0.2 values to get −0.2, added to the base weight of 2.0.
2.3 — the elected sign is correctly positive, but the disjoint merge divides Model A's surviving +0.9 by the total number of merged models (3) rather than by the number of models agreeing with the elected sign, giving 0.9/3 = 0.3 added to the base weight of 2.0.
Answer: A. 2.9 — the elected sign is positive because the positive total (0.9) outweighs the negative total (0.4), so the disjoint merge keeps only Model A's +0.9, giving a merged task vector of 0.9/1 = 0.9 added to the base weight of 2.0.
ExplanationTIES-Merging's elect-sign step compares the total magnitude of positive versus negative contributions at each parameter, not a simple headcount: here the positive total is |0.9| = 0.9 while the negative total is |−0.2| + |−0.2| = 0.4, so the elected sign is positive even though two of the three models point negative. This magnitude-weighted election matters precisely because a single decisively fine-tuned model (Model A) should not be outvoted by two models that barely moved away from the base weight — resolving exactly this kind of interference is what TIES is designed for. The disjoint merge step then keeps only the task-vector values whose sign agrees with the elected sign (Model A's +0.9) and sets aside the disagreeing ones entirely (Model B and C's −0.2 values are excluded, not averaged in), dividing by the count of agreeing models, which is 1: merged task vector = 0.9 / 1 = 0.9. Adding this to the base pretrained weight of 2.0 with merging coefficient λ = 1 gives a final merged weight of 2.0 + 0.9 = 2.9. This result differs sharply from naive parameter averaging (which would blend in the conflicting −0.2 values and dilute Model A's specialization) and from DARE, which instead of electing signs randomly drops a fraction p of each task vector's entries and rescales the survivors by 1/(1−p) — an unbiased-estimator correction — to keep the expected value unchanged before any averaging or TIES-style merging is applied.
Question 127 · AI for Scientific Discovery: AlphaFold, Climate Modeling, and Materials Science Applications · hard
AlphaFold2's Evoformer block maintains a pair representation of shape (N_res, N_res, c) that encodes a learned relationship between every pair of amino acid residues in a protein chain. Its triangular multiplicative update refines each entry of this array by summing an interaction term over a third residue index k (running from 1 to N_res) before passing the array to the next block — so the operation touches all combinations of residue indices i, j, and k. DeepMind trained AlphaFold2's triangular update layers using a residue crop of N_res = 384. Suppose a research group at IIT Bombay instead runs the same triangular multiplicative update layer, without cropping, on a large multi-domain protein of N_res = 1536 residues — exactly 4 times the crop length. By what factor does the computational cost of that single layer increase, relative to running it on the 384-residue crop?
By a factor of 4 — AlphaFold2's triangular update has time complexity that scales linearly with the residue count, O(N_res).
By a factor of 16 — the pair representation's O(N_res^2) memory footprint is often (incorrectly) assumed to also govern the triangular update's runtime, giving quadratic scaling.
By a factor of 64 — the triangular multiplicative update sums over a third residue index k in addition to the pair indices i and j, giving cubic time complexity, O(N_res^3).
By a factor of 256 — treating the channel dimension c as a fourth residue-sized index alongside i, j, and k yields quartic time complexity, O(N_res^4).
Answer: C. By a factor of 64 — the triangular multiplicative update sums over a third residue index k in addition to the pair indices i and j, giving cubic time complexity, O(N_res^3).
ExplanationThe triangular multiplicative update computes, for every pair of residues (i, j), a sum over a third residue index k that also ranges across all N_res residues. This gives N_res choices for i, N_res choices for j, and N_res choices for k, so the operation count scales as O(N_res) x O(N_res) x O(N_res) = O(N_res^3). Scaling N_res from 384 to 1536 multiplies the residue count by 1536 / 384 = 4. Because the cost scales with the cube of N_res, the compute multiplies by 4^3 = 4 x 4 x 4 = 64, not by 4 (that would require linear scaling) or 16 (that is the scaling exponent for the pair representation's memory footprint, O(N_res^2), which is a genuinely quadratic cost but a different quantity from this layer's runtime). It is also not 256, since the channel dimension c is a fixed architectural constant, not a residue-sized index that grows with N_res, so it does not add a fourth power of N_res to the scaling. This cubic runtime bottleneck is exactly why AlphaFold2 trains its triangular attention and multiplicative update layers on cropped sequences of 384 residues rather than full sequences, and why full-length inference on very large, uncropped multi-domain proteins is disproportionately expensive per layer compared to the pair representation's storage cost.
Question 128 · Inference Optimization: KV Cache, Speculative Decoding, and Batching Strategies · hard
AICI's server deployment for an IRCTC-style Hindi/English support chatbot runs a 7B-parameter transformer with 32 transformer layers, 32 attention heads per layer, and a head dimension of 128 (so hidden size = 32 × 128 = 4096). To avoid recomputing attention scores at every decoding step, the engineering team caches every past token's key and value vectors in FP16 (2 bytes per number). The GPU is currently serving a batch of 8 concurrent user sessions, each holding a context of 2048 tokens (prompt plus generated tokens so far). What is the total KV cache memory footprint, in GiB?
16 GiB — this follows if key and value tensors are stored in FP32 instead of FP16, doubling the FP16-based footprint to guarantee numerical stability during autoregressive decoding.
8 GiB — combining the factor of 2 for storing both keys and values, all 32 layers, the 4096-wide head configuration, the 2048-token context, the 8-way batch, and 2 bytes per FP16 number.
1 GiB — this is the correct footprint for a single 2048-token sequence on its own, but it ignores that the GPU must hold one full KV cache per session across all 8 concurrent users.
4 GiB — this results from caching only the key tensors (or only the value tensors) and omitting the other half of the attention state that autoregressive decoding also requires.
Answer: B. 8 GiB — combining the factor of 2 for storing both keys and values, all 32 layers, the 4096-wide head configuration, the 2048-token context, the 8-way batch, and 2 bytes per FP16 number.
ExplanationBuilding the KV cache size from first principles removes any guesswork. During generation, a transformer caches, for every past token, at every layer, one key vector and one value vector of length (num_heads × head_dim). The standard per-token cost is:
2 (for K and V) × n_layers × n_heads × d_head × bytes_per_element
Plugging in this model's shape — n_layers = 32, n_heads = 32, d_head = 128 (giving hidden size 4096, matching a real 7B-class architecture), FP16 → 2 bytes:
2 × 32 × 32 × 128 × 2 bytes = 524,288 bytes = 512 KiB per token, per sequence
For a 2048-token context:
512 KiB × 2048 = 1,048,576 KiB = 1024 MiB = 1 GiB per sequence
For the full batch of 8 concurrent sessions, each needing its own independent cache:
1 GiB × 8 = 8 GiB total
This is exactly the formula production serving engines like vLLM use to size their KV cache pool, and it's why batching — while great for GPU throughput, since it amortizes weight-loading cost across more tokens per forward pass — has a hard ceiling: cache memory grows linearly with batch size, context length, layer count, and head width all at once. Halving the factor of 2 (dropping either K or V) understates the cache by half; assuming FP32 storage overstates it by 2×; and computing only a single sequence's cache while forgetting to scale by the batch dimension understates it by a full factor of 8. None of those shortcuts reflect what the GPU actually has to hold resident in memory while serving all 8 users concurrently.
Question 129 · Large Language Model Fine-tuning and LoRA · hard
An Indian AI startup wants to fine-tune a 7-billion-parameter open-weight multilingual language model (similar in scale to models used in Bhashini-style translation pipelines) to specialize in summarizing Hindi legal judgments, but has only a single consumer GPU with limited memory. Instead of full fine-tuning, they use LoRA (Low-Rank Adaptation), applying rank-16 adapters to all four attention projection matrices (W_q, W_k, W_v, W_o) in every one of the model's 32 transformer layers. Each of these matrices has shape 4096 × 4096. LoRA freezes the original matrix W and learns only a low-rank update ΔW = BA, where B ∈ R^(4096×16) and A ∈ R^(16×4096). Approximately what percentage of the model's total 7 billion parameters does LoRA actually train?
About 0.24% of the model's parameters are trained, since each adapter contributes r(d+k) = 16 x 8192 = 131,072 parameters, and 128 such adapters (4 matrices x 32 layers) total 16,777,216 trainable parameters out of 7 billion.
About 0.06% of the model's parameters are trained, since it is enough to attach one LoRA adapter per layer to influence the whole attention block, giving 131,072 x 32 = 4,194,304 trainable parameters.
About 0.12% of the model's parameters are trained, since only the down-projection matrix B actually holds learnable weights, so each adapter contributes r x d = 65,536 parameters rather than r(d+k).
About 30.7% of the model's parameters are trained, since gradients still flow through the full frozen matrix during backpropagation, so the relevant count is d x k = 16,777,216 per matrix across all 128 targeted matrices.
Answer: A. About 0.24% of the model's parameters are trained, since each adapter contributes r(d+k) = 16 x 8192 = 131,072 parameters, and 128 such adapters (4 matrices x 32 layers) total 16,777,216 trainable parameters out of 7 billion.
ExplanationEach frozen 4096x4096 matrix gets a LoRA adapter built from two thin matrices, B in R^(4096x16) and A in R^(16x4096). Their entry counts are 4096x16 = 65,536 for B and 16x4096 = 65,536 for A, summing to 131,072 — this is exactly the general formula r(d+k) for a rank-r adapter on a d x k matrix, not r x d x k and not d x k. The startup applies a separate adapter to all four attention projections (W_q, W_k, W_v, W_o), and it does this independently in every one of the 32 layers, so there are 4 x 32 = 128 adapters in total. Total trainable parameters are therefore 131,072 x 128 = 16,777,216. Dividing by the model's 7,000,000,000 parameters gives 16,777,216 / 7,000,000,000 ≈ 0.0024, i.e. about 0.24%. This tiny fraction is exactly why LoRA works on a single consumer GPU: W itself never receives a gradient update (it stays frozen in forward and backward passes), so the optimizer only needs to store momentum and variance terms for roughly a quarter of one percent of the parameters instead of for all 7 billion, cutting the memory footprint enough to fine-tune a 7B model on hardware that could never hold full-parameter Adam states for it.
Question 130 · Dataset Curation and Data Quality · hard
A large language model pretraining pipeline for an Indian-languages corpus performs near-duplicate detection before splitting data into train and test sets, to prevent test-set leakage. The curation script builds a set of contiguous 3-word shingles for each record and flags a pair as a near-duplicate (to be removed) whenever their Jaccard similarity is at least 0.8. Two candidate records are being compared:
Record P: "the Indian Space Research Organisation launched Chandrayaan three successfully"
Record Q: "the Indian Space Research Organisation launched Chandrayaan three successfully today"
Using 3-word shingles built from each record's word sequence, what is the Jaccard similarity between Record P and Record Q, and what decision does the pipeline make?
Jaccard = 7/8 = 0.875; since 0.875 is at least 0.8, the pair is flagged as a near-duplicate and removed before the train/test split.
Jaccard = 7/15 ≈ 0.467; since 0.467 is below 0.8, the pair is not flagged and both records are kept in their respective splits.
Jaccard = 7/7 = 1.0; since 1.0 is at least 0.8, the pipeline treats the two records as exact duplicates and discards Record Q entirely.
Jaccard = 9/10 = 0.9; since 0.9 is at least 0.8, the pair is flagged as a near-duplicate based on shared unigrams (single words) rather than 3-word shingles.
Answer: A. Jaccard = 7/8 = 0.875; since 0.875 is at least 0.8, the pair is flagged as a near-duplicate and removed before the train/test split.
ExplanationTreat each record as a sequence of words and build the set of all contiguous 3-word shingles — a standard technique used in large-scale corpus deduplication (for example before splitting pretraining data into train and test sets, to stop test items from leaking into training). Record P has 9 words, so it yields 9 minus 3 plus 1 = 7 shingles: {the-Indian-Space, Indian-Space-Research, Space-Research-Organisation, Research-Organisation-launched, Organisation-launched-Chandrayaan, launched-Chandrayaan-three, Chandrayaan-three-successfully}. Record Q has 10 words (it appends "today"), giving 10 minus 3 plus 1 = 8 shingles: the same 7 shingles as Record P, plus one new one, three-successfully-today. Every shingle of Record P appears in Record Q, so the intersection has 7 elements; since Record P's shingle set is a subset of Record Q's, the union is exactly Record Q's set, with 8 elements. Jaccard similarity = |intersection| / |union| = 7/8 = 0.875. Because 0.875 is at least the 0.8 threshold, the pipeline flags the pair as a near-duplicate and removes one copy before the train/test split.
The other values come from genuine curation mistakes. Adding the set sizes without subtracting the intersection gives a false union of 7 + 8 = 15, producing 7/15 ≈ 0.467 and wrongly letting the pair pass as safe. Dividing by the smaller set's size instead of the true union computes the overlap (Szymkiewicz-Simpson) coefficient, not Jaccard, and overstates similarity as 7/7 = 1.0 — this would misclassify a partial overlap as an exact duplicate and discard useful data. Comparing unigram (single-word) sets instead of order-sensitive 3-word shingles gives 9 unique words in common out of 10 unique words total, or 9/10 = 0.9; this bag-of-words score ignores word order entirely, so it cannot distinguish a genuine near-duplicate from an unrelated sentence that merely reuses the same nine words in shuffled order — exactly the failure mode shingling is designed to avoid.
Question 131 · Compute Governance and AI Safety · hard
A frontier AI lab trains a transformer language model with 1.8 trillion parameters (N) on a corpus of 13 trillion tokens (D). Using the standard training-compute approximation C ≈ 6ND — which decomposes into roughly 2ND FLOPs for the forward pass and 4ND FLOPs for the backward pass (gradients with respect to both activations and weights) — estimate the total training compute. The EU AI Act's Article 51 creates a rebuttable presumption of "systemic risk" for a general-purpose AI model once its cumulative training compute exceeds 10^25 FLOPs. Does this model cross that threshold, and by what factor?
≈1.4×10^26 FLOPs, exceeding the Article 51 threshold by a factor of about 14
≈2.3×10^25 FLOPs, exceeding the Article 51 threshold by a factor of about 2 (from taking C = N × D and dropping the factor-of-6 multiplier for combined forward-and-backward-pass arithmetic)
≈4.7×10^25 FLOPs, exceeding the Article 51 threshold by a factor of about 5 (from taking C = 2ND, which counts only forward-pass FLOPs and omits the backward pass)
≈1.4×10^23 FLOPs, remaining below the Article 51 threshold (from an exponent slip that treats one 'trillion' as 10^9 rather than 10^12 when converting one of the two quantities)
Answer: A. ≈1.4×10^26 FLOPs, exceeding the Article 51 threshold by a factor of about 14
ExplanationConvert both quantities to scientific notation first: N = 1.8×10^12 parameters, and 13 trillion tokens is D = 1.3×10^13 (not 13×10^13 — "trillion" is already 10^12, so 13 trillion = 13×10^12 = 1.3×10^13).
Apply the compute rule C ≈ 6ND. This factor of 6 isn't arbitrary: a forward pass through a dense transformer costs about 2ND FLOPs (one multiply and one add per parameter per token), and backpropagation costs roughly twice the forward pass — about 4ND FLOPs — because gradients must be computed with respect to both the layer activations and the weights. Summing 2ND + 4ND gives the 6ND convention used in scaling-law papers (Kaplan et al., 2020) and in the compute-accounting methodology behind both the US and EU compute-based governance thresholds.
C = 6 × (1.8×10^12) × (1.3×10^13) = 6 × 2.34×10^25 = 14.04×10^25 = 1.404×10^26 FLOPs, which rounds to ≈1.4×10^26 FLOPs.
Comparing against the Article 51 threshold of 10^25 FLOPs: 1.404×10^26 / 10^25 = 14.04, so the model's training run used roughly 14 times the compute needed to trigger the systemic-risk presumption — nowhere near a borderline case.
The three wrong figures come from real accounting slips rather than arbitrary numbers. Using C = ND instead of 6ND (forgetting that both a forward and a backward pass are needed to train, not just run, the network) understates compute by exactly 6× and gives 2.34×10^25 — a factor of about 2 over threshold instead of 14. Using C = 2ND counts only the forward pass and misses backpropagation entirely, giving 4.68×10^25 — a factor of about 5. And mis-converting one "trillion" as 10^9 instead of 10^12 (an easy slip when Indian usage of "lakh crore" and Western "trillion" scales get mixed up while converting units) shrinks the answer by a further 1000×, wrongly placing the model two orders of magnitude below the threshold instead of above it.
This kind of order-of-magnitude compute estimate is exactly what compute-governance regimes rely on: India's own IndiaAI Mission GPU infrastructure and any Indian lab training models at frontier scale for export or deployment in the EU market would need to run this same 6ND calculation to know which regulatory tier they fall into before training even finishes.
Question 132 · Neuromorphic Computing and Spiking Neural Networks · hard
A neuromorphic edge-vision chip built for a smart traffic-camera node (in the spirit of Intel's Loihi architecture) uses time-to-first-spike coding: each pixel's brightness sets a constant input current to a hardware Leaky Integrate-and-Fire (LIF) neuron, so brighter pixels fire sooner. The neuron's membrane potential obeys τ(dV/dt) = -V + RI, with time constant τ = 10 ms, reset/resting potential V(0) = 0 mV, firing threshold V_th = 10 mV, and a pixel-driven current giving steady-state depolarization RI = 40 mV. After each spike, V resets instantly to 0 mV while the current stays constant. What is the time to the neuron's first spike after current onset, and what steady-state firing rate does this correspond to?
t ≈ 10 ms and firing rate ≈ 100 Hz, since the membrane time constant itself sets the interspike interval regardless of how close V_th is to RI
t ≈ 2.5 ms and firing rate ≈ 400 Hz, since V rises linearly at rate RI/τ under constant current until it hits V_th, as in a leak-free integrate-and-fire neuron
t ≈ 2.88 ms and firing rate ≈ 347.6 Hz, obtained by solving V(t) = RI(1 - e^(-t/τ)) = V_th for t and taking the reciprocal of that interspike interval
t ≈ 13.86 ms and firing rate ≈ 72.1 Hz, obtained by setting e^(-t/τ) equal to the threshold-to-depolarization ratio V_th/RI instead of one minus that ratio
Answer: C. t ≈ 2.88 ms and firing rate ≈ 347.6 Hz, obtained by solving V(t) = RI(1 - e^(-t/τ)) = V_th for t and taking the reciprocal of that interspike interval
ExplanationThe governing equation τ(dV/dt) = -V + RI is a first-order linear ODE. With V(0) = 0 and RI held constant, its solution is V(t) = RI·(1 - e^(-t/τ)) — the membrane depolarizes toward the asymptote RI, slowing down as it approaches that value because the leak term -V grows and cancels more of the driving current RI. This exponential approach, not a straight-line rise, is exactly what "leaky" means in LIF: a true leak-free (pure) integrate-and-fire neuron would instead climb linearly at the initial rate RI/τ = 40/10 = 4 mV/ms and reach V_th = 10 mV at t = 2.5 ms — a real but distinct model.
To find the first-spike time here, set V(t) = V_th and solve for t:
10 = 40·(1 - e^(-t/10))
1 - e^(-t/10) = 10/40 = 0.25
e^(-t/10) = 0.75
-t/10 = ln(0.75) = -0.287682
t = 2.8768 ms ≈ 2.88 ms
Note the subtraction from 1 in the third line is essential: e^(-t/τ) equals the *remaining* fraction of the gap to threshold (0.75), not the threshold-to-depolarization ratio V_th/RI = 0.25 itself. Swapping those two — solving e^(-t/τ) = V_th/RI — gives t = -10·ln(0.25) = 13.86 ms, a common algebra slip when inverting the closed-form LIF solution.
Because the neuron resets exactly to 0 mV after each spike and the current stays fixed at the same value, the membrane trajectory after every reset is an identical copy of the one from t = 0: the interspike interval is therefore exactly t = 2.8768 ms for every subsequent spike too, not just the first. The firing rate is the reciprocal of this interval:
f = 1/t = 1/(2.8768 × 10⁻³ s) ≈ 347.6 Hz
This 347.6 Hz is the rate the chip's downstream circuitry would read off that pixel's spike train — brighter pixels (larger RI) push V_th/RI down further, shrink t further, and raise the firing rate further, which is precisely the mechanism that lets time-to-first-spike coding represent brightness with a single spike's latency. Treating τ as if it were the interspike interval on its own (giving 10 ms and 100 Hz) ignores this dependence on V_th and RI entirely, and would make the coding scheme blind to brightness altogether.
Question 133 · Embodied AI and Embodied Learning · hard
A robotic arm at a Bengaluru fulfillment centre is being trained with reinforcement learning to pick packages off a shelf and place them on a conveyor belt. Future rewards are discounted with γ = 0.95 per environment time-step, and the value of a reward is always measured as seen from the decision point s₀ where the action was chosen.
For a disembodied benchmark agent working in the same MDP formalism, an action and its resulting reward are treated as an atomic one-step transition: it selects "pick up the package" at s₀ and the reward r = 100 is realized at t = 1, contributing γ^1·r to the value at s₀.
The physical robotic arm cannot skip straight to the outcome — it must move through a sequence of low-level motor commands (reach, align the gripper, close the fingers, lift) before the pickup is registered as complete. This takes 8 environment time-steps, so its reward of r = 100 is realized at t = 8, contributing γ^8·r to the value at s₀.
Comparing the two discounted reward contributions at s₀, by roughly what percentage is the embodied robot's learning signal weaker than the disembodied benchmark's?
Not reduced at all, since both agents receive the identical reward of 100 for completing the same logical pickup action, so the elapsed time makes no difference to the signal.
About 5% weaker, since the extra physical time-steps simply add a single further discount factor of (1 − γ) on top of the disembodied agent's own one-step discount.
About 30% weaker, since the seven-step gap between the two rewards compounds multiplicatively as γ^7 ≈ 0.698, so only around 70% of the disembodied signal strength survives to reach the decision point.
About 34% weaker, since raising the discount factor to the eighth power directly, γ^8 ≈ 0.663, is taken to represent the full gap between the two agents' rewards.
Answer: C. About 30% weaker, since the seven-step gap between the two rewards compounds multiplicatively as γ^7 ≈ 0.698, so only around 70% of the disembodied signal strength survives to reach the decision point.
ExplanationBoth rewards equal r = 100, so what matters is not their magnitude but the ratio of the discount factors applied to them: (γ^8·r) / (γ^1·r) = γ^7. Computing this step by step, γ^2 = 0.9025, γ^4 = 0.9025² = 0.81450625, γ^6 = γ^4·γ^2 = 0.735091890625, and γ^7 = γ^6·γ = 0.69833729609375 ≈ 0.698. So about 69.8% of the disembodied signal strength still reaches s₀ for the embodied robot, a reduction of 1 − 0.698 ≈ 0.302, i.e. roughly 30%.
This is the quantitative core of why embodied learning is a harder credit-assignment problem than disembodied, symbolic learning: physical embodiment forces a single semantic action to unfold over many real sensorimotor time-steps — the reach-grasp-lift sequence cannot be compressed to one step — and because RL discounting is multiplicative per time-step, every additional physical step compounds the attenuation rather than simply adding to it. Computing γ^8 directly (≈0.663, a ≈34% drop) double-counts by ignoring that the disembodied benchmark already carries its own one-step discount, so the correct comparison needs the ratio γ^7, not the raw γ^8. Treating the gap as a single extra factor of (1 − γ) = 5% mistakes multiplicative compounding across seven steps for linear subtraction of one. And claiming no reduction at all misses that discounting operates on elapsed time-steps, not on the semantic identity of the action — which is exactly the property that separates an embodied agent, bound by real sequential physical dynamics, from a disembodied one that can treat an action as instantaneous.
Question 134 · Code Generation and AI Programming Assistants · hard
GitHub Copilot–style code assistants are benchmarked with the pass@k metric introduced in OpenAI's Codex paper: for each problem the model draws n independent code samples (via temperature sampling), and pass@k asks whether at least one of k samples drawn from that pool of n passes all unit tests. Because directly re-sampling many k-subsets is expensive, the paper uses the unbiased estimator
```
pass@k = 1 − C(n−c, k) / C(n, k)
```
where c is the number of samples (out of the n generated) that actually passed every unit test, and C(a, b) denotes "a choose b". For a particular LeetCode-style problem, a model generates n = 10 code samples at temperature 0.8, and c = 3 of them pass every unit test. What is pass@5 for this problem, i.e., the estimated probability that at least one of 5 samples drawn from this pool of 10 passes?
≈ 91.7% (pass@5 = 1 − C(7,5)/C(10,5) = 1 − 21/252 = 11/12), the correct unbiased estimator that treats the k samples as drawn without replacement from the fixed pool of n
≈ 83.2% (using 1 − (1 − 3/10)^5), treating each of the 5 chosen samples as an independent Bernoulli trial with success probability c/n instead of sampling without replacement
30%, since pass@k should simply equal the fraction of the n generated samples that passed all unit tests, c/n, regardless of the value of k
≈ 8.3% (C(7,5)/C(10,5) = 21/252), the probability that none of the 5 chosen samples pass, mistakenly reported as pass@k itself
Answer: A. ≈ 91.7% (pass@5 = 1 − C(7,5)/C(10,5) = 1 − 21/252 = 11/12), the correct unbiased estimator that treats the k samples as drawn without replacement from the fixed pool of n
ExplanationThe unbiased pass@k estimator counts, among the C(10,5) = 252 equally likely ways to choose 5 of the 10 generated samples, how many of those 5-subsets contain zero passing samples, then subtracts that fraction from 1. A subset with zero passing samples must be drawn entirely from the n − c = 7 failing samples, so there are C(7,5) = 21 such all-failing subsets. The probability that a random 5-sample subset contains no passing sample is therefore 21/252 = 1/12. Hence pass@5 = 1 − 1/12 = 11/12 ≈ 91.7%. This hypergeometric-style combinatorial approach is essential because the k evaluated samples are drawn without replacement from a fixed, already-generated pool of n completions — the model doesn't regenerate fresh samples for each hypothetical k-subset. Treating the draws as independent Bernoulli trials with replacement instead, via 1 − (1 − c/n)^5 = 1 − 0.7^5 ≈ 83.2%, systematically underestimates the true pass@k whenever c/n isn't small, since it ignores that removing a failing sample from the pool makes the remaining draws more likely to hit one of the c passing samples. Reporting c/n = 30% directly conflates pass@k with plain single-sample accuracy and discards the "at least one of k" structure that makes pass@k useful for evaluating code assistants that can be queried multiple times. Reporting C(7,5)/C(10,5) ≈ 8.3% without subtracting from 1 computes the complementary event — the chance of drawing zero working solutions — rather than pass@k itself.
Question 135 · Frontier Model Safety and Alignment · hard
Reinforcement Learning from Human Feedback (RLHF) fine-tunes a policy π by maximizing a KL-regularized objective:
J(π) = E_{y~π(·|x)}[r(x,y)] − β · D_KL(π(·|x) ‖ π_ref(·|x))
where r(x,y) is a learned reward model's score for response y to prompt x, π_ref is the pretrained reference model, and β > 0 controls how far the fine-tuned policy may drift from π_ref. Solving this optimization exactly (via a Lagrangian / calculus-of-variations argument, the same one that produces a Gibbs-Boltzmann distribution) gives the closed-form optimum:
π*(y|x) = (1/Z(x)) · π_ref(y|x) · exp(r(x,y)/β)
For a prompt x, two candidate responses have reference probabilities π_ref(y1|x) = 0.40 and π_ref(y2|x) = 0.10, and reward-model scores r(x,y1) = 2 and r(x,y2) = 6. Using β = 2, what is π*(y2|x) / π*(y1|x)?
≈1.85, because scaling the reference-probability ratio (0.25) by exp((r(y2)−r(y1))/β) = exp(2) correctly weights the larger reward of y2 against the KL penalty.
≈13.65, obtained by exponentiating the full reward gap of 4 directly instead of dividing it by β = 2 first.
≈7.39, obtained by applying exp((r(y2)−r(y1))/β) alone and ignoring how the reference model already favoured y1 four-to-one.
≈29.56, obtained by using the reference model's odds in favour of y1 (4:1) instead of its odds in favour of y2 (1:4) when forming the ratio.
Answer: A. ≈1.85, because scaling the reference-probability ratio (0.25) by exp((r(y2)−r(y1))/β) = exp(2) correctly weights the larger reward of y2 against the KL penalty.
ExplanationBecause both π*(y1|x) and π*(y2|x) share the same normalizer Z(x), it cancels in the ratio, leaving:
π*(y2|x)/π*(y1|x) = [π_ref(y2|x)/π_ref(y1|x)] · exp((r(x,y2) − r(x,y1))/β)
Compute each factor separately. The reference-model ratio is π_ref(y2|x)/π_ref(y1|x) = 0.10/0.40 = 0.25 — the pretrained model prefers y1 four-to-one before any fine-tuning happens. The reward gap is r(x,y2) − r(x,y1) = 6 − 2 = 4, and dividing by β = 2 gives an exponent of 2, so the reward term contributes exp(2) ≈ 7.389.
Multiplying the two factors: 0.25 × 7.389 ≈ 1.85.
So π*(y2|x)/π*(y1|x) ≈ 1.85: despite π_ref favouring y1 four-to-one, the RLHF-optimal policy makes y2 about 1.85 times more likely than y1. A reward-model gap of 4 units, scaled by 1/β = 0.5, was enough to overturn the reference model's four-to-one preference.
This calculation is exactly why β is the central safety dial in RLHF, not just an optimization stability term. The reward model r(x,y) is a learned proxy for true human preference, never the preference itself. As β → 0, the KL penalty vanishes and π* → argmax_y r(x,y): the policy chases whatever the reward model scores highest, even into regions where the reward model is miscalibrated relative to real human judgment (Goodhart's Law — reward hacking / overoptimization). As β → ∞, the exponential term flattens toward 1 and π* → π_ref, so the model stays safe and coherent but ignores the reward signal entirely, which is the "alignment tax": every unit of extra reward-chasing purchased by lowering β is paid for in increased divergence from the broad, human-like behavior the reference model encodes. The 0.4/0.1 reference odds versus a modest reward gap of 4 at β = 2 shows how easily a large reward-model gap can dominate the reference model's prior once β is small enough — precisely the failure mode that motivates keeping β large enough, or applying additional constraints (e.g. best-of-n reranking, reward model ensembling, or process supervision), when deploying frontier models trained this way.
Question 136 · Mechanistic Interpretability: Understanding AI System Internals for Safety · hard
A mechanistic interpretability team auditing a customer-support LLM used by an Indian fintech app (for UPI dispute queries) before deployment trains a sparse autoencoder (SAE) on a 2-dimensional residual-stream activation, to check whether the model's internal computation decomposes into interpretable, safety-relevant features. The SAE's decoder has three unit-norm feature directions: d₁ = (1, 0), d₂ = (0, 1), and d₃ = (0.6, 0.8). Its training objective is L(z) = ‖x − Dz‖² + λ‖z‖₁, with λ = 0.1. For the activation x = (0.8, 0.6), two candidate sparse codes are compared: Code A, z = (0.8, 0.6, 0), activating d₁ and d₂; and Code B, z = (0, 0, 1), activating only d₃. Computing L(z) for each, which code does the SAE's training objective actually favor, and why?
Because Code B's reconstruction error alone is 0.08 — lower than Code A's full loss of 0.14 — the SAE favors Code B, since once a code activates only one feature the L1 penalty no longer contributes to the total loss.
Treating the penalty weight as 1 instead of 0.1 gives Code A a loss of 0 + 1.4 = 1.4 and Code B a loss of 0.08 + 1 = 1.08, so the SAE favors Code B, confirming the L1 penalty always picks the sparsest code regardless of λ's size.
Code A's total loss works out to 0 + 0.1(1.4) = 0.14 and Code B's to 0.08 + 0.1(1) = 0.18, so the SAE favors Code A — the two-feature code — because with λ = 0.1 the 0.08 drop in squared reconstruction error outweighs the 0.04 rise in the scaled L1 penalty.
Since x lies exactly in the span of d₁ and d₂, Code A and Code B both reconstruct x with zero error, giving each an identical total loss of 0.14 regardless of λ's value.
Answer: C. Code A's total loss works out to 0 + 0.1(1.4) = 0.14 and Code B's to 0.08 + 0.1(1) = 0.18, so the SAE favors Code A — the two-feature code — because with λ = 0.1 the 0.08 drop in squared reconstruction error outweighs the 0.04 rise in the scaled L1 penalty.
ExplanationReconstruction error for Code A is ‖x − Dz_A‖² = ‖(0.8,0.6) − (0.8,0.6)‖² = 0, since z_A = (0.8, 0.6, 0) reproduces x exactly as 0.8·d₁ + 0.6·d₂. Its L1 norm is 0.8 + 0.6 + 0 = 1.4, so its total loss is 0 + 0.1(1.4) = 0.14. For Code B, z_B = (0,0,1) reconstructs x as 1·d₃ = (0.6, 0.8), leaving a residual of (0.2, −0.2) and a squared reconstruction error of 0.2² + (−0.2)² = 0.08. Its L1 norm is 1, so its total loss is 0.08 + 0.1(1) = 0.18. Since 0.14 < 0.18, the training objective favors Code A even though it spreads x across two features instead of one. This matters for interpretability: the L1 term is a soft penalty scaled by λ, not a hard sparsity constraint, so whenever a small λ lets a modest reconstruction gain outweigh a larger sparsity cost, the SAE learns a denser, harder-to-interpret code even when a comparably accurate one-feature decomposition exists. Tuning λ correctly — and checking arithmetic like this rather than assuming "sparser always wins" — is exactly why SAE-based audits of models, including ones used in consumer-facing systems like UPI support chatbots, require care before their discovered "features" are trusted as genuine safety-relevant circuits.
Question 137 · AI Red Teaming Methodology: Finding System Vulnerabilities · hard
A red-teaming team at an Indian fintech startup is stress-testing the safety guardrails of a UPI-integrated banking chatbot using an automated jailbreak-generation algorithm. Each adversarial prompt the algorithm generates has an independent 8% probability of bypassing the safety filter. If the team runs 25 independent adversarial attempts, what is the probability that at least one attempt succeeds in bypassing the filter, revealing an exploitable vulnerability?
About 87.6%, since the probability of at least one success equals 1 minus the probability that all 25 independent attempts fail, i.e. 1 − 0.92²⁵.
About 100%, since summing the 8% success chance across 25 independent attempts gives 25 × 0.08 = 2.0, which represents certainty that a jailbreak will be found.
About 8%, since each red-teaming attempt is independent and identically distributed, so running more attempts does not change the probability that at least one succeeds.
Effectively 0%, since finding a vulnerability requires all 25 independent attempts to succeed, giving a probability of 0.08²⁵.
Answer: A. About 87.6%, since the probability of at least one success equals 1 minus the probability that all 25 independent attempts fail, i.e. 1 − 0.92²⁵.
ExplanationIn automated red-teaming, the attacker only needs one success across many attempts while the defender must withstand every single one — so the right tool is the complement rule, not simple addition of probabilities. If a single attempt fails to bypass the filter with probability 1 − 0.08 = 0.92, and the 25 attempts are independent, the probability that every one of them fails is 0.92²⁵. Computing this by repeated squaring: 0.92² = 0.8464, 0.92⁴ = 0.8464² ≈ 0.71640, 0.92⁸ ≈ 0.71640² ≈ 0.51322, 0.92¹⁶ ≈ 0.51322² ≈ 0.26340. Combining, 0.92²⁵ = 0.92¹⁶ × 0.92⁸ × 0.92¹ ≈ 0.26340 × 0.51322 × 0.92 ≈ 0.12437. So the probability that all 25 attempts fail is about 12.4%, and by the complement rule the probability that at least one attempt succeeds is 1 − 0.12437 ≈ 0.8756, about 87.6%. This is exactly why automated, high-volume red-teaming pipelines — running thousands of adversarial prompt variants against a model's safety filter — are far more effective at surfacing rare but real vulnerabilities than a handful of manual test prompts: even a per-attempt success rate as low as 8% compounds into near-certain discovery once enough independent attempts are made. Treating the 8% figure as additive (25 × 8% = 200%, clamped to 100%) ignores that independent failure probabilities compose multiplicatively, not that successes add linearly; treating repeated attempts as not compounding at all ignores the multiplication rule entirely; and computing 0.08²⁵ answers a different question — the near-impossible requirement that every attempt succeeds, not that at least one does.
Question 138 · Synthetic Biology and AI: Biosecurity and Dual-Use Risks · hard
An Indian biotech firm's DNA-synthesis screening pipeline uses an AI classifier to flag gene-synthesis orders that might encode a sequence of biosecurity concern (for example, a reconstructed toxin or select-agent gene) before the DNA is manufactured — a key safeguard against the dual-use risk that AI protein-design tools could be misused to help create dangerous biological agents. Historical audits show only 1 in 1,000,000 submitted orders is genuinely for such a sequence. The classifier correctly flags 99% of truly concerning orders (sensitivity) but also flags 0.1% of harmless orders (false positive rate). If a randomly chosen order is flagged, what is the probability, computed using Bayes' theorem, that it is genuinely a sequence of biosecurity concern?
About 99%, since the classifier correctly identifies 99% of truly concerning sequences whenever it examines them
About 50%, since a flagged order is either genuinely concerning or a false alarm and there is no further way to weight the two outcomes
About 0.0001%, matching the unconditional base rate of concerning orders in the full order stream regardless of the flag
About 0.1%, since the classifier's high accuracy is overwhelmed by the extremely low base rate of truly concerning orders among all orders
Answer: D. About 0.1%, since the classifier's high accuracy is overwhelmed by the extremely low base rate of truly concerning orders among all orders
ExplanationLet H be the event that an order is genuinely for a sequence of biosecurity concern, and F be the event that the AI classifier flags it. The data give P(H) = 1/1,000,000 = 0.000001, so P(not H) = 0.999999. Sensitivity gives P(F|H) = 0.99, and the false positive rate gives P(F|not H) = 0.001.
By the law of total probability, P(F) = P(F|H)·P(H) + P(F|not H)·P(not H) = (0.99)(0.000001) + (0.001)(0.999999) = 0.00000099 + 0.000999999 = 0.001000989.
By Bayes' theorem, P(H|F) = P(F|H)·P(H) / P(F) = 0.00000099 / 0.001000989 ≈ 0.000989, which is about 0.099%, i.e., approximately 0.1% — roughly 1 in 1,011 flagged orders.
So even though the classifier looks highly accurate (99% sensitivity, 99.9% specificity), about 999 out of every 1,000 flagged orders are false alarms, because true positives are astronomically rarer (1 in a million) than the classifier's false-positive rate (1 in a thousand). This is the base-rate effect at the heart of real biosecurity screening design: when the event being detected is extremely rare, even excellent classifiers produce mostly false alarms in absolute terms. It is precisely why operational DNA-synthesis screening systems (such as the internationally used Common Mechanism, and the frameworks India's biosafety regulators are developing) pair automated AI flags with mandatory human biosecurity review rather than blocking or approving orders on the AI score alone — the AI narrows a million orders down to a manageable review queue, but a trained reviewer, not the classifier, makes the final call on the roughly 0.1% of flags that could be genuine.
Question 139 · Post-Training Enhancement: RLHF and Beyond · hard
In RLHF, after fitting a reward model r(x,y) from human preference data (typically via the Bradley–Terry model), the policy π is trained to maximize E_{y∼π(·|x)}[r(x,y)] − β·D_KL(π(·|x) ‖ π_ref(·|x)), where π_ref is the supervised fine-tuned (SFT) policy and β>0 controls the strength of the KL penalty. Solving this KL-regularized objective in closed form (the same identity that underlies Direct Preference Optimization) gives π*(y|x) = π_ref(y|x)·exp(r(x,y)/β) / Z(x). For a prompt x with exactly two candidate completions, suppose π_ref(y1|x) = 0.2, π_ref(y2|x) = 0.8, the reward model scores r(x,y1) = 3 and r(x,y2) = 1, and β = 0.5. What is π*(y1|x) under the optimal RLHF policy, rounded to two decimal places?
≈0.20 — because the KL penalty forces the optimized policy to remain identical to the reference policy for every prompt, regardless of the reward gap.
≈0.69 — because the KL-regularized objective combines the reference probability and the scaled reward additively rather than multiplying the reference probability by an exponential reward term.
≈0.93 — because the ratio π*(y1)/π*(y2) equals [π_ref(y1)/π_ref(y2)]·exp((r(y1)−r(y2))/β) = 0.25 × e⁴ ≈ 13.65, and 13.65/(1+13.65) ≈ 0.93.
≈0.98 — because the optimal policy is simply the softmax of the rewards divided by β, and the reference policy's prior probabilities do not enter the normalization.
Answer: C. ≈0.93 — because the ratio π*(y1)/π*(y2) equals [π_ref(y1)/π_ref(y2)]·exp((r(y1)−r(y2))/β) = 0.25 × e⁴ ≈ 13.65, and 13.65/(1+13.65) ≈ 0.93.
ExplanationThe KL-regularized RLHF objective max_π E_{y∼π}[r(x,y)] − β·D_KL(π(·|x) ‖ π_ref(·|x)) is solved by forming the Lagrangian with the normalization constraint Σ_y π(y|x) = 1 and setting the functional derivative to zero. This yields the classic Gibbs/Boltzmann-tilted solution π*(y|x) = π_ref(y|x)·exp(r(x,y)/β) / Z(x), with Z(x) = Σ_y π_ref(y|x)·exp(r(x,y)/β). This form shows the optimal policy exponentially reweights the reference distribution in the direction of higher reward: small β (weak regularization) lets even a modest reward gap dominate the reference prior, while large β keeps π* close to π_ref. This exact identity is what Direct Preference Optimization substitutes into the Bradley-Terry preference loss to eliminate the need for a separate reward model and RL loop.
Plugging in the numbers: exp(r(y1)/β) = exp(3/0.5) = exp(6) ≈ 403.43, and exp(r(y2)/β) = exp(1/0.5) = exp(2) ≈ 7.39. The unnormalized weights are π_ref(y1)·403.43 = 0.2 × 403.43 ≈ 80.69 and π_ref(y2)·7.39 = 0.8 × 7.39 ≈ 5.91, giving Z ≈ 86.60 and π*(y1) = 80.69 / 86.60 ≈ 0.93. Equivalently, working with the ratio directly: π*(y1)/π*(y2) = [π_ref(y1)/π_ref(y2)]·exp((r(y1)−r(y2))/β) = 0.25 × e⁴ ≈ 13.65, so π*(y1) = 13.65 / (1 + 13.65) ≈ 0.93. Even though the reference (SFT) policy favoured y2 four-to-one, a reward gap of only 2 units, amplified through division by a small β = 0.5, is enough to flip the optimized policy to strongly prefer y1. This is precisely why β is the central lever in RLHF: it sets the trade-off between chasing reward and drifting from the reference model's language distribution, and choosing it too small can let a noisy or misspecified reward model dominate the policy despite a well-trained SFT prior.
Question 140 · Long-Context Reasoning and Retrieval: Processing Extended Information · hard
An Indian edtech startup builds a long-context AI tutor that feeds an entire NCERT Class 12 chapter directly into a transformer's context window instead of using retrieval-augmented generation (RAG) to fetch only the relevant paragraphs. For one self-attention layer with embedding dimension d = 512, the dominant computational cost is approximately 2n²d floating-point operations, where n is the number of tokens in the context — n² pairwise dot products for QKᵀ, plus n² weighted-sum operations for combining with V, each requiring d multiply-adds. If the startup increases the context window from n = 4096 tokens to n = 16384 tokens to fit the whole chapter, by what factor does the attention FLOPs per layer grow, and what is the actual FLOPs count at n = 16384?
Attention cost scales quadratically in n, so the factor is 16 (4²), giving roughly 2.75 × 10¹¹ FLOPs per layer at n = 16384 (2 × 16384² × 512).
Since KV-cache memory grows linearly with context length, attention compute is often mistaken for the same linear relationship — under that assumption the factor is only 4, giving roughly 1.68 × 10⁷ FLOPs per layer.
Squaring the token-count ratio correctly gives a factor of 16, but omitting the weighted-sum-with-V term and counting only the QKᵀ scores yields roughly 1.37 × 10¹¹ FLOPs per layer — half the true value.
Treating each of the three projection matrices (Q, K, V) as contributing an independent factor of n to the complexity produces a cubic n³ relationship, giving a factor of 64 and roughly 1.10 × 10¹² FLOPs per layer.
Answer: A. Attention cost scales quadratically in n, so the factor is 16 (4²), giving roughly 2.75 × 10¹¹ FLOPs per layer at n = 16384 (2 × 16384² × 512).
ExplanationSelf-attention's dominant per-layer cost has two n²-sized terms: computing the score matrix QKᵀ requires n² dot products, each involving d multiply-adds (n²d operations), and combining those attention weights with V to produce the output also involves n² weighted sums of d-dimensional vectors (another n²d operations) — giving 2n²d total. Because n appears squared, scaling n by a factor of k scales the FLOPs by k². Here k = 16384/4096 = 4, so the compute grows by 4² = 16×, not by 4× as it would for a mechanism that processed tokens independently. Plugging n = 16384 and d = 512 into 2n²d: 16384² = 268,435,456; multiplying by 512 gives 137,438,953,472; doubling (for both the QKᵀ step and the weighted-sum-with-V step) gives 274,877,906,944 ≈ 2.75 × 10¹¹ FLOPs for that single layer. This quadratic blow-up — not the linear growth of KV-cache memory, which only stores one key and one value vector per token — is exactly why feeding an entire textbook chapter into the context window is far more expensive than retrieving just the few relevant paragraphs with RAG: doubling context length always quadruples the attention compute, regardless of how much of that context is actually useful for answering the question.