Skip to content

Language models, retrieval, prompting, and language adaptation · Long-context and retrieval-augmented language · LNG053 · Model

Atlas retrieval-augmented language model

Combines a retriever and sequence-to-sequence reader to support knowledge-intensive learning with limited task examples.

Explained here Component demo, not a trained model CodeSplash's own run

In CodeSplash

Documented in the Academy only. There's no Set up button.

Availability
Explained here
Code example
Component demo, not a trained model
Who ran it
CodeSplash's own run
CodeSplash's run
The reference's example ran in Python and R here, and they agree.
The reference's record
Python: The chapter's authors report running it; there is no record for this entry alone. R: Reviewed but not run: R wasn't available to the reference's authors.

Purpose

Combines a retriever and sequence-to-sequence reader to support knowledge-intensive learning with limited task examples. The model explores how retrieval-aware pretraining and adaptation can shift knowledge dependence toward an external corpus.

Question / objective

Can retrieval-aware pretraining improve knowledge-intensive learning from few task examples?

Architecture / computational structure

A retriever and fusion-style reader interact through reader-derived learning signals. Learned encoders/decoder are parameters; retrieval-loss choice, index refresh, passage count, and adaptation example budget define the experiment.

Assumptions

Few-shot gains depend on corpus coverage, example selection, and reader/retriever interaction.

Formula / computational definition

Ldistill=−∑zqreader(z∣x,y)log⁡pretriever(z∣x)(illustrative reader-supervised component).\mathcal L_{\mathrm{distill}}=-\sum_z q_{\mathrm{reader}}(z\mid x,y)\log p_{\mathrm{retriever}}(z\mid x)\qquad\text{(illustrative reader-supervised component).}

Retrieved passages condition a reader loss; retriever learning uses reader-derived supervision rather than only explicit relevance labels. Several retrieval-training objectives are studied, so one must specify which objective is being reproduced.

Parameters and notation

Learned parameters: identified in the architecture subsection. Hyperparameters, design and inference choices: Retriever initialization, passage count, corpus, reader size, index refresh cadence, retrieval loss, and adaptation budget.

Fitting, fine-tuning, and adaptation

Follow the selected Atlas retrieval objective rather than substituting an unspecified RAG recipe. Compare frozen retriever, retriever-only, and joint adaptation; use compatible adapters where supported. Validate few-shot selection variance, updated-corpus behavior, evidence attribution, and retention on previous tasks.

How to use and calibrate

Compare fixed-example adaptation curves, corpus updates, retrieval ablations, answer accuracy, evidence use, and training/inference costs. Use development data for settings and an independent test set for the final estimate. Report uncertainty across examples or seeds when the evaluation design supports it; model scores and self-assessments are not automatically calibrated probabilities of correctness.

Example application

Adapt an evidence-based question-answering system from a small labeled set.

Interpretation / pitfalls

Watch out

Updating the corpus can alter outputs without updating weights, making versioned evaluation essential. The code below isolates one stated component; successful execution does not validate model quality or reproduce the cited experiment.

Python and R code examples

Full implementation route: Use the authors' Atlas repository for exact training configurations; a generic RAG framework is only a conceptual route. R bridges the Python code via reticulate. The native example calculates a distillation-style retriever loss from reader-derived scores, clearly labeled as one illustrative training component.

Example scope: An illustrative Atlas-style reader-to-retriever distribution distillation component.

Dependencies: Python 3 standard library; base R; shared setup above. No model downloads or external services.

Validation: Python component executed in the combined example script; R counterpart supplied but not runtime-tested here. All numbers are synthetic.

Python and R

The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.

Python

Component demo, not a trained model — An illustrative Atlas-style reader-to-retriever distribution distillation component.

Shared setup for this chapter
import math

def softmax(xs):
    m = max(xs)
    es = [math.exp(x-m) for x in xs]
    return [e/sum(es) for e in es]

def dot(a, b):
    return sum(x*y for x, y in zip(a, b))

def matvec(matrix, vector):
    return [dot(row, vector) for row in matrix]

def meanvec(rows):
    return [sum(row[j] for row in rows)/len(rows) for j in range(len(rows[0]))]

def sigmoid(x):
    return 1/(1+math.exp(-x))

def nll(probabilities):
    return -sum(math.log(p) for p in probabilities)
reader_target = softmax([2.0,0.5,-0.5])
retriever = softmax([1.0,0.2,-0.1])
print(-sum(p*math.log(q) for p,q in zip(reader_target,retriever)))
R

Component demo, not a trained model — An illustrative Atlas-style reader-to-retriever distribution distillation component.

Shared setup for this chapter
softmax <- function(x) {
  shifted <- exp(x-max(x))
  shifted/sum(shifted)
}
reader_target <- softmax(c(2,0.5,-0.5))
retriever <- softmax(c(1,0.2,-0.1))
print(-sum(reader_target*log(retriever)))

Sources

From the CodeSplash reference, entry LNG053.