Skip to main content
AbLang Perplexity
License: AbLang is open source and free for academic and commercial use under a BSD-3-Clause license. Please refer to the license for full terms.

This constraint 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.


Go to Tool Page
evo-design/proto-language/proto_language/constraint/sequence_scoring/ablang_perplexity_constraint.py
View source
Copy citation
Constraint contributors
Forward AbLang antibody scoring via masked pseudo-log-likelihood.
The returned score is raw AbLang mean negative log-likelihood by default, so lower is better and the forward score matches the loss used by ablang_perplexity_gradient_backward. Set score_mode="ppl" to return perplexity instead. Metadata always includes ablang_log_likelihood (sum of per-residue log-likelihoods), ablang_avg_log_likelihood (mean), ablang_nll, ablang_loss, and ablang_perplexity. With no slices, the whole binder is scored as a heavy-only VHH/nanobody. With heavy_slice and light_slice set, the function extracts VH and VL from a single binder Segment and scores them as a paired scFv.

API Reference

ConfigAbLangPerplexityConfig Source
Configuration for AbLang perplexity scoring (forward + gradient).
number
required
Softmax temperature for AbLang (fixed for this constraint, not varied per optimizer step).
boolean
default:"True"
Hard one-hot forward pass with soft-probability gradients.
string
default:"cuda"
Device for AbLang execution, e.g. ‘cuda’ or ‘cuda:0’.
array
VH region (start, end) within the binder; set with light_slice for scFv mode.
array
VL region (start, end) within the binder; set with heavy_slice for scFv mode.
enum
default:"nll"
Return raw mean NLL by default, or AbLang perplexity when set to ‘ppl’.Options: nll, ppl
number
default:"1.0"
Pre-scale raw logits before AbLang; gradients are scaled back by the same factor.
SequenceLogitBiasConfig
Declarative sequence-symbol bias (canonical 20-AA protein) added before AbLang.
ReturnsConstraintOutput
Per-proposal AbLang scores with log-likelihood, NLL, loss, and perplexity metadata.

Usage

python

Metadata