Skip to main content
each batch: draw B → score → keep the K lowest-energyp(x)xacceptedrejected
each batch: draw B → score → keep the K lowest-energyp(x)xacceptedrejected

This optimizer is open source. Any third-party models, product names, or trademarks referenced are the property of their respective owners, and Proto is not affiliated with them.


Source
evo-design/proto-language/proto_language/optimizer/rejection_sampling_optimizer.py
View source
Optimizer contributors
Rejection Sampling optimizer for sequence optimization through extensive sampling.
Generates many proposal sequences and keeps only the best num_results by lowest energy score. Unlike iterative optimizers (MCMC, beam search), each proposal batch starts fresh from the captured result state (the prior-stage results, or the original sequences on the first stage). There is no state carried between rounds. Each proposal batch:
  1. Resets proposals to the captured result state
  2. Applies all generators sequentially
  3. Evaluates proposals with constraints
  4. Updates the sorted results list if any proposals are better than the current worst
  5. Reports each proposal as its own history iteration
If energy_threshold is set, the optimizer stops early once all best proposals have energy below the threshold.
If filter constraints reject many proposals, the optimizer may return fewer than num_results valid results.

How It Works

Rejection sampling draws many independent proposals from the same starting point and keeps the num_results with the lowest energy, carrying no state between draws. Each batch resets the proposal pool to the initial sequences (the optimizer is stateless), generates B new proposals, scores them, and folds survivors into a buffer of the K = num_results lowest-energy sequences kept in sorted order:
Batches repeat until num_samples proposals have been drawn (or the threshold is met). Because each batch restarts from the same initial pool, the search keeps no per-step state and is embarrassingly parallel.

API Reference

ConfigRejectionSamplingOptimizerConfig Source
Configuration object for RejectionSamplingOptimizer.The Rejection Sampling optimizer generates or receives proposal sequences and keeps only the best num_results by lowest energy score. It processes generated proposals in internal batches and reports each proposal as the semantic iteration.
If filter constraints reject many proposals (returning inf/nan energies), the optimizer may return fewer than num_results valid results.
integer
required
Generated proposal count; in existing-results mode, candidate cap.
integer
Number of top-scoring candidate designs to retain (lowest energy first). Overrides program count.
string
Derived from the generator list when unset: generated if generators are present.
integer
Proposals scored per internal batch. Inferred from component batch sizes if omitted.
number
Optional early-stop (lower energy = better); stops once every retained candidate is below this.
integer
Random seed for reproducible optimization, generator, and constraint tool streams.
integer
default:"1"
Save history and log progress every N steps. Step 0 and final step always saved.
boolean
default:"False"
Save granular per-proposal results (accept/reject) in history snapshots.
boolean
default:"False"
Emit per-step debug information about proposals, scores, and acceptance through the logger.

Usage

python
With early stopping:
python

Metadata