00-START-HERE · 01-READING-ROUTES · 27_fine_tuning_the_generator · 29_bootstrapping_training_data Purpose: decide which Retrieval-Augmented Generation (RAG) component to train, connect generator utility to a discrete retriever, and price the index work that retriever updates create.
TL;DR
- Choose freeze/train decisions separately for retrieval and generation. Use oracle, closed-book and production hit/miss diagnostics rather than an unsupported recall-based accuracy ceiling.
- FiD independently encodes passage views and jointly decodes; only the idealized encoder attention term shrinks by the passage count. FiD-Light reduces decoder-visible states after compatible training, not every component of total cost by the same factor.
- Hard selected identities have no ordinary gradient almost everywhere. Finite-support marginalization, stochastic score-function estimators and differentiable surrogates define different objectives and interfaces.
- REPLUG mixes passage-conditioned next-token distributions from a frozen model. Exact implementation requires appropriate probability access, multiple branch computations and explicit caching/billing assumptions.
- LM supervision supplies direct feedback only for scored candidates. Shared encoder updates and later mining can still change rankings outside that set. The direction of KL and temperature chain rule matter.
- Index refresh must distinguish inline age from asynchronous build/publication lag and include both retriever towers where trained. Flat search avoids graph construction, not document re-encoding.
- REALM-style masked prediction can train retrieval without relevance labels. The corrected fully trainable three-tower scenario costs about times its closed-book baseline including the charged rebuilds; the old roughly thirty-three-fold subtotal omitted retriever training work.
The story
Imagine a library with a catalog clerk, a reader and a builder who regenerates catalog cards. Give the reader verified evidence to diagnose failures, but remember that this intervention changes context and cannot uniquely identify every cause. Training only the query-side clerk need not rewrite cards; training the shared or document-side representation can. The hard checkout gate supplies book identities, not a differentiable path from answer loss. Marginalization and stochastic training can score choices, while a soft or straight-through approach needs an explicit continuous interface rather than gradients through raw book titles. FiD reads passage views separately and combines them in one decoder. FiD-Light trains a smaller decoder-visible state set. A locked service-window reader can instead expose token distributions for REPLUG, with one branch per passage and bills that depend on output length and cache policy. The reader can also grade retrieved books by answer likelihood. That gives direct supervision only on the cart, although a shared clerk update or new mining can bring other books later. REALM moves the same comparative credit into masked pretraining. Its catalog builder is part of the resource ledger, and a full ledger includes the reader, query encoder, document encoder and refreshes—not only the reader. The retriever supplies evidence and the generator uses it, but final correctness depends on their joint distribution, prior knowledge and the evaluation definition. Diagnose input sufficiency and conditional reader behavior separately.
- Use gold-context interventions alongside representative production hit/miss and closed-book measurements. A flat oracle result need not prove that generation is the only failure.
- Selected passage identities are discrete. A gradient path requires an explicit stochastic objective, marginal likelihood or differentiable surrogate; putting raw text behind a soft mask does not create one automatically.
- FiD and FiD-Light require compatible generator architecture/training. REPLUG instead requires next-token probability access and charges passage-conditioned branches.
- LM supervision has a direct candidate-support blind spot, not a theorem that shared retriever training can never improve future discovery.
- When the document representation changes, use versioned encode/build/publish stages. A final compatible index is required if document-side weights moved; corpus-only updates and query-only training have different obligations.
- REALM’s useful masked-token signal and its rebuild costs depend on model architecture, selected support and training layout. Report empirical results separately from the arithmetic scenario. In short: diagnose the production slices, choose an implementable learning objective, and charge all trained components plus the index lifecycle.
Decoder table
| Source term | Plain-language decode | Interview consequence |
|---|---|---|
| RAG | Retrieval-Augmented Generation | Correctness depends jointly on evidence, reader, prior knowledge, labels and policy |
| Retriever weights, | Retriever scoring and selection parameters | Hard identity selection blocks that particular ordinary gradient; direct retrieval losses or score paths can still train them |
| Generator weights, | Parameters that produce the answer | They can train directly from answer loss when weights are available. |
| Datastore, | Corpus of chunks with stored representation versions | Document-side changes can invalidate vectors; query-only updates do not automatically do so |
| Query and evidence symbols , , , , , and | Question/request, target and passage/document symbols | Names are local; distinguish a masked target, an output token and a full answer sequence |
| Parameter symbols , , and | Retriever, generator and query-side trainable parameters | Use retriever snapshot versions in refresh analysis, keeping generator parameters separate |
| Encoder functions , , , , and | Query-side and document-side representation functions | A changed document function creates the re-encoding obligation; shared checkpoints can be untied explicitly |
| Corpus/candidate sizes, depth, view length, width, layers and visible states | View length includes repeated query/template tokens; candidate count need not equal corpus count | |
| Parameter counts, arithmetic throughput, bandwidth and work components | Compare declared workloads and measured rates; FLOP ratios are not latency measurements | |
| and | Batch size; lowercase b denotes bytes per cached scalar | Do not conflate scalar storage with examples per step |
| Output-token count or local input-length notation; script L is loss | Output words and tokens differ; refresh separates query and document lengths | |
| Kept-state count, hard/relaxed mask or a latent block, depending on section | Decode locally; a categorical unit-sum mask is not a multi-hot depth-k mask | |
| Explicit retrieved support or declared candidate set | Normalization on that support defines a truncated objective, not proof that all corpus mass is included | |
| Sequence symbols , , and | Current output token, decoded prefix, and a document prepended to a query | They define REPLUG’s repeated next-token mixture. |
| Uniform draws, Gumbel noise, relaxed categorical weight and identity indicator | The Jacobian applies to one-choice relaxation with positive temperature | |
| Distillation symbols , , , and | Teacher utility, log probability ratio and teacher/student temperatures | Scaled logit a equals raw score divided by gamma; score gradients include the inverse temperature |
| Document snapshot, interval, build duration, capacity floor and relative arithmetic rate | General asynchronous age is build duration through build duration plus interval; inline age is different | |
| Top | Selected candidate support | Limits direct input evidence, not all possible accuracy or future shared-parameter discovery |
| Oracle-context ablation | Supply verified gold evidence as an intervention | Useful diagnostic, but no unique causal assignment or automatic freeze/train decision |
| Quadrant I | Freeze the declared retrieval and generation weights | Prompt/chunking/depth changes are non-gradient here; an independently trained reranker needs separate classification |
| Quadrant II | Train retrieval with generation frozen | Teacher likelihood is one option; full re-encoding is conditional on changed document representations |
| Quadrant III | Train generation with retrieval weights frozen | Compatible FiD/Light or RAFT training can fit; corpus-only index updates remain possible |
| Quadrant IV | Train both through an explicit coupling | Budget all trained components and any document-side refresh; direct generator training needs an available interface |
| Query-side fine-tuning | Train the query tower while preserving document representation | Avoids automatic re-encode; can repair some mismatch but not information lost in fixed document vectors |
| Document-side fine-tuning | Train document representations | May improve or worsen geometry; version and refresh affected representations rather than assume every step improves quality |
| Tied encoder | One shared function for query and passage encoding | Can be copied and untied; query-only training of one copy is then a different architecture |
| FiD | Encode passage views independently, decode jointly | Ideal encoder attention ratio equals depth; total FLOPs and real query-once layouts have different ratios |
| FiD-Light | Train with a restricted decoder-visible state set per passage | Reduces static cross-KV projection/cache components; does not guarantee unchanged quality |
| Decoder-visible states, | The total states offered to decoder cross-attention | For FiD-Light, . |
| KV cache | Static cross-attention keys/values, distinct from dynamic self-attention KV | Store once and model repeated reads explicitly; caching, batching and on-chip reuse change physical traffic |
| Marginalization | Sum probabilities over a declared latent-support model | Sequence marginalization differs from token mixtures; exactness is local to the defined model, not a full-corpus guarantee |
| Hard top- | Indices of highest-scoring candidates | Locally constant away from selection crossings; raw text lookup has no automatic continuous derivative |
| Selection vector, | Hard mask with a specified number of selected candidates | A compatible differentiable surrogate requires an explicit reader/mask interface |
| REINFORCE | Stochastic score-function gradient estimator | Unbiased under its stated objective/baseline/support assumptions; one sampled rollout is possible but variance/cost remain |
| Standard Gumbel noise | Noise sampled from transformed uniform draws | Perturb-and-argmax becomes an exact softmax sample. |
| Gumbel-Softmax | Temperature-softened noisy categorical selection | Pathwise gradient belongs to the relaxed objective; small draw-specific derivatives and near-tie peaks are possible |
| Gumbel-top- | Ordered noisy top-k selection | Plackett–Luce without-replacement law; not independent categorical draws or a unit-sum top-k relaxation |
| Straight-through estimator | Hard forward mask with substituted relaxed derivative | Biased surrogate requiring an implementable continuous path; not automatic differentiation through raw strings |
| Temperature, | Relaxation or retrieval-mixture temperature | Different roles: Gumbel relaxation sharpness need not change its hard argmax law; REPLUG temperature changes weights |
| REPLUG | Frozen branch distributions mixed at each token under a common prefix | Needs adequate probability/continuation access and charges every branch step |
| Retrieval weight, | Normalized candidate weight at fixed request | Bounds one additive token-probability contribution, not raw-score influence or whole-answer provenance |
| LM-supervised retrieval | Use this teacher’s answer likelihood to train retrieval | Preference is not necessarily truth, human relevance or causal evidence use |
| Utility, | Summed or explicitly length-normalized gold-answer log likelihood | Within-query comparison does not remove answer-length-dependent temperature effects |
| LM preference, | Temperature-normalized relative teacher preferences | Can favor the least-bad passage when every candidate is poor; evaluate absolute utility too |
| Retriever distribution, | Softmax over retriever scores with temperature | It is the student distribution on the same top- support. |
| Kullback-Leibler divergence, KL | Declared divergence between retrieval and teacher distributions | Direction matters: reverse-teacher KL has a mass-scaled logit gradient; teacher-to-student KL instead gives P minus Q |
| Top- blind spot | No direct independent teacher score feedback for unscored candidates | Shared updates and later candidate mining can still alter outside ranks; not an absolute discovery impossibility |
| Hard-negative mining | Introduce current difficult negatives and missing positives | Adds candidate exposure; does not guarantee every useful document is discovered |
| Index version | Document encoder snapshot that produced indexed representations | Query-only training intentionally works against a fixed document tower; differing query step numbers are not automatically invalid |
| Negative stagnation | Old candidates become easy under the current model | Loss can keep falling while recall stops improving. |
| Refresh cost, | Work for the declared corpus re-encoding component | Graph construction, I/O and publication are separate unless explicitly included |
| Step cost, | All charged trainable/teacher work per step | Adding a teacher enlarges the denominator; it does not make an encode intrinsically cheaper |
| Refresh interval, | Trainer updates between snapshots or inline rebuilds | Capacity and acceptable version/task-quality drift constrain cadence; no universal overlap-only upper bound |
| Builder ratio, | Builder versus trainer arithmetic throughput ratio | Measure build and step times if utilization differs; one serial builder needs enough service capacity |
| Asynchronous refresh | Build while the trainer advances, then publish a snapshot | General age lies between build delay and build delay plus interval; the one-to-two-interval band is a special schedule |
| Flat training search | Exact search over stored snapshot vectors | Avoids graph construction, not encoder updates, vector staleness, memory reads or top-k selection |
| Hierarchical Navigable Small World (HNSW) | Approximate-neighbor graph index | A stipulated distance-count FLOP comparison is not a universal build-cost or wall-time bound |
| Maximum inner product search (MIPS) | Search by bi-encoder inner product | REALM rebuilds this index asynchronously. |
| REALM | Latent retrieval inside masked-token pretraining | Comparative likelihood can train both towers only through available gradient paths; charge the reader too |
| Salient span masking | Choose salient entities, dates or identifiers as masked targets | Can strengthen retrieval signal empirically, not guarantee it is required or nonzero |
| Inverse Cloze Task (ICT) | Source-named retrieval warm start | Can improve useful-candidate exposure; equally poor likelihoods need not be exactly equal or always signal-free |
| RETRO | Source-reported large-datastore pretraining with frozen retrieval | Scaling and quality claims are experiment-specific; not proof of equivalence to the full-gradient toy |
Core mechanics
Mathematical conventions
Use natural logarithms, decimal bytes and explicit binary units where needed. Compute at full precision before rounding. Accuracy changes are percentage points unless explicitly relative. A finite-support probability mixture is exact for its declared candidate set, not necessarily for the full corpus. Dense arithmetic proxies are and . The first examples use ; FiD also assumes bandwidth . Other sections state their own throughput. These proxies omit utilization changes, searches, communication, scheduling, launch overhead and relevant task-specific terms unless listed. FLOP ratios do not establish measured latency or an end-to-end invoice. Treat oracle-context accuracy as an intervention. Production correctness obeys only with , and defined on corresponding sufficient-evidence hit/miss populations. Without , recall alone is not an accuracy ceiling. A new retriever can change all three rates. Memory and traffic ledgers declare what is stored and read. FiD costs distinguish encoder work, one-time cross-attention KV projection, per-token weight/cache streaming and omitted self-attention/output/runtime terms. Refresh steps distinguish query and document tokens; builder capacity is a wall-time constraint when measured throughputs differ. A document-side update can invalidate stored representations; query-only or reranker updates do not automatically require a full document re-encode.
28.1 Four quadrants: freeze or train × retriever or generator
What
Expose both parameter sets.
The datastore contains chunks and the retriever returns ; an approximate index need not explicitly score every chunk per query. Freeze/train decisions apply separately to retrieval and generation. Run a verified gold-context intervention and production evidence/reader ablations on representative held-out questions, including failures and successes.
- An oracle-context gain suggests that changed evidence or context helped. Investigate retrieval coverage, context formatting and distracting text; it is not unique causal attribution to the retriever.
- A flat oracle result suggests residual reader, reasoning, label or task limitations, but can also arise from an invalid oracle construction or ceiling effects. It does not prove retrieval is already sound.
- With sufficient-evidence rate , . Only under an additional zero-correctness-on-misses assumption is accuracy bounded by ; prior knowledge, alternate evidence and learned facts can make .
Why
The four choices carry different signals and obligations.
- Quadrant I makes no parameter updates to the declared retriever and generator; changes to prompts, chunking or an additional trained reranker are separate interventions.
- Quadrant II trains retrieval while freezing generation. Full document re-encoding is owed when document-side representations change, not merely when any retriever parameter changes.
- Quadrant III trains generation with frozen retrieval representations; corpus updates can still change the index.
- Quadrant IV trains both through an explicit gradient/estimator path. Budget both trained components and any index refresh; a hosted generator without a training interface cannot supply owned generator gradients. Query-only training keeps the document representation fixed and avoids invalidating stored vectors. It can compensate for some vocabulary or alignment mismatch if the fixed document vectors retain the necessary distinctions. It cannot recover information that those vectors have discarded or distinguish identical document representations without another signal. A tied checkpoint can be copied into separate towers and the document copy frozen, at which point the training architecture is no longer tied.
Failure without it
Generator tuning is not automatically wasted on retrieval misses: it can change prior knowledge, abstention and evidence use, but cannot directly read an unfetched source. Choose from measured costs and held-out policy/quality gains. Hard identity selection blocks that particular answer-gradient path; score weighting, direct retrieval losses or stochastic estimators can provide another. A changing corpus, hosted interface or future generator release changes the trade-off rather than mathematically ruling out joint training. The source’s PEFT default is an empirical starting point, not a theorem about which target formats LoRA can represent.
Cost and complexity
The first arithmetic ledger uses a -parameter retriever and an -parameter generator:
For ten million length- document chunks, at the stipulated , the re-encode component is
A separate basic contrastive-step proxy with total trainable encoder-token positions gives
One re-encode is of these basic steps in FLOPs. The generator scenario has pairs, five passages and total processed token positions per example, with three epochs. Treat that length as the entire charged prompt/target layout; if it excludes targets, charge them separately. These are separate workloads, not matched evidence that training one tower is a fixed fraction of training the other.
- Generator arithmetic is hours per epoch and over three epochs.
- The bare retriever scenario has basic steps and ten corpus encodes at : gradient work plus encoding, or arithmetic hours. Encoding is of that ledger. Initial index build, teacher scoring and omitted search/communication are not included.
- Adding those two separate bills serially gives hours. This is an accounting comparison, not a measured or unavoidable joint-training schedule.
- Relative to gradient work alone, the bare retriever total is times larger; this is the source’s rounded ninety-four-fold underestimate, not a parameter-count law.
- At , encoding work is times basic gradient work under this ledger. Refresh counts must specify whether initial and final builds are included and which checkpoint is published.
- At chunks, the same encode proxy takes .
- Five-percent new/changed content means chunks and incremental encoding with a frozen document encoder. Updating document-side weights can require encoding all chunks, a twenty-fold difference in this component—not necessarily total operating cost.
28.2 Fusion-in-Decoder and FiD-Light
What
Let each encoded query-passage view have total length , width and layers; includes the repeated question/template. For the ideal comparison, concatenate all such views into length . This repeats the query too. A real concatenation with the query only once has length , versus views of length , and need not have the exact ratio below.
FiD encodes each query-passage view separately with shared encoder parameters, then stacks its token states along the sequence axis:
The decoder cross-attends to those states at every decoding step, not only once for the whole answer. The encoder attention component is
The ratio is exactly for this ideal attention-only abstraction, not for total transformer work, training memory or measured latency. FiD-Light retains trained encoder states per passage for decoder access, giving ; the bidirectional encoder still reads all input positions. Quality at a chosen must be validated, not assumed unchanged.
Why
FiD moves direct cross-passage combination to the decoder, while independent encoders remove cross-passage self-attention edges. Cross-attention per decoded token grows linearly in visible states at fixed width. FiD-Light reduces that component after compatible training.
Here is bytes per cached scalar and the factor two counts keys and values; head/key dimensions are assumed to sum to . This is one-example cross-attention KV storage across decoder layers. Static encoder K/V projections are computed once and cached. A one-read-per-token HBM model streams this cache per decode step, but batching and on-chip reuse can change physical traffic. Decoder self-attention KV, activations and framework allocations are separate.
Failure without it
Concatenated encoder attention is quadratic in its total input length. A single latent-passage branch does not directly condition on multiple passages at once, but that is not proof every multi-hop answer is impossible: priors, a branch that already contains the answer, or information transferred through an autoregressive prefix can help. Sequence marginalization and token-wise ensembling are different models. FiD directly exposes joint passage evidence to one decoder. Cutting visible states post hoc from a FiD checkpoint is not equivalent to training FiD-Light; the required summary behavior and quality must be learned and tested. A passage identifier aids traceability but does not prove correct attribution or truth.
Cost and complexity
Use , , , feed-forward width , encoder and decoder layers, and vocabulary size . Count a multiply-add as two FLOPs. Biases, normalization, positional parameters and additional kernel work are omitted from this component model.
- Encoder attention over all layers is TFLOP for length- concatenation and TFLOP for separate views.
- Linear encoder weights per layer are , giving over twenty-four layers. Decoder layers have , or total.
- One vocabulary matrix has entries. With one shared/tied copy, the listed component count is ; with two independent copies it is . Do not count a tied embedding twice. Proximity to the chapter-reported roughly -million T5-large size does not validate weight tying, omitted tensors or an exact architecture count. For a one-example bf16 streaming proxy, use , bandwidth and arithmetic rate . The request ledger includes encoder work plus static cross-KV projection, followed by per-token weight/cache reads. It excludes query embedding/search, dynamic self-attention KV growth, other activation traffic, softmax/normalization overhead, communication and batching effects; it is not a measured latency model.
- Encoder linear-plus-attention work is TFLOP for the ideal concatenation and TFLOP for FiD: and in arithmetic time.
- Static cross-KV preparation adds TFLOP for FiD, or at .
- Decoder layer weights total . Remove of cross-KV projection weights already used at preparation and add the vocabulary projection read. The declared per-token weight stream is ; tied storage does not make the output-head read free.
- Cross-KV cache is . Weight-plus-cross-cache stream is , or ; the cross-cache accounts for approximately of those bytes. For FiD-Light with , keeping encoder work unchanged:
- Visible states fall from to and cross-cache storage to , a thirty-two-fold change in that component.
- Static cross-KV preparation falls to TFLOP, or ; preparation plus encoding is versus FiD’s .
- Weight-plus-cross-cache stream becomes and . This decode-stream ratio is approximately , not thirty-two.
- At output tokens, the partial proxies are and , a reduction. Three words need not tokenize to three tokens. Earlier four-percent labels omitted the changed cross-KV preparation and used a different weight stream.
- At , the proxies are and , a ratio of approximately . None proves the same speedup or unchanged quality in production.
- The declared cross-cache overtakes streamed weights at about visible states, hence at integer in this model. This threshold changes with architecture, cache reuse and included bytes; it is not a universal gate.
- Choose for evidence coverage and for quality versus total visible-state budget . The source’s independent-encoding threshold near five passages is a heuristic.
- At with the same per-view shape, encoder arithmetic is and cross-cache payload , before other costs.
- Source pointing supplies identifiers for auditing, not a guarantee of factual grounding.
28.3 Relevance is discrete: Gumbel noise and the differentiability fix
What
For a declared candidate pool of documents, the retriever forms scores and a hard mask; only if all corpus candidates are considered. The document encoder is fixed in the score below; sharing trainable parameters creates an additional document-side derivative.
The generator loss is:
A formal mask-interface chain would be
For hard selected identities, the middle Jacobian is zero away from rank boundaries and the selection map is nondifferentiable at relevant crossings. Raw tokenization/text lookup also does not supply a differentiable mask input automatically. This blocks this particular ordinary gradient path, not all possible retriever learning. Scores passed into a differentiable reader or a separate retrieval loss can create another path.
- Define a differentiable finite-support marginal likelihood, with candidate support held fixed locally.
- Optimize an expected stochastic retrieval reward with a score-function estimator.
- Define a continuous relaxation or explicit straight-through surrogate at a compatible representation interface. A single latent-document sequence model on a fixed candidate set is
This is exact for the declared finite-support model, not necessarily the full-corpus objective. RAG-Sequence’s sequence mixture and REPLUG’s product of per-token mixtures are not interchangeable. For stochastic action with reward independent of except through the sampled action, an action-independent baseline gives
With suitable support/regularity this score-function estimator is unbiased and may use one sampled reader rollout. It can have high variance; exact reward evaluation and baseline costs are not free. If the reward directly depends on , include its derivative too. For one categorical choice with unit-temperature logits,
A non-unit score temperature contributes its inverse to this derivative. Draw independent standard Gumbel noises:
Its cumulative distribution is:
The maximum of shifted Gumbels remains Gumbel.
The maximum-CDF identity identifies a shifted Gumbel. The categorical argmax law additionally follows by integrating the winning candidate’s density against the other candidates’ CDFs:
The categorical continuous relaxation, also called Concrete/Gumbel-Softmax, and its Jacobian are
Gumbel-top- gives the ordered Plackett–Luce sample without replacement from the exponentiated scores; it is not independent categorical draws. A categorical softmax sums to one, whereas a -hot mask sums to , so top- needs a compatible soft-top- or iterative surrogate rather than blindly reusing the single-choice Jacobian. A straight-through mask uses . It is hard forward and surrogate-soft backward only if the reader/representation provides a differentiable path through that mask; arbitrary raw strings do not. The noisy hard forward choice is also not the same as deterministic serving top-.
Why
Gumbel randomness is independent of retriever parameters, enabling a pathwise derivative for a compatible relaxed objective. That derivative is not an unbiased gradient of the original discrete objective at finite temperature. Straight-through substitution introduces an additional surrogate bias. A thirty-token answer at two nats per token has NLL nats; a log-likelihood reward is , and the centered advantage depends on the baseline. Neither value by itself determines estimator variance. A blended passage embedding is not real text, but can be valid input to an explicitly designed continuous reader; assess the serving mismatch rather than assuming a text API accepts it.
Failure without it
A hard top-one identity is locally unchanged until a rank crossing; a loss through that identity supplies no ordinary score gradient, although explicit score weighting or other objectives can. Low relaxation temperature makes many draw-specific derivatives small and permits larger derivatives near ties; it is not a general zero-gradient or stability law. Independent Gaussian perturbations lead to multinomial-probit rather than softmax choices. Binary probabilities reduce to a normal CDF; general multicandidate probabilities require Gaussian integrals rather than a universal elementary softmax formula.
Cost and complexity
The five-logit example is:
The Gumbel draw uses:
The unrounded draw selects passage two, with noisy top two ordered as . At , the relaxed weights are
Compare the same Jacobian entry, not different coordinates: at and at , a draw-specific ratio of about . At the lower temperature, the first weight is and . A diagonal entry is bounded by , reaching at a two-way half/half tie in the limiting no-other-mass case. The ratio of that bound to this draw’s is about . These are not estimates of typical training gradients or their variance. For two independent standard Gumbels, their difference is Logistic, so a ninety-percent pairwise win probability requires
The current score margin gives pairwise win probability , requiring an additional logits for this two-candidate ninety-percent comparison. It does not imply ninety-percent top-one probability among all five. In a separate workload comparison, let , passage length , query length and target length .
- Eight single-passage likelihood branches process prompt and target positions, total .
- One sampled top-one branch processes prompt and target positions, total .
- The eight-fold position ratio is exact for those branch lengths, not an end-to-end compute or latency guarantee. Retriever scoring, gradient estimation, sequential scheduling and quality differ; a hard top- reader with has another workload. The source’s small- marginalization and large- straight-through preferences are heuristics, contingent on architecture, probability access and quality. Anneal temperature only with measured gradient/quality behavior; is a starting point, not a guarantee. Track categorical score entropy on a clearly defined candidate set separately from relaxed-sample entropy. Nearly concentrated mass makes noise less influential, not absent; entropy near indicates near-uniform candidate weights, not necessarily no useful retrieval. A top-one mass above does not by itself prove a surrogate is unnecessary.
28.4 REPLUG: black-box LLM, ensembled output distributions
What
In the frozen-retriever inference variant, retrieve once from the original request and assign cosine scores. LM-supervised retriever training is a separate variant. Do not silently re-retrieve from each generated prefix while claiming fixed weights.
At each generation step, each passage-conditioned branch uses the same selected output prefix. Mix normalized next-token distributions:
Select or sample one token from that mixture, append that same token to every branch, and repeat. Greedy argmax is one decoding policy, not a required part of the probabilistic model.
Why
Exact vocabulary mixing needs access to the relevant next-token distributions and an interface that can continue each branch under the common selected prefix. No model-weight or gradient access is required, but an ordinary text-only API or log probabilities only for emitted tokens is insufficient. Per-pass context is question plus one passage. For a fixed token/prefix, a passage’s additive contribution is at most its normalized weight , not its raw score; this is not causal citation attribution or a bound on influence over the entire autoregressive answer. FiD instead needs a compatible encoder-decoder architecture; simply gaining weights does not automatically turn a decoder-only model into FiD.
Failure without it
Concatenation normally does not enforce an explicit retrieval-weighted vocabulary mixture, though scores can be supplied as prompt features. At , narrow cosine scores can yield diffuse weights. A frozen model’s context-use behavior cannot be retrained through this inference-only procedure, but prompts and external filters can still change behavior. Fixed weights do not verify source truth: a wrong majority can dominate. In this defined variant, every branch contributes at every token with constant ; pruning or adaptive retrieval would be another algorithm.
Cost and complexity
Use scores , and eight copies of . For a fully normalized two-token example, gold assigns to (correct, wrong), while each other passage assigns .
- At , gold weight is and each low-scoring passage has ; correct-token mixture probability is .
- At , gold, the second passage and each remaining passage have weights , and . Correct mass is and wrong mass ; they sum to one.
- Gold-only conditioning gives correct mass . The mixture flips to the correct token only if , hence .
- For these scores, numerical solution gives for a strict correct-token win. As temperature falls, the unique highest-score branch dominates, but if that document is wrong concentration can hurt.
- The prior wrong-token value and threshold did not follow one specified normalized pair of token distributions. A different gold wrong-token mass changes the threshold; it must be declared. The billing scenario uses ten -token chunks, a -token question/instruction and a -token answer, priced at per million charged input tokens and per million charged output positions. It assumes the required probability/continuation interface bills one output position per branch step at those rates; actual endpoints may not offer this interface or pricing.
- Concatenation prefills tokens once and decodes sixty-four: per query under these hypothetical rates.
- Persistent branch KV states require initial input positions, a ratio of , plus branch-token evaluations. If only initial input and those outputs are billed, the component bill is , or times concatenation—not the same bill even with cached inputs.
- Without persistent/cached prefix treatment, input positions sum to . Input bill is , output bill , total , a ratio of .
- Parallel branches can reduce critical-path waiting with enough capacity, but successive output-token decisions remain dependent. Compute is not uniformly ten-fold for every component, and cache availability does not imply free or discounted billing. The chapter reports improvement in GPT-3 175B language modeling and in a Codex five-shot MMLU setting. Preserve their source-specific metrics and denominators rather than treating them as verified production gains or interchangeable percentage-point changes. Ten branches over five hundred output tokens require branch-token evaluations, in addition to preparation. The source’s fifty-token cutoff and one-third top-source mass are heuristics to validate. Tune depth, temperature, evidence diversity and output length jointly. Selecting one document and generating once is cheaper but is no longer the same mixture and can lose joint-evidence capability. Truncated top-token lists omit probability mass; do not silently renormalize them and claim an exact full-vocabulary mixture. Approximation or certified-tail bounds require separate analysis.
28.5 LM-supervised retrieval: KL between retriever and LM preference
What
For fixed query , verified gold answer and a frozen teacher, score each retrieved passage with its target-sequence log likelihood. Mask prompt loss and state whether the likelihood is summed or length-normalized:
Normalize utility over the retrieved set with LM temperature .
Normalize retriever scores on the same support with temperature .
For the explicitly analyzed reverse-teacher-direction variant, hold the candidate set and teacher probabilities fixed locally and minimize
Let:
Then:
These coordinate gradients sum to zero because adding a common logit offset changes no softmax probability. A negative logit gradient is a descent direction in independent logit coordinates, not automatically the actual change in probabilities, cosine scores or shared encoder parameters. Reversing KL to gives a different logit gradient . State the chosen implementation rather than attributing one direction to every LM-supervised method.
Why
LM likelihood measures this generator’s relative preference, not guaranteed human relevance, truth or causal evidence benefit. A model can favor familiar wording or prior-consistent misinformation. Within-query comparison avoids comparing raw totals between different answers, but does not remove length-dependent sharpness: longer answers can increase utility contrasts. Mean token log likelihood is another explicit teacher objective. Temperature, absolute usefulness, labels and held-out correctness need validation. Teacher scoring can use an API only if the required gold-answer likelihoods are exposed.
Failure without it
Finite-support normalization defines a conditional candidate objective; it does not require or prove that top- contains essentially all full-corpus probability. An outside document has no direct independent score-coordinate supervision in that example. Shared query/document parameter updates can nonetheless change its score and future rank, and later mining can introduce it. Thus there is a direct-feedback blind spot, not an impossibility of future discovery. The factor can make low-mass candidates hard to promote in this KL direction, but no universal ordering of demotion and promotion magnitudes follows. Relative teacher preferences can favor the best of an entirely poor candidate set; use absolute quality/evidence tests too.
Cost and complexity
The worked example uses , , and cosine scores:
The frozen generator returns:
At :
At , the negative gradients with respect to scaled logits , before a learning-rate multiplier, are
They sum to zero before rounding. Gradients with respect to raw cosine scores are ten times these values because . Passage one receives the largest demotion because its current mass is too high relative to the teacher; passage four, not passage one, has the lowest teacher likelihood. Passage three receives the largest promotion at this operating point. At ,
The divergence becomes nats, times the prior value. The magnitude of passage four’s negative logit gradient becomes , a factor of . Lowering changes the teacher distribution and optimization target, not simply the learning-rate scale. The source’s initial is a heuristic. For matched arithmetic, take batch , , query length , passage length and target length . There are teacher passes, each processing positions, total . The bi-encoder processes each query once and each passage once: positions.
- A frozen seven-billion-parameter teacher has proxy work .
- A fully trained -million-parameter bi-encoder has , omitting similarity-matrix and other overhead.
- Teacher forward work is times this matched encoder step; total work is . The former roughly hundred-fold comparison used unmatched/unspecified token counts. The source names LM-supervised REPLUG and RA-DIT as applications; their precise KL, utility and trainable components must be checked per implementation. A short adaptation over a pretrained retriever can be practical, but depth, mining and teacher costs remain workload-dependent. Combine direct candidate feedback with refreshed negatives and representative misses. A shared frozen document tower with generator-specific query encoders avoids automatic full re-encoding, though fixed document geometry can limit adaptation. A reranker is another model-specific option, not an automatic substitute for missing evidence.
28.6 Index refresh during training
What
A dense retriever scores:
An index records the document-encoder snapshot that produced its vectors. If document-side representations change, comparing current queries with old vectors can misalign scores and change candidates. Query-only updates do not inherently create obsolete document vectors, although their calibration and retrieval quality can still change. Let be full re-encode work, training work per step and builder arithmetic throughput divided by trainer throughput. Measure actual build/step times when the two workloads sustain different utilization.
Use , , , , document length and query length . Both trained towers are charged. Ignoring query encoding gives the old document-only step ; including it gives
For one serial builder with one snapshot every trainer steps, steady-state capacity requires integer at least the build duration in step-time equivalents:
Ignoring endpoint and non-encoding costs, inline refresh every steps has arithmetic-work multiplier
Inline refresh pauses the trainer, encodes the current snapshot and resumes with zero snapshot age; age then rises to about training updates, not . In steady-state asynchronous service, a snapshot published after trainer-step times has age in approximately before the next publication. The special delayed-publication schedule gives . That band is not a universal property of asynchronous refresh. Build queues, publication delays and variable trainer rate can increase age; startup needs a real initial index, not a fictitious negative-step checkpoint.
Why
Old document vectors can create score inconsistency, and stale candidates can become easy negatives. The source associates asynchronous mined negatives with ANCE. Falling loss with flat held-out recall is compatible with negative stagnation, not proof of that cause. Probe current representations, candidates and full task quality separately.
Failure without it
Training a still-shared encoder changes both query and document functions, so stored document vectors may need refresh. A formerly tied checkpoint can be untied into a trained query copy and frozen document copy. Partial refresh can help under a version-aware, representative policy; it is not inherently rank calcification, but mixed versions need explicit handling. Re-encode/rebuild from the final document checkpoint when that function changed, including a final extra encode if the last asynchronous publication is older. No model-driven full re-encode is automatically required after query-only or reranker-only updates.
Cost and complexity
The following -step ledger uses the same query/document layout and full above. Re-encode cost excludes graph construction and publication; all throughput assumptions are idealized.
- One corpus encode equals about query-plus-document steps, not the document-only .
- The source stipulates graph distance evaluations. At FLOPs per width- dot product this is ; the number of evaluations is an assumption, not a universal HNSW complexity bound.
- Encoding has times that stipulated arithmetic work. Graph memory access, comparisons, construction parameters and parallelism differ, so this ratio does not prove the wall-time bottleneck or a fixed graph-build speedup. Assume eight accelerators at the source-reported peak TFLOP/s each and stipulated utilization , yielding . One utilization factor for training, encoding and search is a simplification, not a measured device property.
- The step arithmetic time is and full encode .
- Refresh-free training is hours; encoding after every step gives days in the serial proxy, excluding initial index and overhead.
- At inline , fifty charged encodes give multiplier , total hours and encoding share . Snapshot age rises from zero to about five hundred updates between inline refreshes, not one thousand.
- At equal builder/trainer arithmetic throughput, the capacity floor is . A separate equally provisioned builder can overlap encodes in this ideal model, but doubles allocated hardware, not magically removes compute or interference.
- If publication is deliberately one interval after snapshot, age rises from to just below steps, a conservative maximum near of the run. An actual builder duration gives a different age band. Ten million width- fp16 vectors have raw payload. Flat exact search avoids HNSW graph construction, not encoder refresh or stored-vector staleness. A materialized fp32 score matrix for sixty-four queries adds ; tiled search/top- can avoid retaining the full matrix, with other workspace and identifiers still additional.
This is approximately of the declared encoder-step FLOPs, not a wall-time fraction; vector reads and selection cost matter. Adding the matched frozen seven-billion teacher from Section gives total , hence
A 500-step inline cadence then costs:
Teacher scoring makes refresh about times smaller relative to the enlarged step denominator; it does not make one refresh intrinsically cheaper. A probe that re-encodes sampled chunks and evaluates questions has the following encoding component; searches, reference comparisons and any reader scoring cost extra.
- Probe encoding is , about bare steps or one percent of a -step interval before other work.
- The proposed top- overlap floor of is a source heuristic, not a recall or answer-quality guarantee. High overlap can preserve stale/wrong passages; low overlap can reflect useful updates.
- A sampled subset cannot generally certify full-corpus staleness without a representative design and uncertainty analysis. Under these bare-step constants, a five-hundred-step asynchronous interval requires for one serial builder. A refresh/step ratio near one hundred or a corpus below approximately chunks is a budgeting heuristic, not a universal inline boundary. Choose cadence from measured build capacity, version age and retrieval/task quality. Flat search is practical only when its memory, bandwidth and selection costs fit; if used, a serving ANN index may be built after final encoding. Complete a final compatible document index whenever document-side weights changed.
28.7 REALM and retrieval inside pre-training
What
Define the analyzed REALM-like objective on a retrieved candidate set , held fixed for local differentiation. This is a truncated finite-support model, not an exact summation over every corpus block. Let the reader target be the masked token or declared masked span:
Holding reader likelihoods fixed for this score derivative, with positive marginal,
A positive-prior candidate has positive log-likelihood score coefficient exactly when its reader likelihood exceeds the candidate marginal. Coefficients sum to zero across this support, but actual shared-parameter updates need not be independent score-coordinate increments. The reader also trains through its own derivative. A full untruncated model and a score-dependent changing top- require additional approximation/selection analysis.
Why
The likelihood objective needs no human passage-relevance labels, though the system can use supervised warm starts or masking annotations. It trains both retriever towers only if the implementation supplies differentiable paths through their query and selected-document embeddings; a stale vector lookup alone does not update the document encoder. Salient masking can make retrieval more useful, but entities, numbers and dates are heuristics rather than guaranteed information needs. The figure’s example masks the state in “Mount Rainier is in the state of [MASK]”.
Failure without it
If all candidate likelihoods are the same positive value, every score coefficient is zero—whether those equal values are poor or excellent. If the marginal is zero, log likelihood and the displayed ratio are undefined, not a zero-gradient case. Random retrieval or locally predictable masks can yield weak comparative signal, but do not force exact equality. The source reports salient masking and an ICT warm start as useful REALM choices; these are empirical findings, not mathematical guarantees. Moving document representations calls for versioned refresh. A cited five-hundred-step cadence is not portable without builder capacity and quality checks. Masked-token usefulness need not align with counter-argument retrieval, claim verification or instruction-following quality.
Cost and complexity
The figure uses three blocks.
| Block | Prior | Reader likelihood | Log-likelihood score coefficient |
|---|---|---|---|
| Rainier geography | |||
| Cascade Range | |||
| Rainier etymology |
The toy marginal is exactly , with coefficients summing to zero before rounding. The arithmetic scenario uses two separately charged -million-parameter retriever towers plus a -million-parameter masked reader, about million listed parameters before architecture details. There are million length- blocks, masked-input length , , batch , steps, one charged full re-encode per steps, and sustained . Each reader branch sees input plus one block, length . To train document-side scoring, selected documents are encoded through the current trainable tower even though candidate discovery can use a stale index. This is an explicit full-gradient proxy, not a claim to reproduce the original implementation’s exact execution.
- Closed-book reader training is .
- Eight length- reader branches cost , sixteen times closed book. Query plus eight document encodings add , making full per-example work , or twenty-five times closed book before refresh.
- The corpus contains tokens. A full document encode costs and arithmetic device-hours.
- A five-hundred-step window has full training FLOPs plus that encode, total . The matched closed-book window is .
- Refresh is times full window-training work and of total listed work. Total-to-closed-book ratio is ; the old roughly thirty-three-fold ledger is a reader-only subtotal ( with unrounded inputs) that omitted training the retriever towers.
- Four hundred charged windows give arithmetic device-hours versus closed book. Ideal division over sixty-four equal accelerators gives versus hours, not a measured schedule or a guarantee that an asynchronous builder keeps up.
- Initial indexing, any extra final checkpoint-compatible encode, search, communication and actual utilization differences are additional. If the refresh schedule uses stale snapshots, count a final re-encode separately rather than assuming its last publication matches final weights. The chapter reports REALM NQ-Open exact match of versus a T5-11B closed-book score of and an approximate parameter ratio. These are cross-system reported results, not controlled proof of the arithmetic model or retrieval’s isolated gain. It also reports RETRO’s frozen retriever, two-trillion-token datastore and a twenty-five-fold parameter comparison in its own setting; these are not directly comparable to this toy. A -token datastore is times the worked corpus. Re-encoding it with the stated document tower costs : times the full training window, not the reader-only denominator’s . Across four hundred such charged rebuilds plus the full trainer, the proxy is device-hours. This counterfactual motivates considering a frozen document encoder, but is not a prediction for RETRO’s actual architecture. The source’s default of attaching retrieval after pretraining is a design heuristic; a few GPU-days of RAFT cannot be assumed quality-equivalent without matched tests. Warm-starts and document freezing trade adaptation for cost. In this full-gradient ledger, corpus re-encode equals window training at corpus tokens; the boundary is configuration-specific, not a universal ten-billion-token limit.
Diagrams
Figure 28.1
| Retriever frozen | Retriever trained | |
|---|---|---|
| Generator frozen | I. Frozen declared retriever/generator: prompts, chunking, depth and layout; any additional trained reranker is separately classified | II. Train retrieval with a defined objective; document re-encode only if document representations change |
| Generator trained | III. Train a compatible reader or adapter; frozen representations do not prevent corpus-only index updates | IV. Train both with an implementable coupling; budget both gradients and document-side refresh where needed |
With a fixed document encoder, corpus additions still require incremental encoding. Moving a query encoder alone does not invalidate stored document vectors. Under Section ’s basic-step assumptions, a full -chunk encode is basic steps or arithmetic minutes; later larger-batch steps have a different denominator.
Figure : The expensive boundary is a changed document representation, not every move into the trained-retriever column. Full generator training, frozen-teacher scoring, query-only adaptation and document-side encoding have distinct costs. An oracle intervention guides diagnosis but does not uniquely locate every failure.
Figure 28.2
Diagram description and source
flowchart LR
subgraph A["(a) Fusion-in-Decoder: 256 input positions per question-passage view"]
A1["query + passage 1"] --> AE1["encoder"]
A2["query + passage 2"] --> AE2["encoder"]
A40["query + passage 40"] --> AE40["encoder"]
AE1 --> AS1["256 states"]
AE2 --> AS2["256 states"]
AE40 --> AS40["256 states"]
AS1 --> AD["decoder cross-attention over m states"]
AS2 --> AD
AS40 --> AD
end
subgraph B["(b) FiD-Light: first z = 8 vectors kept"]
B1["query + passage 1"] --> BE1["encoder reads 256"]
B2["query + passage 2"] --> BE2["encoder reads 256"]
B40["query + passage 40"] --> BE40["encoder reads 256"]
BE1 --> BS1["8 kept states"]
BE2 --> BS2["8 kept states"]
BE40 --> BS40["8 kept states"]
BS1 --> BD["decoder cross-attention over m states"]
BS2 --> BD
BS40 --> BD
end
FiD has visible states and cross-KV payload. Light has and . The declared per-token weight-plus-cross-cache stream proxies are and ; encoder-only arithmetic is the same , while static cross-KV preparation differs ( versus ). These are scoped components, not measured latency.
Figure : Independent passage views remove cross-view encoder attention, and the decoder jointly uses their states at every output step. Light reduces static cross-KV preparation and cache payload by under these shapes, not every decoder component or total latency by that factor. Compatible training, output-token count and quality determine the actual trade-off.
Figure 28.3
Diagram description and source
flowchart LR
subgraph H["Hard identities"]
H1["scores"] --> H2["hard top-k identities"] --> H3["reader text input"] --> H4["answer loss"]
H4 -.-> HB["No ordinary identity-selection derivative away from crossings"]
end
subgraph G["Continuous surrogate"]
G1["fixed candidate scores plus independent Gumbel noise"] --> G2["compatible relaxed mask or representations"] --> G3["differentiable reader interface"] --> G4["relaxed objective"]
end
subgraph ST["Straight-through surrogate"]
S1["scores plus noise"] --> S2["hard forward choices"] --> S3["reader with explicit mask-gradient interface"] --> S4["surrogate backward derivative"]
end
Figure : A compatible continuous representation/mask interface is part of the method; changing a selector alone does not differentiate raw strings. Categorical softmax is a one-choice relaxation, whereas a multi-hot top- mask needs its own surrogate. Independent noise enables a pathwise derivative of the relaxed objective; finite-temperature and straight-through training do not give an unbiased gradient of the original discrete objective. Noisy hard selection also differs from deterministic serving selection.
Figure 28.4
Diagram description and source
flowchart TD
X["Original request x: retrieve once"] --> R["Frozen retriever: top k and fixed normalized lambda"]
R --> D1["Document 1"]
R --> DK["Document k"]
P["Common selected output prefix"] --> L1["Frozen LM branch 1, with its document"]
P --> LK["Frozen LM branch k, with its document"]
D1 --> L1
DK --> LK
L1 --> M["Mix normalized next-token distributions using fixed lambda"]
LK --> M
M --> A["Select one token and append it to every branch prefix"]
A -.-> P
Concatenated RAG fuses evidence within one prompt; this REPLUG variant fuses normalized next-token probabilities under a common prefix. Retrieval happens once for the declared answer, not once per selected token.
Figure : For a fixed prefix and token, a branch’s nonnegative contribution is bounded by its normalized . This is not a raw-score bound, causal provenance certificate or a bound on the entire answer’s dependence on that passage. Exact implementation needs adequate probability and continuation access, plus accounting for branch preparation and every output step.
Figure 28.5
| Passage | Retriever | Teacher | Negative scaled-logit gradient |
|---|---|---|---|
| and below | Not directly scored here | Not in this candidate teacher | Zero direct independent coordinate derivative; shared updates can change later ranks |
Diagram description and source
flowchart LR
X["Query x and verified target y"] --> E["Trainable query and optionally document encoder"]
E --> T["Candidate set held fixed locally"]
T --> PR["P from retrieval scores divided by gamma"]
T --> LM["Frozen teacher scores gold answer per passage"]
LM --> Q["Q from utilities divided by beta, stop teacher gradient"]
PR --> KL["Declared KL: P to Q"]
Q --> KL
KL -.-> U["Backpropagate temperature-scaled score gradients into shared retriever parameters"]
U -.-> E
E --> R["Refresh document index if its encoding function changed"]
Figure : The listed directions are for , not raw cosine updates; at , raw-score derivatives are ten times larger. Passage one has the largest mismatch-driven demotion, while passage four has the lowest teacher utility. The directions sum to zero before rounding. Direct off-support score supervision is absent, but shared representation changes can move outside candidates later. The frozen teacher requires gold-answer likelihood access; it supplies no document-truth certificate.
Figure 28.6
Diagram description and source
flowchart LR
T0["Snapshot at step jK"] --> B["Build with immutable document-encoder snapshot"]
B --> P["Publish after D trainer-step times"]
P --> I["Live index age starts at D"]
I --> N["Next publication after K more trainer steps: age approaches D plus K"]
S["Special schedule: deliberately publish one interval later, D equals K"] -.-> P
Q["Steady-state single-builder capacity requires build duration no greater than K"] -.-> B
| Inline interval | Arithmetic multiplier, full query/document step |
|---|---|
At equal stipulated arithmetic throughput, . The delayed-publication choice gives age in steady state. An inline current-snapshot rebuild instead resets age to zero and rises to about updates; a faster asynchronous publication gives .
Figure : Capacity and quality constrain cadence through different quantities. The curve is inline work accounting, not asynchronous wall time. A single equal-throughput builder cannot sustain intervals below under these constants without more builder capacity or changed work. Delays/queues affect version age; a top- overlap heuristic alone does not certify recall or correctness.
Figure 28.7
Diagram description and source
flowchart TD
X["Masked input: Mount Rainier is in the state of MASK; target Washington"] --> Q["Encode query; search stored snapshot vectors for candidates"]
Q --> E["Re-encode selected documents through current trainable tower for score gradients"]
E --> Z1["Geography: prior 0.50, reader 0.62, coefficient plus 0.411764706"]
E --> Z2["Cascades: prior 0.30, reader 0.08, coefficient minus 0.229411765"]
E --> Z3["Etymology: prior 0.20, reader 0.03, coefficient minus 0.182352941"]
Z1 --> M["Marginal 0.34; posterior minus prior coefficients sum to zero"]
Z2 --> M
Z3 --> M
M --> U["Train reader and query/document towers through declared paths"]
U --> R["If document representations change, snapshot and refresh the corpus index"]
R -.-> Q
Figure : The finite-support score derivative compares each reader likelihood with the marginal; it is not a human relevance label. Equal positive likelihoods give zero comparative score signal, while a zero marginal makes log likelihood undefined. Current selected-document encoding supplies the document gradient; merely looking up stale vectors would not. The corrected resource ledger charges both retriever towers, the masked reader and corpus encodes.
Whiteboard pack
What to draw
- Draw retriever parameters and generator parameters , with query-only versus document-side adaptation distinguished.
- Put a hard identity-selection gate between retrieval and the reader, and mark any additional differentiable score path separately.
- Draw the freeze/train matrix, plus an oracle intervention and production sufficient-evidence hit/miss measurements.
- Write and explain why alone is not an accuracy ceiling.
- Draw sequence marginalization, a stochastic score-function estimator and a compatible Gumbel surrogate as different objectives/interfaces.
- Draw FiD passage views feeding one decoder, and separate static cross-KV preparation from per-token cache reads.
- Draw REPLUG’s fixed per-request retrieval weights and a common output prefix across branches.
- Write the declared and before taking its gradient.
- Draw encode/build/publish stages with age ; mark as the special delayed-publication schedule and inline age separately.
- Close with the fully charged REALM-like query tower, document tower, masked reader and corpus rebuilds; distinguish reported quality from the compute proxy.
Spoken script
Diagnose production evidence sufficiency and reader correctness before choosing a quadrant. Oracle context is an intervention, not a universal decision rule or proof that accuracy is bounded by recall. Hard identities need another learning route: a finite-support marginal, an unbiased stochastic estimator under its assumptions, or an explicit differentiable surrogate. FiD jointly reads separate passage views; REPLUG mixes token probabilities through a compatible frozen interface and common prefix. LM supervision gives direct feedback only for scored candidates, but shared retriever updates can alter other ranks. If document representations change, budget versioned rebuilds using measured capacity and distinguish inline age from asynchronous publication delay. REALM trains comparative retrieval usefulness during masked prediction; the explicit full three-tower scenario is approximately forty-two-fold closed-book work, not the former reader-only thirty-three-fold total.
Interview traps
Probe 1: “Our RAG assistant is wrong. Should we fine-tune the LLM?”
Answer: Use representative oracle, closed-book and production hit/miss probes. Gold-context gains suggest an evidence/context intervention helped; flat results do not uniquely prove generator failure. Query-only tuning avoids document re-encoding but cannot recover distinctions lost in fixed document vectors. FiD is suitable for a compatible trainable encoder-decoder reader. In this chapter’s revised partial arithmetic/streaming proxy, Light saves about at three output tokens and has ratio at tokens, but actual latency and quality require measurement.
Probe 2: “Why did joint training move the generator but not the retriever?”
Answer: The hard identity map is locally constant, so that path supplies no ordinary score gradient. A sequence marginal is exact on its declared finite support, not necessarily the whole corpus or the same as token ensembling. REINFORCE is unbiased with a correctly specified stochastic objective, action-independent baseline and any required direct reward derivatives. Gumbel argmax gives the categorical softmax sample; finite-temperature relaxation changes the objective, and straight-through substitutes a biased backward path. A compatible continuous reader/mask interface and a proper multi-hot surrogate are needed. Temperature schedules are empirical choices, not a universal fix.
Probe 3: “The generator is a black-box API. How do we use ten passages?”
Answer: Token ensembling requires adequate next-token probability and common-prefix continuation access; a text-only endpoint cannot implement it exactly. Retrieve once, mix normalized branch distributions and append the same chosen token to every branch. Under the hypothetical rates, the uncached sixty-four-token scenario is versus concatenation’s ; persistent KV with the declared billing treatment is , still more expensive. FiD is an alternative only with a compatible architecture/training interface, not merely because weights become accessible. Selecting one passage is another algorithm with different evidence/quality behavior.
Probe 4: “Recall improved, answer accuracy did not, and the index is old. What do you train?”
Answer: Verify evidence and oracle/production slices rather than infer the repair from recall alone. With a frozen trusted teacher and fixed local support, declare the KL direction and include the score chain rule. Off-support documents get no direct candidate-coordinate teacher feedback, but shared updates and new mining can change future discovery. Version document representations; choose cadence from measured build/step capacity and task quality, not overlap alone. Inline rebuilds reset age to zero; asynchronous age is , with only for . Re-encode from final document weights if they changed.
Probe 5: “REALM uses no relevance labels. What trains its retriever, and why not scale it to two trillion tokens?”
Answer: The finite-support gradient is posterior retrieval mass minus prior mass. A candidate is promoted when its reader likelihood exceeds the marginal; equal positive likelihoods give zero score signal, not every vaguely useless set. A zero marginal is undefined. Warm starts and salient masking can help empirically. Training document-side scores requires a gradient through current document encodings and a versioned stored index. In the explicit full-gradient toy, all training is twenty-five times closed-book before refresh and times after charged rebuilds, with in encoding. A two-trillion-token encode is times the full trainer window; the old ratio used the reader-only denominator. These counterfactual costs motivate a frozen document tower but do not reproduce RETRO or establish equal quality.
Key numbers
| Topic | Audited values, assumptions and interpretation |
|---|---|
| Opening case | Source opening: accuracy versus target, eight weeks, four accelerators and chunks; two-point reported gain after six weeks is not a controlled stage attribution. |
| Model sizes | retriever versus generator parameters; ratio . Parameter ratio is not total training cost. |
| Basic refresh | Encode ; basic step ; ratio basic steps under Section token counts. |
| Quadrant runs | examples, processed positions, three epochs: generator hours. Bare -step retriever plus ten encodes: hours, encoding. Total/gradient-only ratio ; serial sum hours excludes teacher and other overhead. |
| Corpus-scale contrast | chunks: ; five-percent turnover: ; full document-model encode: minutes. These are encoding components. |
| FiD shape | , total per-query/passage view length , states. Three words in the opening need not be three tokens. |
| FiD attention | Encoder attention only: concatenation TFLOP versus separate views TFLOP; exact forty-fold ratio only for the stated equal-partition abstraction. |
| FiD encoder time | Encoder linear-plus-attention: versus arithmetic. Static cross-KV preparation adds for FiD or for Light. |
| FiD decoder traffic | FiD cross-cache ; per-step weight stream including output head but excluding already cached cross-KV projection weights. Total , in the one-read model. |
| FiD-Light | , states, cross-cache, stream; decode-stream ratio , not measured latency or a quality guarantee. |
| FiD-Light by answer length | Partial proxy at : versus , saving . At : versus , ratio . |
| FiD cache crossover | Cross-cache equals the declared weight stream at states, so integer crossover is ; model/traffic assumptions change it. |
| Gumbel base and Jacobians | ; top categorical mass . On the fixed draw, at and at . |
| Gumbel variance | Same-entry ratio on one draw: about , not a typical-gradient/variance estimate. Diagonal bound at is ; bound/draw ratio about . |
| Pairwise calibration | Ninety-percent two-way win probability needs margin ; current gives , requiring more logits. This is not the multicandidate top-one probability. |
| Gumbel compute | Eight passage branches: prompt plus target positions versus top-one plus . Eight-fold token-position ratio, not a general end-to-end cost guarantee. |
| REPLUG weights | Gold weight at and at for the specified ten scores. |
| REPLUG correct-token mass | Normalized two-token example: correct mass at and at ; gold-only correct mass . |
| REPLUG wrong majority | Wrong mass at . Correct wins only above gold weight , requiring for these scores. Token distributions must be declared consistently. |
| REPLUG bills | Hypothetical bill: concatenation ; uncached branch input tokens costing , output , total , ratio . Persistent-KV billing scenario , ratio ; actual endpoint support/pricing must be checked. |
| REPLUG reported gains | Chapter-reported gains for GPT-3 language modeling and for Codex five-shot MMLU; preserve their source metrics and denominators, not a verified production effect. |
| LM-supervised | Reported opening: labeled pairs, six weeks and four recall points with flat exact match. Worked student probabilities: , , , . |
| LM-supervised and KL | At , teacher probabilities , , , and declared reverse-teacher KL nats. |
| LM-supervised updates | Negative scaled-logit derivatives: , , , . Sum zero before rounding; raw-score derivatives are ten times larger at . |
| Lower- target | At , teacher probabilities , , , , KL nats, ratio . A temperature change alters the target, not just learning rate. |
| Lower- effect | Passage-four negative-logit-gradient magnitude rises by under the stated temperatures; it is not a general amplification constant. |
| LM-supervision cost | Batch , depth , query/passage/target lengths : teacher passes and positions, . Matched bi-encoder ; teacher/encoder ratio . |
| Bare refresh economics | Opening convergence/stagnation anecdotes are reported, not proven causation. Query-plus-document refresh/step ratio ; the old omitted query encoding. Stipulated graph dot-product work is times smaller, not necessarily that much faster. |
| Refresh extremes | Eight devices, peak TFLOP/s and utilization : . Step , encode , refresh-free hours, encode-every-step days under ideal serial accounting. |
| Inline | Inline : multiplier , hours and encoding. Index age resets to zero then approaches five hundred trainer updates, not one thousand. |
| Asynchronous builder | Equal-throughput one-builder capacity floor . Deliberate one-interval publication delay gives maximum age just below updates, about of the run. General age is . |
| Flat search | Flat vector payload ; un-tiled fp32 sixty-four-query score matrix . Dot-product work is of encoder-step FLOPs, not a latency fraction or a substitute for re-encoding. |
| Teacher-adjusted refresh | Matched teacher enlarges total step to : refresh ratio , inline-five-hundred multiplier . Intrinsic refresh work is unchanged. |
| Staleness trigger | -chunk probe encoding equals bare steps; search/quality checks cost extra. Overlap floor is a heuristic, not a recall/correctness guarantee. |
| REALM setup | Source opening uses frozen B generation. Separate worked toy: two M retrieval towers plus M masked reader, M blocks, length , depth , batch , steps and -step charged encode interval. |
| REALM reader cost | Closed reader per example; retrieved reader , sixteen-fold. Adding both retrieval towers gives , twenty-five-fold before refresh. |
| REALM total cost | Full toy including charged encodes: times closed-book work, with in re-encoding. The prior approximately thirty-three-fold ledger omitted retriever training. |
| REALM device-hours | versus arithmetic device-hours; ideal sixty-four-device division versus hours. Initial/extra final encoding and systems overhead are additional. |
| REALM result | Reported NQ-Open EM versus T5-11B and parameter ratio about ; cross-system results do not isolate retrieval or validate this compute toy. |
| RETRO scale | Reported frozen RETRO datastore tokens, times the worked -token corpus; architecture and training protocol differ. |
| RETRO refresh counterfactual | Counterfactual full rebuild costs full trainer windows per encode; reader-only denominator gives . Four hundred such encodes plus trainer total about device-hours, not RETRO’s actual measured cost. |
00-START-HERE · 01-READING-ROUTES · 27_fine_tuning_the_generator · 29_bootstrapping_training_data