> ## 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.

# Minerva

> [Minerva](https://github.com/garykbrixi/minerva) uses coevolutionary signals to mine microbial genomes and metagenomes for functional elements. Its fast, alignment-free maps of base pairing, protein contacts, and repeats help identify structured non-coding RNAs and genomic systems missed by existing annotations or homology searches.

<div class="page-hero">
  <img class="page-hero-banner" src="https://proto-bio.github.io/proto-assets/images/tool/minerva/hero.png" alt="Minerva" />
</div>

<Note>
  **License:** Minerva is open source and free for academic and commercial use under an Apache-2.0 license. Please refer to [the license](https://github.com/garykbrixi/minerva/blob/main/LICENSE) for full terms.
</Note>

<p class="entity-disclaimer">This toolkit 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.</p>

<hr class="entity-rule" />

<input type="radio" name="tab-minerva" id="none-minerva" class="tab-radio-input" />

<input type="radio" name="tab-minerva" id="github-minerva" class="tab-radio-input" defaultChecked />

<input type="radio" name="tab-minerva" id="hf-minerva" class="tab-radio-input" />

<input type="radio" name="tab-minerva" id="preprint-minerva" class="tab-radio-input" />

<input type="radio" name="tab-minerva" id="cite-minerva" class="tab-radio-input" />

<input type="radio" name="tab-minerva" id="source-minerva" class="tab-radio-input" />

<input type="radio" name="tab-minerva" id="notebook-minerva" class="tab-radio-input" />

<input type="radio" name="tab-minerva" id="proto-minerva" class="tab-radio-input" />

<div class="tool-tab-bar">
  <span class="tool-tab-wrap"><label for="github-minerva" class="tool-tab tab-open badge-github"><svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z" /></svg> GitHub <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" /></svg> 24</label><label for="none-minerva" class="tool-tab tab-close badge-github"><svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z" /></svg> GitHub <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" /></svg> 24</label></span> <span class="tool-tab-wrap"><label for="hf-minerva" class="tool-tab tab-open badge-hf"><img src="https://huggingface.co/front/assets/huggingface_logo-noborder.svg" width="16" height="16" class="hf-logo" /> HuggingFace</label><label for="none-minerva" class="tool-tab tab-close badge-hf"><img src="https://huggingface.co/front/assets/huggingface_logo-noborder.svg" width="16" height="16" class="hf-logo" /> HuggingFace</label></span> <span class="tool-tab-wrap"><label for="preprint-minerva" class="tool-tab tab-open badge-preprint"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" /><polyline points="14 2 14 8 20 8" /><line x1="16" y1="13" x2="8" y2="13" /><line x1="16" y1="17" x2="8" y2="17" /><polyline points="10 9 9 9 8 9" /></svg> Preprint</label><label for="none-minerva" class="tool-tab tab-close badge-preprint"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" /><polyline points="14 2 14 8 20 8" /><line x1="16" y1="13" x2="8" y2="13" /><line x1="16" y1="17" x2="8" y2="17" /><polyline points="10 9 9 9 8 9" /></svg> Preprint</label></span> <span class="tool-tab-wrap"><label for="cite-minerva" class="tool-tab tab-open badge-cite"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 21c3 0 7-1 7-8V5c0-1.25-.756-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1z" /><path d="M15 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z" /></svg> Cite</label><label for="none-minerva" class="tool-tab tab-close badge-cite"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 21c3 0 7-1 7-8V5c0-1.25-.756-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1z" /><path d="M15 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z" /></svg> Cite</label></span> <span class="tool-tab-wrap"><label for="source-minerva" class="tool-tab tab-open badge-source"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6" /><polyline points="8 6 2 12 8 18" /></svg> Tool Source</label><label for="none-minerva" class="tool-tab tab-close badge-source"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6" /><polyline points="8 6 2 12 8 18" /></svg> Tool Source</label></span> <span class="tool-tab-wrap"><label for="notebook-minerva" class="tool-tab tab-open badge-notebook"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z" /><path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z" /></svg> Open as Notebook</label><label for="none-minerva" class="tool-tab tab-close badge-notebook"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z" /><path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z" /></svg> Open as Notebook</label></span> <span class="tool-tab-wrap"><label for="proto-minerva" class="tool-tab tab-open badge-local"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="4 17 10 11 4 5" /><line x1="12" y1="19" x2="20" y2="19" /></svg> Run Locally</label><label for="none-minerva" class="tool-tab tab-close badge-local"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="4 17 10 11 4 5" /><line x1="12" y1="19" x2="20" y2="19" /></svg> Run Locally</label></span>
</div>

<a href="https://github.com/garykbrixi/minerva" target="_blank" class="tab-panel github-panel" data-tab="github-minerva">
  <div class="gh-card-wrap">
    <img src="https://opengraph.githubassets.com/1/garykbrixi/minerva" class="gh-card-img img-fallback" alt="garykbrixi/minerva" />

    <div class="gh-card-fallback">
      <div class="gh-fallback-org"><svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z" /></svg> garykbrixi/minerva</div>
      <div class="gh-fallback-desc">Coevolutionary discovery using genome language models</div>
      <div class="gh-fallback-stats"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" /></svg> 24 stars</div>
    </div>
  </div>

  <span class="panel-goto-btn gh-goto-btn"><span><svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z" /></svg> View repo</span></span>
</a>

<div class="tab-panel hf-panel hf-multi-panel" data-tab="hf-minerva">
  <div class="hf-model-list">
    <a href="https://huggingface.co/gbrixi/minerva-mlm" target="_blank" class="hf-model-card">
      <img src="https://cdn-thumbnails.huggingface.co/social-thumbnails/models/gbrixi/minerva-mlm.png" class="hf-model-card-bg img-fallback" alt="minerva-mlm" />

      <span class="hf-model-card-label"><img src="https://huggingface.co/front/assets/huggingface_logo-noborder.svg" width="16" height="16" class="hf-logo" /> minerva-mlm</span>
    </a>

    <a href="https://huggingface.co/gbrixi/minerva-mlm-8k" target="_blank" class="hf-model-card">
      <img src="https://cdn-thumbnails.huggingface.co/social-thumbnails/models/gbrixi/minerva-mlm-8k.png" class="hf-model-card-bg img-fallback" alt="minerva-mlm-8k" />

      <span class="hf-model-card-label"><img src="https://huggingface.co/front/assets/huggingface_logo-noborder.svg" width="16" height="16" class="hf-logo" /> minerva-mlm-8k</span>
    </a>
  </div>
</div>

<a href="https://doi.org/10.64898/2026.09.22.753630" target="_blank" class="tab-panel preprint-panel" data-tab="preprint-minerva">
  <div class="paper-info">
    <div class="paper-title">Coevolutionary mining of prokaryotic non-coding elements with a genome language model</div>
    <div class="paper-meta">David B. Li, Garyk Brixi, ... Brian L. Hie</div>
    <div class="paper-meta paper-venue">bioRxiv (2026)</div>
  </div>

  <span class="panel-goto-btn preprint-goto-btn"><span><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" /><polyline points="14 2 14 8 20 8" /><line x1="16" y1="13" x2="8" y2="13" /><line x1="16" y1="17" x2="8" y2="17" /><polyline points="10 9 9 9 8 9" /></svg> Read preprint</span></span>
</a>

<div class="tab-panel cite-panel" data-tab="cite-minerva">
  <div class="cite-code-wrap">
    ```bibtex theme={null}
    @article{li2026minerva,
      title     = {Coevolutionary mining of prokaryotic non-coding elements with a genome language model},
      author    = {Li, David B. and Brixi, Garyk and Kim, Alexandra S. and Fiamenghi, Mateus B. and Driscoll, Claudia L. and Evans, Simone A. and Gao, Alex and Ivanova, Natalia N. and Kyrpides, Nikos C. and Deisseroth, Karl and Wilkinson, Max E. and Fischbach, Michael A. and Hie, Brian L.},
      journal   = {bioRxiv},
      year      = {2026},
      doi       = {10.64898/2026.09.22.753630},
      url       = {https://www.biorxiv.org/content/10.64898/2026.09.22.753630},
      publisher = {Cold Spring Harbor Laboratory}
    }
    ```
  </div>

  <span class="panel-goto-btn cite-copy-btn"><span><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 21c3 0 7-1 7-8V5c0-1.25-.756-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1z" /><path d="M15 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z" /></svg> Copy citation</span></span>
</div>

<a href="https://github.com/evo-design/proto-tools/tree/8f803c1c93044c23b17150e72b3f44b1274e9470/proto_tools/tools/masked_models/minerva" target="_blank" class="tab-panel source-panel" data-tab="source-minerva">
  <div class="source-info">
    <img src="https://github.com/evo-design.png?size=40" class="source-avatar" width="36" height="36" />

    <span class="source-path">evo-design/proto-tools<span class="source-subpath">/proto\_tools/tools/masked\_models/minerva</span></span>
  </div>

  <span class="panel-goto-btn source-goto-btn"><span><svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z" /></svg> View source</span></span>
</a>

<a href="https://github.com/evo-design/proto-tools/blob/8f803c1c93044c23b17150e72b3f44b1274e9470/proto_tools/tools/masked_models/minerva/examples/example.ipynb" target="_blank" class="tab-panel notebook-panel" data-tab="notebook-minerva">
  <div class="notebook-info">
    <span class="notebook-icon">
      <svg width="40" height="40" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
        <path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z" />

        <path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z" />
      </svg>
    </span>

    <span class="notebook-label">Open Notebook</span>
  </div>

  <span class="panel-goto-btn notebook-goto-btn"><span><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z" /><path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z" /></svg> Open notebook</span></span>
</a>

<div class="tab-panel proto-panel run-local-panel" data-tab="proto-minerva">
  <a href="https://github.com/evo-design/proto-tools" target="_blank" class="run-local-preview">
    <img noZoom src="https://opengraph.githubassets.com/1/evo-design/proto-tools" alt="proto-tools on GitHub" />
  </a>

  <div class="run-local-install">
    <span class="run-local-label">Run locally with proto-tools</span>

    <div class="run-local-code">
      ```bash theme={null}
      pip install git+https://github.com/evo-design/proto-tools.git
      ```
    </div>
  </div>
</div>

<div class="entity-contributors"><span class="entity-contributors-label">Toolkit contributors</span><span class="entity-contributors-people"><a class="entity-contributor" href="https://github.com/bviggiano" target="_blank" rel="noopener" title="bviggiano: 2 commits"><img noZoom class="entity-contributor-avatar" src="https://avatars.githubusercontent.com/u/21143637?v=4&s=64" alt="" loading="lazy" /><span class="entity-contributor-login">bviggiano</span></a><a class="entity-contributor" href="https://github.com/brianhie" target="_blank" rel="noopener" title="brianhie: 1 commit"><img noZoom class="entity-contributor-avatar" src="https://avatars.githubusercontent.com/u/6365340?v=4&s=64" alt="" loading="lazy" /><span class="entity-contributor-login">brianhie</span></a></span></div>

| Function | Description | |
| - | - | - |
| `run_minerva_embeddings()` | Extract mixed protein/DNA embeddings and biological logits with Minerva (GPU) | <a href="#api-run-minerva-embeddings" class="func-table-btn func-api-btn"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20" /></svg> Docs</a> <a href="https://github.com/evo-design/proto-tools/blob/8f803c1c93044c23b17150e72b3f44b1274e9470/proto_tools/tools/masked_models/minerva/minerva_embeddings.py#L57" target="_blank" class="func-table-btn func-source-btn"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6" /><polyline points="8 6 2 12 8 18" /></svg> Source</a> |
| `run_minerva_gradient()` | Differentiate masked pseudo-log-likelihood for relaxed mixed protein/DNA tokens with Minerva (GPU) | <a href="#api-run-minerva-gradient" class="func-table-btn func-api-btn"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20" /></svg> Docs</a> <a href="https://github.com/evo-design/proto-tools/blob/8f803c1c93044c23b17150e72b3f44b1274e9470/proto_tools/tools/masked_models/minerva/minerva_gradient.py#L53" target="_blank" class="func-table-btn func-source-btn"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6" /><polyline points="8 6 2 12 8 18" /></svg> Source</a> |
| `run_minerva_interactions()` | Predict protein, RNA base-pairing, and repeat interaction maps with Minerva (GPU) | <a href="#api-run-minerva-interactions" class="func-table-btn func-api-btn"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20" /></svg> Docs</a> <a href="https://github.com/evo-design/proto-tools/blob/8f803c1c93044c23b17150e72b3f44b1274e9470/proto_tools/tools/masked_models/minerva/minerva_interactions.py#L79" target="_blank" class="func-table-btn func-source-btn"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6" /><polyline points="8 6 2 12 8 18" /></svg> Source</a> |
| `run_minerva_sample()` | Sample mixed protein/DNA loci while preserving modality and strand markers with Minerva (GPU) | <a href="#api-run-minerva-sample" class="func-table-btn func-api-btn"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20" /></svg> Docs</a> <a href="https://github.com/evo-design/proto-tools/blob/8f803c1c93044c23b17150e72b3f44b1274e9470/proto_tools/tools/masked_models/minerva/minerva_sample.py#L63" target="_blank" class="func-table-btn func-source-btn"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6" /><polyline points="8 6 2 12 8 18" /></svg> Source</a> |
| `run_minerva_score()` | Score mixed protein/DNA loci by masked pseudo-log-likelihood with Minerva (GPU) | <a href="#api-run-minerva-score" class="func-table-btn func-api-btn"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20" /></svg> Docs</a> <a href="https://github.com/evo-design/proto-tools/blob/8f803c1c93044c23b17150e72b3f44b1274e9470/proto_tools/tools/masked_models/minerva/minerva_score.py#L56" target="_blank" class="func-table-btn func-source-btn"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6" /><polyline points="8 6 2 12 8 18" /></svg> Source</a> |

## Background

Many non-coding elements retain their structure or repeated organization despite substantial sequence divergence. Minerva reads out the coevolutionary patterns learned by a genome language model as separate maps of base pairing, protein contacts, and repeats. Each head combines attention features to predict its interaction type in a single forward pass, enabling rapid scans of genomic regions without constructing multiple sequence alignments.

| Interaction head | Predicted relationship | Discovery use |
| - | - | - |
| `base_pairing` | Nucleotide pairing, evaluated on conserved RNA base pairs | Find candidate structured ncRNAs, hairpins, and extensions to annotated RNA structures |
| `protein` | Residue contacts within protein monomers | Examine protein structural signals alongside neighboring non-coding elements |
| `repeat` | Relationships between repetitive sequence motifs | Identify repeat arrays, including CRISPR-like and repetitive extragenic palindromic (REP) patterns |

**Speed makes genome-scale mining practical.** In the [Minerva study](https://www.biorxiv.org/content/10.64898/2026.09.22.753630v2.full), the authors scanned 150 bacterial genomes in 100 minutes on one NVIDIA H100 GPU, plus 31 minutes to write the maps. That upstream workflow used overlapping 4096-token windows and the last-two-layer interaction heads; this tool exposes the inference step on prepared loci.

The study used these maps to identify unannotated structured regions, extend the known TwoAYGGAY RNA architecture, and discover arrays of structurally conserved but sequence-diverse ncRNAs beside prophage UG27 reverse transcriptases. Experimental follow-up showed that the UG27 RNAs template short cDNA hairpins. These examples illustrate how interaction patterns can guide candidate selection, comparative analysis, and experimental discovery. See [Li et al. (2026)](https://doi.org/10.64898/2026.09.22.753630).

Minerva-MLM was initialized from gLM2 and retains its mixed protein/DNA representation, with amino acids for coding regions, nucleotides for intergenic regions, and strand markers.

## Tools

<a name="api-run-minerva-interactions" />

<div class="tool-section-card">
  ### Minerva Interactions (`minerva-interactions`)

  Predicts base-pairing, protein-contact, and repetitive-motif maps in a single model pass. Every selected head returns a labeled `(L, L)` probability matrix, with one result bundle per input locus.

  #### API Reference

  <div class="api-model-section api-input-section">
    <a href="https://github.com/evo-design/proto-tools/blob/8f803c1c93044c23b17150e72b3f44b1274e9470/proto_tools/tools/masked_models/mixed_data_models.py#L38" target="_blank" class="func-table-btn func-source-btn api-model-source"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6" /><polyline points="8 6 2 12 8 18" /></svg> Source</a>

    <Accordion title="Input: MixedSequenceInput">
      <ParamField path="sequences" type="List[string]" required>
        Uppercase proteins and lowercase DNA, optionally separated by `+`/`-` strand markers (`<+>`/`<->` are stored as `+`/`-`). A single string is normalized to a list.
      </ParamField>
    </Accordion>
  </div>

  <div class="api-model-section api-config-section">
    <a href="https://github.com/evo-design/proto-tools/blob/8f803c1c93044c23b17150e72b3f44b1274e9470/proto_tools/tools/masked_models/minerva/minerva_interactions.py#L28" target="_blank" class="func-table-btn func-source-btn api-model-source"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6" /><polyline points="8 6 2 12 8 18" /></svg> Source</a>

    <Accordion title="Config: MinervaInteractionsConfig">
      <ParamField path="heads" type="List[string]">
        Selected named interaction heads.
      </ParamField>

      <ParamField path="interaction_layers" type="enum" default="2">
        Number of final transformer layers used by the heads.

        Available options: `2`, `6`
      </ParamField>

      <ParamField path="verbose" type="integer" default="0">
        Verbosity level (0=quiet, 1=info, 2=debug, 3=raw subprocess stderr). `True` is coerced to `1` and `False` to `0`.
      </ParamField>

      <ParamField path="device" type="string" default="cuda">
        Device used for model inference.
      </ParamField>

      <ParamField path="timeout" type="integer" default="3600">
        Maximum execution time in seconds. `None` waits indefinitely.
      </ParamField>

      <ParamField path="seed" type="integer">
        Random seed. When set, tools run reproducibly up to small GPU float noise (see `BaseToolOutput.approx_equal`), and the seed participates in cache keys. When None, cacheable seed-sensitive tools skip cache until seeded.
      </ParamField>

      <ParamField path="model_checkpoint" type="enum" default="gbrixi/minerva-mlm">
        Public model checkpoint.

        Available options: `gbrixi/minerva-mlm`, `gbrixi/minerva-mlm-8k`
      </ParamField>

      <ParamField path="batch_size" type="integer" default="1">
        Equal-token-length sequences per forward pass; one limits matrix memory.
      </ParamField>
    </Accordion>
  </div>

  <div class="api-model-section api-output-section">
    <a href="https://github.com/evo-design/proto-tools/blob/8f803c1c93044c23b17150e72b3f44b1274e9470/proto_tools/utils/interaction_models.py#L63" target="_blank" class="func-table-btn func-source-btn api-model-source"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6" /><polyline points="8 6 2 12 8 18" /></svg> Source</a>

    <Accordion title="Output: SequenceInteractionsOutput">
      <ResponseField name="results" type="List[SequenceInteractions]" required>
        Interaction bundles in input order.

        <Expandable title="SequenceInteractions">
          <ResponseField name="maps" type="Dict[string, SequenceInteractionMap]" required>
            Named interaction probability maps.
          </ResponseField>
        </Expandable>
      </ResponseField>
    </Accordion>
  </div>

  #### Applications

  Screen intergenic regions for structured ncRNAs and repeat arrays, inspect their organization around nearby genes, and prioritize unannotated loci for comparative analysis or experimental follow-up. Combining the base-pairing and repeat maps can highlight arrays of structured elements, as in the study's UG27 discovery. The protein map adds monomeric contact predictions for the coding parts of the same locus.

  #### Usage Tips

  * **`heads` selects the returned channels.** All three are returned by default. Select fewer to reduce output size; this does not change the meaning of an individual channel.
  * **`interaction_layers=2` is the fast screening default.** It uses the final two transformer layers, as in the paper's genome scans. The released six-layer variant (`interaction_layers=6`) offers slightly higher accuracy at greater memory and compute cost.
  * **The axes include strand markers and ambiguous context.** Padding is removed. Use `axis_labels` (one per input character) to select biological subregions; matrix indices are not genome coordinates. The tool returns the upstream probabilities without symmetrizing, thresholding, removing the diagonal, or combining strands.
  * **`plot()` draws the maps.** `result.plot()` overlays base pairing, repeats, and protein contacts in the Minerva publication colors, with a track marking genes, intergenic DNA, and strand markers; `plot(channel="base_pairing")` shows one map with a colorbar, and `window=(start, end)` zooms to 1-indexed positions. It returns a matplotlib figure.
  * **Dense output grows quadratically with token count.** Doubling the locus length quadruples each matrix's element count. The default export is compressed NPZ, with keys such as `0_protein` and `0_protein_axis_labels`; arrays load with `numpy.load(..., allow_pickle=False)`. JSON is also supported, and the public Python values remain nested lists.

  <a name="api-run-minerva-embeddings" />
</div>

<div class="tool-section-card tool-section-card--embedding">
  ### Minerva Embeddings (`minerva-embedding`)

  Returns one mean-pooled embedding per prepared locus, with optional logits over the 24 canonical protein/DNA tokens.

  #### API Reference

  <div class="api-model-section api-input-section">
    <a href="https://github.com/evo-design/proto-tools/blob/8f803c1c93044c23b17150e72b3f44b1274e9470/proto_tools/tools/masked_models/mixed_data_models.py#L38" target="_blank" class="func-table-btn func-source-btn api-model-source"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6" /><polyline points="8 6 2 12 8 18" /></svg> Source</a>

    <Accordion title="Input: MixedSequenceInput">
      <ParamField path="sequences" type="List[string]" required>
        Uppercase proteins and lowercase DNA, optionally separated by `+`/`-` strand markers (`<+>`/`<->` are stored as `+`/`-`). A single string is normalized to a list.
      </ParamField>
    </Accordion>
  </div>

  <div class="api-model-section api-config-section">
    <a href="https://github.com/evo-design/proto-tools/blob/8f803c1c93044c23b17150e72b3f44b1274e9470/proto_tools/tools/masked_models/minerva/minerva_embeddings.py#L25" target="_blank" class="func-table-btn func-source-btn api-model-source"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6" /><polyline points="8 6 2 12 8 18" /></svg> Source</a>

    <Accordion title="Config: MinervaEmbeddingsConfig">
      <ParamField path="verbose" type="integer" default="0">
        Verbosity level (0=quiet, 1=info, 2=debug, 3=raw subprocess stderr). `True` is coerced to `1` and `False` to `0`.
      </ParamField>

      <ParamField path="device" type="string" default="cuda">
        Device used for model inference.
      </ParamField>

      <ParamField path="timeout" type="integer" default="3600">
        Maximum execution time in seconds. `None` waits indefinitely.
      </ParamField>

      <ParamField path="seed" type="integer">
        Random seed. When set, tools run reproducibly up to small GPU float noise (see `BaseToolOutput.approx_equal`), and the seed participates in cache keys. When None, cacheable seed-sensitive tools skip cache until seeded.
      </ParamField>

      <ParamField path="model_checkpoint" type="enum" default="gbrixi/minerva-mlm">
        Public model checkpoint.

        Available options: `gbrixi/minerva-mlm`, `gbrixi/minerva-mlm-8k`
      </ParamField>

      <ParamField path="batch_size" type="integer" default="1">
        Sequences per forward pass.
      </ParamField>

      <ParamField path="return_logits" type="boolean" default="False">
        Include token-aligned biological logits.
      </ParamField>

      <ParamField path="repr_layer" type="integer" default="-1">
        0=embedding table, 1..N=transformer output, -1=last layer.
      </ParamField>
    </Accordion>
  </div>

  <div class="api-model-section api-output-section">
    <a href="https://github.com/evo-design/proto-tools/blob/8f803c1c93044c23b17150e72b3f44b1274e9470/proto_tools/tools/masked_models/mixed_data_models.py#L214" target="_blank" class="func-table-btn func-source-btn api-model-source"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6" /><polyline points="8 6 2 12 8 18" /></svg> Source</a>

    <Accordion title="Output: MixedEmbeddingsOutput">
      <ResponseField name="results" type="List[MixedSequenceEmbedding]" required>
        Per-locus embedding bundles in input order.

        <Expandable title="MixedSequenceEmbedding">
          <ResponseField name="vocab" type="List[string]">
            Column order of optional biological logits.
          </ResponseField>

          <ResponseField name="mean_embedding" type="List[number]" required>
            Mean-pooled embedding vector for one sequence.
          </ResponseField>

          <ResponseField name="attention_mask" type="List[integer]" required>
            Binary mask indicating valid positions (1) vs padding (0).
          </ResponseField>

          <ResponseField name="logits" type="array">
            Optional per-token protein/DNA logits.
          </ResponseField>

          <ResponseField name="projection" type="Projection2D">
            Optional 2D coordinate from a UMAP projection of all embeddings in the same call. Populated when `n_sequences >= 4`; `None` otherwise (single-point or 2-3-point UMAP is meaningless).
          </ResponseField>
        </Expandable>
      </ResponseField>
    </Accordion>
  </div>

  #### Applications

  Cluster or retrieve candidate loci after an interaction-map screen, or use the pooled vectors as features in a downstream classifier. Keep the checkpoint and representation layer fixed when comparing embeddings.

  #### Usage Tips

  * **`repr_layer=-1` selects the last transformer output.** Layer 0 selects the input embedding table; positive indices select transformer outputs. Pooling includes every unpadded token, including strand markers.
  * **`return_logits=True` adds an `(L, 24)` matrix.** Columns follow `ACDEFGHIKLMNPQRSTVWYacgt`; these are raw logits, not normalized probabilities. The matrix includes strand-marker rows, one row per input character.
  * **CSV, NPY, and PT exports contain pooled vectors.** JSON also preserves `vocab` and optional `logits` for position-level analysis; logits rows follow the input sequence.

  <a name="api-run-minerva-score" />
</div>

<div class="tool-section-card tool-section-card--score">
  ### Minerva Scoring (`minerva-score`)

  Computes masked pseudo-log-likelihood by masking each canonical protein or DNA position in turn and predicting its original token from the remaining context. Returns summed and mean log-likelihood, perplexity, and the positions included in the score.

  #### API Reference

  <div class="api-model-section api-input-section">
    <a href="https://github.com/evo-design/proto-tools/blob/8f803c1c93044c23b17150e72b3f44b1274e9470/proto_tools/tools/masked_models/mixed_data_models.py#L38" target="_blank" class="func-table-btn func-source-btn api-model-source"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6" /><polyline points="8 6 2 12 8 18" /></svg> Source</a>

    <Accordion title="Input: MixedSequenceInput">
      <ParamField path="sequences" type="List[string]" required>
        Uppercase proteins and lowercase DNA, optionally separated by `+`/`-` strand markers (`<+>`/`<->` are stored as `+`/`-`). A single string is normalized to a list.
      </ParamField>
    </Accordion>
  </div>

  <div class="api-model-section api-config-section">
    <a href="https://github.com/evo-design/proto-tools/blob/8f803c1c93044c23b17150e72b3f44b1274e9470/proto_tools/tools/masked_models/minerva/minerva_score.py#L25" target="_blank" class="func-table-btn func-source-btn api-model-source"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6" /><polyline points="8 6 2 12 8 18" /></svg> Source</a>

    <Accordion title="Config: MinervaScoringConfig">
      <ParamField path="verbose" type="integer" default="0">
        Verbosity level (0=quiet, 1=info, 2=debug, 3=raw subprocess stderr). `True` is coerced to `1` and `False` to `0`.
      </ParamField>

      <ParamField path="device" type="string" default="cuda">
        Device used for model inference.
      </ParamField>

      <ParamField path="timeout" type="integer" default="3600">
        Maximum execution time in seconds. `None` waits indefinitely.
      </ParamField>

      <ParamField path="seed" type="integer">
        Random seed. When set, tools run reproducibly up to small GPU float noise (see `BaseToolOutput.approx_equal`), and the seed participates in cache keys. When None, cacheable seed-sensitive tools skip cache until seeded.
      </ParamField>

      <ParamField path="model_checkpoint" type="enum" default="gbrixi/minerva-mlm">
        Public model checkpoint.

        Available options: `gbrixi/minerva-mlm`, `gbrixi/minerva-mlm-8k`
      </ParamField>

      <ParamField path="batch_size" type="integer" default="1">
        Individually masked variants per forward pass.
      </ParamField>

      <ParamField path="return_logits" type="boolean" default="False">
        Include masked biological logits; unscored context rows are zero.
      </ParamField>
    </Accordion>
  </div>

  <div class="api-model-section api-output-section">
    <a href="https://github.com/evo-design/proto-tools/blob/8f803c1c93044c23b17150e72b3f44b1274e9470/proto_tools/tools/masked_models/mixed_data_models.py#L288" target="_blank" class="func-table-btn func-source-btn api-model-source"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6" /><polyline points="8 6 2 12 8 18" /></svg> Source</a>

    <Accordion title="Output: MixedScoringOutput">
      <ResponseField name="scores" type="List[MixedScoringMetrics]" required>
        Per-locus scores in input order.

        <Expandable title="MixedScoringMetrics">
          <ResponseField name="scored_positions" type="List[integer]" required>
            1-indexed canonical protein/DNA target token positions.
          </ResponseField>

          <ResponseField name="primary_metric" type="string">
            Name of the metric that best summarizes the result overall (e.g. `"avg_plddt"` for AlphaFold2). Used by downstream UI and reporting to pick a headline value.
          </ResponseField>

          <ResponseField name="metric_type" type="string">
            Concrete Metrics subclass tag; enables typed reconstruction after a serialization round-trip.
          </ResponseField>

          <ResponseField name="logits" type="array">
            Per-position logits array `(seq_len, vocab_size)`. `None` unless `return_logits=True`.
          </ResponseField>

          <ResponseField name="vocab" type="array">
            Token ordering for `logits`.
          </ResponseField>
        </Expandable>
      </ResponseField>

      **Metrics** (one set per `scores` item)

      | Metric | Type | Range | Availability |
      | - | - | - | - |
      | `log_likelihood` | float | ≤ 0.0 | always |
      | `avg_log_likelihood` | float | ≤ 0.0 | always |
      | `perplexity` | float | ≥ 1.0 | always |
    </Accordion>
  </div>

  #### Applications

  Rank related sequence variants with a contextual sequence prior. Scores reflect compatibility with the learned distribution and do not establish biological function or binding.

  #### Usage Tips

  * **`scored_positions` uses 1-indexed model-token positions.** Strand markers and accepted ambiguous protein symbols provide context but are excluded from score targets and the mean's denominator.
  * **`batch_size` controls masked variants per forward pass.** Scoring requires work proportional to the number of target positions; start with the default 1 when memory is limited.
  * **Optional scoring logits come from masked passes.** Their `(L, 24)` rows align with the input sequence; unscored marker and ambiguous-context rows are zero. These differ from the unmasked logits returned by embeddings.
  * **PLL uses the full upstream vocabulary of 37 tokens.** Exported logits contain only the 24 biological tokens, so applying softmax to those columns does not reproduce PLL.
  * **Compare similar contexts.** Higher mean log-likelihood and lower perplexity mean the model predicts the sequence more readily. Summed log-likelihood also depends on the number of scored positions.

  <a name="api-run-minerva-sample" />
</div>

<div class="tool-section-card tool-section-card--sample">
  ### Minerva Sampling (`minerva-sample`)

  Refills selected protein and DNA positions while preserving their original modality, sequence length, strand markers, and noneditable ambiguous protein symbols. Each input produces one sampled locus.

  #### API Reference

  <div class="api-model-section api-input-section">
    <a href="https://github.com/evo-design/proto-tools/blob/8f803c1c93044c23b17150e72b3f44b1274e9470/proto_tools/tools/masked_models/mixed_data_models.py#L98" target="_blank" class="func-table-btn func-source-btn api-model-source"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6" /><polyline points="8 6 2 12 8 18" /></svg> Source</a>

    <Accordion title="Input: MixedSequenceSampleInput">
      <ParamField path="mask_modalities" type="array">
        One mapping per locus, assigning every mask's 1-indexed token position to protein or DNA. Positions index the `+`/`-` form. Omit for fully specified sequences.
      </ParamField>

      <ParamField path="sequences" type="List[string]" required>
        Prepared loci, optionally carrying `_` masks.
      </ParamField>
    </Accordion>
  </div>

  <div class="api-model-section api-config-section">
    <a href="https://github.com/evo-design/proto-tools/blob/8f803c1c93044c23b17150e72b3f44b1274e9470/proto_tools/tools/masked_models/minerva/minerva_sample.py#L24" target="_blank" class="func-table-btn func-source-btn api-model-source"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6" /><polyline points="8 6 2 12 8 18" /></svg> Source</a>

    <Accordion title="Config: MinervaSampleConfig">
      <ParamField path="verbose" type="integer" default="0">
        Verbosity level (0=quiet, 1=info, 2=debug, 3=raw subprocess stderr). `True` is coerced to `1` and `False` to `0`.
      </ParamField>

      <ParamField path="device" type="string" default="cuda">
        Device used for model inference.
      </ParamField>

      <ParamField path="timeout" type="integer" default="3600">
        Maximum execution time in seconds. `None` waits indefinitely.
      </ParamField>

      <ParamField path="seed" type="integer">
        Random seed. When set, tools run reproducibly up to small GPU float noise (see `BaseToolOutput.approx_equal`), and the seed participates in cache keys. When None, cacheable seed-sensitive tools skip cache until seeded.
      </ParamField>

      <ParamField path="model_checkpoint" type="enum" default="gbrixi/minerva-mlm">
        Public model checkpoint.

        Available options: `gbrixi/minerva-mlm`, `gbrixi/minerva-mlm-8k`
      </ParamField>

      <ParamField path="batch_size" type="integer" default="1">
        Sequences per forward pass.
      </ParamField>

      <ParamField path="masking_strategy" type="MaskingStrategy">
        Select editable token positions when no explicit masks are supplied.

        <Expandable title="MaskingStrategy">
          <ParamField path="temperature" type="number" default="1.0">
            Temperature for position selection. \< 1.0 is greedy, 1.0 uses scores as-is, > 1.0 is more uniform. Only affects model-based methods.
          </ParamField>

          <ParamField path="method" type="enum" default="random">
            Scoring method for position selection. `"random"`: uniform random, `"entropy"`: highest model uncertainty, `"max-logit"`: lowest model confidence.

            Available options: `random`, `entropy`, `max-logit`
          </ParamField>

          <ParamField path="num_mutations" type="integer">
            Exact number of positions to mask per sequence.
          </ParamField>

          <ParamField path="mask_fraction" type="number">
            Fraction of designable positions to mask (e.g. 0.15 for \~15%).
          </ParamField>

          <ParamField path="fixed_positions" type="array">
            1-indexed positions that must NOT be masked. Applied uniformly to all sequences.
          </ParamField>
        </Expandable>
      </ParamField>

      <ParamField path="sampling_method" type="enum" default="single_pass">
        Sampling algorithm.

        Available options: `single_pass`, `iterative_refinement`
      </ParamField>

      <ParamField path="temperature" type="number" default="1.0">
        Temperature within each editable position's modality.
      </ParamField>

      <ParamField path="top_p" type="number" default="1.0">
        Nucleus threshold for iterative refinement.
      </ParamField>

      <ParamField path="num_steps" type="integer" default="20">
        Number of iterative refinement rounds.
      </ParamField>

      <ParamField path="schedule" type="enum" default="cosine">
        Iterative unmask schedule.

        Available options: `cosine`, `linear`
      </ParamField>

      <ParamField path="strategy" type="enum" default="random">
        Random or confidence-based commitment selection.

        Available options: `random`, `entropy`
      </ParamField>

      <ParamField path="temperature_annealing" type="boolean" default="True">
        Cool temperature during iterative refinement.
      </ParamField>

      <ParamField path="return_logits" type="boolean" default="False">
        Include biological logits from the completed sequence.
      </ParamField>
    </Accordion>
  </div>

  <div class="api-model-section api-output-section">
    <a href="https://github.com/evo-design/proto-tools/blob/8f803c1c93044c23b17150e72b3f44b1274e9470/proto_tools/tools/masked_models/mixed_data_models.py#L249" target="_blank" class="func-table-btn func-source-btn api-model-source"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6" /><polyline points="8 6 2 12 8 18" /></svg> Source</a>

    <Accordion title="Output: MixedSampleOutput">
      <ResponseField name="results" type="List[MixedSequenceSample]" required>
        Per-locus sampling bundles in input order.

        <Expandable title="MixedSequenceSample">
          <ResponseField name="vocab" type="List[string]">
            Column order of optional biological logits.
          </ResponseField>

          <ResponseField name="sequence" type="string" required>
            Completed mixed protein/DNA locus with original strand markers.
          </ResponseField>

          <ResponseField name="logits" type="array">
            Optional per-token protein/DNA logits.
          </ResponseField>
        </Expandable>
      </ResponseField>
    </Accordion>
  </div>

  #### Applications

  Propose local sequence edits for a design or variant-screening loop while keeping the prepared locus layout intact.

  #### Usage Tips

  * **Automatic masking uses `MaskingStrategy`.** By default it selects about 30% of eligible canonical biological positions, with at least one when any are eligible. Set either `num_mutations` or `mask_fraction`; `fixed_positions` counts all model tokens, including markers. Entropy and max-logit selection use the same checkpoint as sampling.
  * **Premasked inputs require `mask_modalities`.** Supply one mapping per sequence that labels every `_` position as `"protein"` or `"dna"`. For example, `+M_+a_` needs `mask_modalities=[{3: "protein", 6: "dna"}]`. Explicit masks bypass automatic selection for the batch.
  * **The allowed alphabet is preserved per site.** Protein positions sample among the 20 canonical amino acids; DNA positions sample among lowercase `acgt`. A selected position can draw its original token again, so the number of masks is not a guaranteed number of substitutions.
  * **`sampling_method` selects the fill algorithm.** `single_pass` fills all masks together. `iterative_refinement` progressively commits predictions and uses `num_steps`, `schedule`, `strategy`, `top_p`, and `temperature_annealing`. `temperature` controls sampling diversity and `seed` makes proposals reproducible.
  * **Optional sampling logits describe the completed locus.** They come from a final unmasked forward pass. Export prepared mixed strings as JSON or text; they are not nucleotide or protein FASTA records.

  <a name="api-run-minerva-gradient" />
</div>

<div class="tool-section-card tool-section-card--gradient">
  ### Minerva Gradient (`minerva-gradient`)

  Returns the gradient of mean masked negative log-likelihood with respect to a relaxed `(L, 24)` sequence state. A fully specified `sequence` template fixes each position's modality and the locations of strand markers and ambiguous protein context.

  #### API Reference

  <div class="api-model-section api-input-section">
    <a href="https://github.com/evo-design/proto-tools/blob/8f803c1c93044c23b17150e72b3f44b1274e9470/proto_tools/tools/masked_models/mixed_data_models.py#L143" target="_blank" class="func-table-btn func-source-btn api-model-source"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6" /><polyline points="8 6 2 12 8 18" /></svg> Source</a>

    <Accordion title="Input: MixedSequenceGradientInput">
      <ParamField path="sequence" type="string" required>
        Fully specified template fixing modality and `+`/`-` strand markers.
      </ParamField>

      <ParamField path="logits" type="List[array]" required>
        One 24-column row per model token in `ACDEFGHIKLMNPQRSTVWYacgt` order. Fixed context rows must be zero.
      </ParamField>

      <ParamField path="temperature" type="number" default="1.0">
        Softmax temperature; `None` requires probability distributions over the permitted modality and zero elsewhere.
      </ParamField>
    </Accordion>
  </div>

  <div class="api-model-section api-config-section">
    <a href="https://github.com/evo-design/proto-tools/blob/8f803c1c93044c23b17150e72b3f44b1274e9470/proto_tools/tools/masked_models/minerva/minerva_gradient.py#L25" target="_blank" class="func-table-btn func-source-btn api-model-source"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6" /><polyline points="8 6 2 12 8 18" /></svg> Source</a>

    <Accordion title="Config: MinervaGradientConfig">
      <ParamField path="verbose" type="integer" default="0">
        Verbosity level (0=quiet, 1=info, 2=debug, 3=raw subprocess stderr). `True` is coerced to `1` and `False` to `0`.
      </ParamField>

      <ParamField path="device" type="string" default="cuda">
        Device used for model inference.
      </ParamField>

      <ParamField path="timeout" type="integer" default="3600">
        Maximum execution time in seconds. `None` waits indefinitely.
      </ParamField>

      <ParamField path="seed" type="integer">
        Random seed. When set, tools run reproducibly up to small GPU float noise (see `BaseToolOutput.approx_equal`), and the seed participates in cache keys. When None, cacheable seed-sensitive tools skip cache until seeded.
      </ParamField>

      <ParamField path="model_checkpoint" type="enum" default="gbrixi/minerva-mlm">
        Public model checkpoint.

        Available options: `gbrixi/minerva-mlm`, `gbrixi/minerva-mlm-8k`
      </ParamField>

      <ParamField path="batch_size" type="integer" default="1">
        Individually masked variants per forward and backward pass.
      </ParamField>

      <ParamField path="use_ste" type="boolean" default="False">
        Hard forward tokens with soft-probability gradients.
      </ParamField>

      <ParamField path="compute_gradient" type="boolean" default="True">
        Compute the gradient, or evaluate only the masked PLL loss.
      </ParamField>
    </Accordion>
  </div>

  <div class="api-model-section api-output-section">
    <a href="https://github.com/evo-design/proto-tools/blob/8f803c1c93044c23b17150e72b3f44b1274e9470/proto_tools/tools/masked_models/mixed_data_models.py#L305" target="_blank" class="func-table-btn func-source-btn api-model-source"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6" /><polyline points="8 6 2 12 8 18" /></svg> Source</a>

    <Accordion title="Output: MixedGradientOutput">
      <ResponseField name="gradient" type="array | array">
        Derivative of masked NLL with respect to the input state.
      </ResponseField>

      <ResponseField name="loss" type="number" required>
        Mean masked negative log-likelihood.
      </ResponseField>

      <ResponseField name="metrics" type="Dict[string, any]">
        Masked PLL metrics and checkpoint metadata.
      </ResponseField>

      <ResponseField name="vocab" type="List[string]" required>
        Protein/DNA column order shared by input and gradient.
      </ResponseField>
    </Accordion>
  </div>

  #### Applications

  Use the masked-language-model objective as a differentiable prior in sequence optimization while retaining the original protein/DNA layout.

  #### Usage Tips

  * **The matrix axis includes every model token.** Columns are `ACDEFGHIKLMNPQRSTVWYacgt`. Strand-marker and ambiguous-context rows must be zero; their returned gradients are also zero. Opposite-modality columns do not influence a position.
  * **`temperature=1.0` treats the input as logits.** The worker applies a softmax within the position's modality. With `temperature=None`, provide a nonnegative probability distribution within that modality and zeros elsewhere. `one_hot_mixed_logits()` builds a valid starting state from a template.
  * **The objective masks canonical sites one at a time.** The target at each site is its current discrete argmax token. `use_ste=True` uses hard forward tokens with soft derivatives; `compute_gradient=False` returns the objective with `gradient=None`.
</div>

## Toolkit Notes

These apply to every Minerva tool in this toolkit.

* **Inputs are prepared, case-sensitive strings.** Uppercase letters denote protein; lowercase `acgt` denotes DNA. The uppercase protein symbols `X`, `B`, `U`, `Z`, and `O` are accepted as fixed context. Lowercase ambiguous nucleotides, whitespace, literal `<mask>`, and other control tokens are rejected. Sampling accepts `_` only with explicit modality metadata.
* **Strand markers are `+` (forward) and `-` (reverse).** The upstream `<+>`/`<->` spelling is also accepted and converted to `+`/`-`. Token positions are 1-indexed string indices of the `+`/`-` form, not genomic nucleotide coordinates. No case conversion, strand insertion, reverse complementation, translation, or gene calling is performed.
* **Prepare biologically appropriate orientation yourself.** Upstream examples use `+` for intergenic DNA and strand markers for translated coding regions. The tool preserves the submitted orientation and does not combine strands.
* **Model setup and weights are managed automatically.** The isolated environment is built on first use and public Hugging Face checkpoints are downloaded into the shared model cache. A Hugging Face token is not required for these public checkpoints.
* **Execution defaults to CUDA.** Reduce `batch_size` when memory is limited. Repeated calls with one checkpoint can reuse a persistent worker through the standard `ToolInstance.persist()` API.
* **The default checkpoint is `gbrixi/minerva-mlm`.** It accepts up to 4096 model tokens; `gbrixi/minerva-mlm-8k` accepts up to 8192. These counts include strand markers. Overlength inputs raise an error rather than truncating.
* **RNA base-pairing input uses the DNA alphabet.** Submit lowercase `acgt` as in upstream examples; the tool does not convert `u` to `t` or call an RNA structure from the map.
* **Scope is prepared-string inference.** Upstream gene calling, GenBank ingestion, fine-tuning, categorical Jacobians, and strand-ensemble workflows are not exposed by these tools.

<Tip>
  **Example notebook:** See the [full working example](https://github.com/evo-design/proto-tools/blob/8f803c1c93044c23b17150e72b3f44b1274e9470/proto_tools/tools/masked_models/minerva/examples/example.ipynb) for a copy-paste-ready walkthrough.
</Tip>

## Infrastructure Guides

The following guides cover how to run tools efficiently and at scale.

<CardGroup cols={2}>
  <Card title="Tool Persistence" icon="repeat" href="/docs/tools/guides/tool-persistence">Keep a tool's model warm across calls instead of reloading it every invocation.</Card>
  <Card title="Device Management" icon="cpu" href="/docs/tools/guides/device-management">How GPUs are allocated to tools and how to target specific devices.</Card>
  <Card title="Parallel Execution" icon="layers" href="/docs/tools/guides/parallel-execution">Fan a batch of inputs out across multiple GPUs.</Card>
</CardGroup>
