Core Concepts¶
This page is the mental model of ALF’s objects: what each one is, and how they combine into a
single round of the ask/tell loop. All of these live in
alf_core; concrete implementations live in alf_tools.
The objects¶
Object |
Role |
Base class |
|---|---|---|
|
The candidate pool and its labels; train/validation splits and a query interface |
|
|
A learnable predictor with |
|
|
Wraps a model; the cheap approximation retrained each round on acquired data |
|
|
Wraps a scorer (a model or a dataset); returns the true label for a batch |
|
|
Scores candidates by expected value (e.g. Greedy, UCB, EI, Thompson, CoreSet) |
|
|
Generates the candidate pool to score (e.g. from a dataset or a generator) |
|
|
Bundles an acquisition + search function; implements |
|
|
Orchestrates the loop end to end ( |
|
|
The carrier passed through the loop: dataset, surrogate, round, history, metrics |
The key relationships: a Surrogate wraps a Model, an Oracle wraps a scorer, and an Optimizer bundles an acquisition function and a search function. The Task owns the loop and threads a single State object through every step.
How one round flows¶
A round is exactly the ask then tell of the Optimizer:
ask(state):
pool = search_fn(state) # Search proposes candidates
scored = acquisition_fn(pool, state) # Acquisition scores them
batch = scored.get_top_k(acq_batch_size)
→ return the batch to evaluate
oracle.evaluate(batch) # true labels revealed
state.dataset += labelled batch # knowledge grows
tell(state):
surrogate.fit(train, val) # retrain on the larger dataset
→ update round metrics (regret, recall, calibration, …)
After tell, the round’s metrics are recorded in state.round_metrics and the loop repeats for
the configured number of rounds.
Three task families¶
The kind of Task you pick determines what is being optimised. These three map directly onto
ALF’s experiment taxonomy:
experiment
├── design → DesignTask pick candidates that maximise an objective (the AL loop above)
├── supervised → SupervisedTask iteratively label to improve a predictor on a fixed pool
└── zero-shot → ZeroShotTask score with a pretrained model, no surrogate training
Within a family, an experiment is further specified by modality (e.g. protein sequence,
small-molecule SMILES), dataset, and mode (Offline or Online). The full
cross-product, dataset × surrogate × acquisition × search × oracle × seed, is exactly what the
ALF benchmark suite sweeps over; see Why ALF?.
Putting it together¶
The 15-line quickstart on the home page is precisely these objects wired up: a
GFP dataset, a CNNModel inside a Surrogate, an Optimizer holding Greedy + DatasetSearch,
an Oracle scoring against the dataset, run by a DesignTask. Once the mental model above is
clear, that snippet reads as “compose the loop from parts.”
→ Look up any unfamiliar term in the Glossary, or try a tutorial.