
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.

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
Configuration for AbLang perplexity scoring (forward + gradient).
Softmax temperature for AbLang (fixed for this constraint, not varied per optimizer step).
Hard one-hot forward pass with soft-probability gradients.
Device for AbLang execution, e.g. ‘cuda’ or ‘cuda:0’.
VH region (start, end) within the binder; set with light_slice for scFv mode.
VL region (start, end) within the binder; set with heavy_slice for scFv mode.
Return raw mean NLL by default, or AbLang perplexity when set to ‘ppl’.Options:
nll, pplPre-scale raw logits before AbLang; gradients are scaled back by the same factor.
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
| Property | Value |
|---|---|
| Key | ablang-perplexity |
| Function | ablang_perplexity_constraint |
| Category | sequence_scoring |
| Mode | dual |
| Uses GPU | True |
| Supported Types | protein |