> ## Documentation Index
> Fetch the complete documentation index at: https://proto.evodesign.org/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# IgLM Perplexity

> Score antibody naturalness by IgLM mean NLL under chain/species conditioning.

![IgLM Perplexity](https://proto-bio.github.io/proto-assets/images/constraint/iglm-perplexity/hero.png)

> [!NOTE]
>
> **License:** IgLM is licensed under Custom (JHU Academic Software License Agreement) and has restrictions around commercial use and may require explicit attribution when utilized. Please refer to [the license](https://github.com/Graylab/IgLM/blob/main/LICENSE.md) 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.

***

&#x20;Tools Used Tools Used  Source Source  Cite Cite

![](https://proto-bio.github.io/proto-assets/images/tool/iglm/social.png)

&#x20;Go to Tool Page

[Open](https://proto.evodesign.org/docs/tools/causal-models/iglm.md)

![Proto](https://mintcdn.com/bio-pro/cMLt8hAqaP9M3LKy/assets/logo/logo-light.svg?fit=max\&auto=format\&n=cMLt8hAqaP9M3LKy\&q=85\&s=f5e5dfd1b8f9b9db3a0be0e2eb01f678)

evo-design/proto-language

&#x20;View source

[Open](https://github.com/evo-design/proto-language/blob/1a97e675c7e5e4ae0e92be91b1bb7b49f1331104/proto_language/constraint/sequence_scoring/iglm_perplexity_constraint.py#L80)

@articleshuai2023iglm

```bibtex theme={null}
@article{shuai2023iglm,
  title={IgLM: Infilling language modeling for antibody sequence design},
  author={Shuai, Richard W and Ruffolo, Jeffrey A and Gray, Jeffrey J},
  journal={Cell Systems},
  volume={14},
  number={11},
  pages={979--989.e4},
  year={2023},
  publisher={Elsevier},
  doi={10.1016/j.cels.2023.10.001}
}
```

&#x20;Copy citation

Constraint contributors[![](https://avatars.githubusercontent.com/u/61667248?v=4\&s=64)adititm](https://github.com/adititm)[![](https://avatars.githubusercontent.com/u/21143637?v=4\&s=64)bviggiano](https://github.com/bviggiano)
Score antibody chains by IgLM conditional mean NLL.

## API Reference

ConfigIgLMPerplexityConfig[ Source](https://github.com/evo-design/proto-language/blob/1a97e675c7e5e4ae0e92be91b1bb7b49f1331104/proto_language/constraint/sequence_scoring/iglm_perplexity_constraint.py#L40)

Configuration for IgLM antibody perplexity scoring.

**model\_checkpoint** `enum` (default: IgLM)

IgLM weights variant; 'IgLM' is 13M parameters, 'IgLM-S' is 1.4M

Options: `IgLM`, `IgLM-S`

**chain** `enum` (default: heavy)

Chain-type conditioning token for IgLM.

Options: `heavy`, `light`

**species** `enum` (default: human)

Species-of-origin conditioning token for IgLM.

Options: `human`, `mouse`, `rat`, `rabbit`, `rhesus`, `camel`

**score\_mode** `enum` (default: nll)

Return raw mean NLL by default, or perplexity when set to 'ppl'.

Options: `nll`, `ppl`

**batch\_size** `integer` (default: 8)

Sequences per model forward pass; lower if OOM.

**device** `string` (default: cuda)

Device for model execution, e.g. 'cuda' or 'cuda:0'.

ReturnsConstraintOutput

Per-proposal scores with NLL and perplexity metadata.

## Usage

```python python icon="python" theme={null}
from proto_language.core import Constraint
from proto_language.constraint import iglm_perplexity_constraint, IgLMPerplexityConfig

constraint = Constraint(
    inputs=[segment],
    function=iglm_perplexity_constraint,
    function_config=IgLMPerplexityConfig(
        # Configure parameters here
    ),
)

scores = constraint.evaluate()
```

## Metadata

| Property | Value |
| - | - |
| Key | `iglm-perplexity` |
| Function | `iglm_perplexity_constraint` |
| Category | `sequence_scoring` |
| Mode | `discrete` |
| Uses GPU | `True` |
| Supported Types | `protein` |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.