Language models, retrieval, prompting, and language adaptation · Instruction, preference, and parameter-efficient adaptation · LNG062 · Training method
T0 prompted multitask training
Trains a sequence-to-sequence model on many datasets expressed through diverse natural-language prompts, aiming for transfer to unseen tasks.
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
Trains a sequence-to-sequence model on many datasets expressed through diverse natural-language prompts, aiming for transfer to unseen tasks. Prompt diversity is part of the training data rather than merely an inference-time trick.
Question / objective
Can training across many prompt templates improve generalization to unseen task formulations?
Architecture / computational structure
A text-to-text base model is trained over prompted dataset mixtures; templates and verbalizers shape inputs/targets. Learned model/adapters are parameters; prompt inventory, task weights, and sampling rules are hyperparameters.
Assumptions
Template artifacts may reveal labels or overfit benchmark conventions.
Formula / computational definition
Optimize -E_(task,template,x,y) log p_theta(template_target(y)|template_input(x)). Multiple templates can express different task formulations, so target construction and answer-choice formatting materially affect the objective.
Parameters and notation
Learned parameters: identified in the architecture subsection. Hyperparameters, design and inference choices: Dataset mixture, template inventory, prompt sampling, label verbalizers, base text-to-text model, and task holdouts.
Fitting, fine-tuning, and adaptation
Use supervised text-to-text losses with carefully separated task holdouts. Freeze base weights with compatible adapters or fine-tune jointly; do not choose test-set prompts retrospectively. Validate average and worst-template performance, label-word sensitivity, and retention on previously supported tasks.
How to use and calibrate
Report held-out task performance, template variance, sensitivity to label wording, and results aggregated across prompts rather than only selecting the best prompt. 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
Train a classifier-style generator that remains useful when users paraphrase task instructions.
Interpretation / pitfalls
Watch out
Transfer claims must distinguish unseen datasets, unseen tasks, and unseen task categories; these are different generalization regimes. 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 released T0 checkpoints and prompt datasets or reproduce supervised text-to-text training in Python. R can call the model via reticulate and analyze prompt variability natively. The example averages likelihood-based losses across templates without pretending that prompt selection itself updates weights.
Example scope: T0 template-average supervised loss and prompt variability from supplied target probabilities.
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.
Component demo, not a trained model — T0 template-average supervised loss and prompt variability from supplied target probabilities.
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)
p_target = [0.8,0.6,0.4]
losses = [-math.log(p) for p in p_target]
print({"mean_loss":sum(losses)/len(losses),"range":max(losses)-min(losses)})
Component demo, not a trained model — T0 template-average supervised loss and prompt variability from supplied target probabilities.
Shared setup for this chapter
softmax <- function(x) {
shifted <- exp(x-max(x))
shifted/sum(shifted)
}
p_target <- c(0.8,0.6,0.4); losses <- -log(p_target)
print(c(mean_loss=mean(losses),range=max(losses)-min(losses)))
Sources
- Source 1arxiv.org
From the CodeSplash reference, entry LNG062.