Skip to main content
Gradient-Guided Mutation Generator

This generator 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
ProtoProtoevo-design/proto-language
View source
Generator contributors
Sample substitutions ranked by a first-order estimate of their energy change.
For each proposal the current sequence is written as one-hot logits (L, V) and the stage’s differentiable constraints (compiled with compile_gradient_providers) return the weighted gradient d(energy)/d(logits). Substituting new at position i is estimated to change the energy by grad[i, new] - grad[i, current]. masking_strategy sets the substitution count and fixed positions; that many substitutions at distinct free positions are drawn from a softmax over -estimate / (relative_temperature * std), where std is the spread of the estimates over the allowed substitutions, so the draw does not depend on the energy’s scale. The draw is uniform when the spread is at float32 rounding level relative to the largest gradient entry, which includes every estimate being equal. The owning optimizer supplies its constraints via _bind_constraints; non-differentiable ones are ignored. Unlike the temperature of the other generators, which divides a model’s log-probabilities, and of MCMCOptimizer, which divides raw energy differences, relative_temperature is in units of the estimates’ spread. Constraint energies are weighted [0, 1] scores, not log-probabilities, and their per-substitution estimates span orders of magnitude across constraints, so no single raw-unit default suits them. Gibbs-with-gradients samplers divide raw estimates instead (Grathwohl et al., 2021).

API Reference

ConfigGradientGuidedMutationGeneratorConfig Source
Configuration for gradient-guided substitution sampling.
MaskingStrategy
Mutation count and fixed positions; the gradient picks which free positions change.
number
default:"1.0"
Softmax temperature over -estimated energy change, in units of its std; lower is greedier.

Usage

python

Metadata