Text Classification
Transformers
Safetensors
English
manta
feature-extraction
medical
decision-model
classification
calibration
multimodal
vision
radiology
pathology
clinical-text
custom_code
Run this model with HF Jobs
Run gevaertlab/MANTA-4B on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/gevaertlab/MANTA-4B. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/gevaertlab/MANTA-4B on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use gevaertlab/MANTA-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use gevaertlab/MANTA-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="gevaertlab/MANTA-4B", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("gevaertlab/MANTA-4B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Commit ·
ae0db2a
0
Parent(s):
MANTA-4B release
Browse filesFiles changed (37)
- .gitattributesAdded+38
- LICENSEAdded+201
- LICENSE_base_modelAdded+202
- README.mdAdded+920
- SHA256SUMSAdded+35
- assets/accuracy_latency.pngAdded
- assets/examples/cadica.jpgAdded
- assets/examples/gastrovision.jpgAdded
- assets/examples/grazpedwri_dx.jpgAdded
- assets/examples/olives.jpgAdded
- assets/manta_logo_cropped.pngAdded
- chat_template.jinjaAdded+154
- config.jsonAdded+195
- configuration_manta.pyAdded+27
- example.pyAdded+44
- examples/image_request.jsonAdded+43
- examples/text_request.jsonAdded+30
- manta/__init__.pyAdded+29
- manta/head.pyAdded+191
- manta/images.pyAdded+51
- manta/lora.pyAdded+53
- manta/model.pyAdded+244
- manta/prompt.pyAdded+198
- manta/records.pyAdded+153
- manta/request.pyAdded+128
- merges.txtAdded
- model-00001-of-00003.safetensorsAdded+3
- model-00002-of-00003.safetensorsAdded+3
- model-00003-of-00003.safetensorsAdded+3
- model.safetensors.index.jsonAdded+855
- modeling_manta.pyAdded+251
- preprocessor_config.jsonAdded+21
- requirements.txtAdded+20
- tokenizer.jsonAdded+3
- tokenizer_config.jsonAdded+305
- video_preprocessor_config.jsonAdded+21
- vocab.jsonAdded
1234567891011121314151617181920212223242526272829303132333435363738*.7z filter=lfs diff=lfs merge=lfs -text*.arrow filter=lfs diff=lfs merge=lfs -text*.bin filter=lfs diff=lfs merge=lfs -text*.bz2 filter=lfs diff=lfs merge=lfs -text*.ckpt filter=lfs diff=lfs merge=lfs -text*.ftz filter=lfs diff=lfs merge=lfs -text*.gz filter=lfs diff=lfs merge=lfs -text*.h5 filter=lfs diff=lfs merge=lfs -text*.joblib filter=lfs diff=lfs merge=lfs -text*.lfs.* filter=lfs diff=lfs merge=lfs -text*.mlmodel filter=lfs diff=lfs merge=lfs -text*.model filter=lfs diff=lfs merge=lfs -text*.msgpack filter=lfs diff=lfs merge=lfs -text*.npy filter=lfs diff=lfs merge=lfs -text*.npz filter=lfs diff=lfs merge=lfs -text*.onnx filter=lfs diff=lfs merge=lfs -text*.ot filter=lfs diff=lfs merge=lfs -text*.parquet filter=lfs diff=lfs merge=lfs -text*.pb filter=lfs diff=lfs merge=lfs -text*.pickle filter=lfs diff=lfs merge=lfs -text*.pkl filter=lfs diff=lfs merge=lfs -text*.pt filter=lfs diff=lfs merge=lfs -text*.pth filter=lfs diff=lfs merge=lfs -text*.rar filter=lfs diff=lfs merge=lfs -text*.safetensors filter=lfs diff=lfs merge=lfs -textsaved_model/**/* filter=lfs diff=lfs merge=lfs -text*.tar.* filter=lfs diff=lfs merge=lfs -text*.tar filter=lfs diff=lfs merge=lfs -text*.tflite filter=lfs diff=lfs merge=lfs -text*.tgz filter=lfs diff=lfs merge=lfs -text*.wasm filter=lfs diff=lfs merge=lfs -text*.xz filter=lfs diff=lfs merge=lfs -text*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -textassets/accuracy_latency.png filter=lfs diff=lfs merge=lfs -textassets/manta_logo_cropped.png filter=lfs diff=lfs merge=lfs -texttokenizer.json filter=lfs diff=lfs merge=lfs -text123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2026 Alibaba Cloud
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920---license: apache-2.0library_name: transformerspipeline_tag: text-classificationlanguage:- entags:- medical- decision-model- classification- calibration- multimodal- vision- radiology- pathology- clinical-text---
<p align="center"> <img src="assets/manta_logo_cropped.png" alt="MANTA logo" width="96"></p>
<!-- manta:table_style --><style>.mt{border-collapse:collapse;font-size:13px;margin:4px 0 6px 0}.mt th{padding:8px 10px;font-weight:600;color:#2F6BDF;border-bottom:2px solid #2F6BDF;white-space:nowrap}.mt td{padding:6px 10px;border-bottom:1px solid rgba(128, 128, 128, 0.22);white-space:nowrap}.mt td:not(:first-child),.mt th:not(:first-child){text-align:right}.mt tr.o td,.mt tr.s td{font-weight:600}.mt .ci{opacity:.55;font-size:11px}.mt b{color:#2F6BDF}</style><!-- /manta:table_style -->
# MANTA-4B
MANTA (Medical Answers, Natively from Text And images) is a medical decision model developed by the Gevaert Lab atthe Department of Computational Medicine, Stanford University. Give it a medical image or text and a set ofquestions with their answer options: MANTA-4B returns a probability for every option of every question in oneforward pass.
MANTA comes in two releases: **MANTA-4B** (this repository), smaller and faster, and[MANTA-27B](https://huggingface.co/gevaertlab/MANTA-27B), the more accurate. Every results table of this card shows bothreleases; the text and the ranks speak of MANTA-4B.
<!-- manta:family --><div style="overflow-x:auto"><table class="mt"><thead><tr><th style="color:#2F6BDF">Release</th><th style="color:#2F6BDF">Backbone</th><th style="color:#2F6BDF">GPU memory</th><th style="color:#2F6BDF">Median latency</th><th style="color:#2F6BDF">MANTA-Bench medical</th></tr></thead><tbody><tr class="s"><td><a href="https://huggingface.co/gevaertlab/MANTA-27B">MANTA-27B</a></td><td>Qwen3.8-27B</td><td>about 60 GB</td><td>148 ms</td><td>86.0 %</td></tr><tr class="o" style="background:rgba(47, 107, 223, 0.09)"><td>MANTA-4B (this release)</td><td>Qwen3.5-4B</td><td>about 16 GB</td><td>68 ms</td><td>85.3 %</td></tr></tbody></table></div><!-- /manta:family -->
MANTA-4B builds on the Qwen3.5-4B vision-language backbone and adds a dedicated decision head,trained from scratch, that scores every answer option directly, instead of generating text. Both the language and thevision towers are adapted end-to-end in a multi-stage training process designed for calibrated option probabilities.<!-- manta:scale -->MANTA-4B was trained on about 8.5 million decision requests, 68 % of them medical (text and images), with about 600 H100 GPU-hours of training steps.<!-- /manta:scale -->
<!-- manta:highlights -->- **Medical decisions (MANTA-Bench):** MANTA-4B 85.3 % accuracy, rank 2 of 20 decision models, behind only MANTA-27B (best non-MANTA model: liquid-d1-ultra, 71.0 %); ECE-15 0.028 on the in-domain test sets.- **Frontier performance on clinical decisions** on the same medical decisions (6,700 questions): MANTA-4B 86.1 % vs Gemini 3.8 Flash 76.0 %, Claude Sonnet 5.5 74.6 %, GPT-6 Luna (chat) 62.4 %, MedGemma 27B (local) 52.3 %, in one forward pass.- **Open-weight models** (mean over the 6 rows of the summary table; A.7 marks the open models; Clef counts once, through its API and on our GPUs): MANTA-4B ranks 4 of the 11 open-weight models we compared by the mean accuracy (71.4 %; above it: MANTA-27B 76.1 %, mammoth-1 75.5 %, pplx-decider-v1.2 72.9 %); first among them on medical decisions (with MANTA-27B); mammoth-1 first on medical QA, medical knowledge and reasoning and the exam sets with images.- **Medical QA** (MedQA, MedMCQA, PubMedQA, HEAD-QA): MANTA-4B mean 76.1 %, rank 20 of 27 decision models.<!-- /manta:highlights -->
<!-- manta:latency_figure -->
<sub>Accuracy: four rows of the summary table in [Evaluation](#evaluation) (MANTA-Bench medical and general, medical QA, the exam sets; the same questions for every model). Latency: the median per request; API models: the server-side time that OpenRouter reports (it excludes the client network); MANTA-27B, MANTA-4B and MedGemma 27B: one H100 at batch size 1. For the QA groups and the exam sets, the median of the requests of that group.</sub><!-- /manta:latency_figure -->
> [!IMPORTANT]> MANTA-4B is a research model, not a medical device. Do not use its outputs for diagnosis, treatment or any other> decision about a patient without independent validation on your own data and review by qualified clinicians.
## Model details
<!-- manta:model_details -->| | ||---|---|| Developed by | Gevaert Lab, Department of Computational Medicine, Stanford University || Model type | Decision model (no text generation) || Backbone | [Qwen3.5-4B](https://huggingface.co/Qwen/Qwen3.5-4B) (vision-language), adapted || Decision head | new, trained from scratch || Parameters | 5.3B stored (the output embedding is a stored copy of the tied input embedding of the backbone); BF16, 3 safetensors shards, 10.6 GB; sha256 in `SHA256SUMS` || GPU memory | about 16 GB (one GPU) || Input | a case (text or JSON), optional images, 1 to 64 questions with their options; up to 4,096 prompt tokens || Output | a calibrated probability per answer option, in one forward pass || License | Apache 2.0 (`LICENSE`) || Base model license | the license of Qwen3.5-4B: `LICENSE_base_model` |<!-- /manta:model_details -->
## Modalities
The training data consists of images and text. Physiological signals are rendered as images. 3D CT and MRI volumes are used as 2D slices, and medical videos as single frames.
### Medical
**Radiology**- X-ray: chest X-ray, digital radiography, mammography, panoramic dental radiography- Computed tomography (CT): conventional and contrast-enhanced CT, micro-CT- Magnetic resonance imaging (MRI): T1-weighted, contrast-enhanced T1, T2-weighted, FLAIR, proton density, diffusion-weighted, perfusion maps (CBF, CBV, MTT, Tmax, TTP), cardiac MRI- Positron emission tomography (PET), FDG PET/CT- Ultrasound: B-mode, transthoracic echocardiography, transrectal ultrasound (3D and micro-ultrasound)- Angiography
**Pathology and microscopy**- Histopathology: whole-slide imaging, histopathology and cytopathology images- Cytology- Light microscopy: brightfield, phase contrast- Fluorescence microscopy: epifluorescence, confocal, synthetic fluorescence images- Imaging flow cytometry- Electron microscopy: transmission, scanning, serial-section, focused ion beam SEM, cryo-electron tomography
**Endoscopy and surgery**- Colonoscopy, white-light endoscopy, wireless capsule endoscopy, bronchoscopy, cystoscopy (white-light and narrow-band imaging), laparoscopy, surgical microscopy
**Ophthalmology**- Optical coherence tomography (OCT), fundus photography, ultra-widefield fundus photography, slit-lamp photography, fluorescein angiography
**Dermatology**- Dermoscopy
**Other optical imaging**- Hyperspectral imaging (RGB reconstructions), optoacoustic tomography
**Physiological signals (rendered as images)**- Electrocardiography: 12-lead ECG plots rendered from signals, ECG printout images- Electroencephalography: polysomnography (sleep recordings), scalp EEG- Heart sounds (phonocardiography), lung sounds (auscultation), cough recordings: log-mel spectrograms
**Text**- Biomedical and clinical text: exam and textbook questions, research abstracts and claims, clinical-trial records, drug labels and reviews, adverse-event and device reports, biomedical knowledge-base facts (genes, variants, drugs, diseases)
**Evaluation only** (in held-out evaluation data, not in training)- Colour Doppler ultrasound, OCT angiography, colposcopy, confocal laser endomicroscopy, near-infrared imaging, super-resolution, TIRF, multiphoton, darkfield and specular microscopy
### General domain
- Text: general-domain text in many languages, including code, tables and chess puzzles- Images: natural photographs (incl. street-level views), satellite images, synthetic 3D scenes, diagrams, charts, maps, memes, AI-generated images- Video: short clips as sequences of sampled frames- Document scans and GUI screenshots are excluded
## Quickstart
```bashhf download gevaertlab/MANTA-4B --local-dir MANTA-4B && cd MANTA-4Bpip install -r requirements.txt # the versions of the published evaluation (Python 3.12, CUDA 12.4)python example.py # the two example requests in examples/```
```pythonfrom manta import Manta # request encoding and probabilities (manta/ in this repository)
model = Manta.from_pretrained(".") # one GPU with 16 GB or moreresult = model.predict({ "state": "67-year-old man, 3 days of fever, productive cough, right pleuritic chest pain. SpO2 89 % on room " "air. Chest radiograph: right lower lobe consolidation.", "questions": { "diagnosis": {"type": "choice", "instructions": "What is the most likely diagnosis?", "criteria": {"pneumonia": "Community-acquired pneumonia", "pulmonary_embolism": "Pulmonary embolism", "heart_failure": "Acute decompensated heart failure"}}, "hypoxemia": {"type": "noul", "instructions": "Does the patient have hypoxemia?"}, "severity": {"type": "score", "instructions": "How severe is the illness?", "criteria": ["mild", "moderate", "severe", "critical"]}, },})print(result["questions"]["diagnosis"]["probabilities"])```
The model itself loads with transformers (`AutoModel.from_pretrained(path, trust_remote_code=True,dtype=torch.bfloat16)`); `Manta` adds the prompt format of the published evaluation and the softmax per question. A case longer than theprompt limit is cut at the end (`truncated` in the output).
| Request field | Content ||---|---|| `state` | the case: a string or any JSON value || `images` | optional: file paths, URLs or data URIs, in prompt order || `questions` | question id → `{"type", "instructions", "criteria"}`, decided jointly; up to 64 || `choice` criteria | option id → description; the answer is one option id || `score` criteria | ordered level descriptions, lowest first; option ids `"0"`, `"1"`, … || `noul` (yes/no) | criteria optional; option ids `"true"`, `"false"` |
Use short task names as question ids (`diagnosis`, `modality`) and put the questions about one case into onerequest. Choice options are shown in the fixed random order of the evaluation (`option_order="eval"`; `"given"` and`"sorted"` are available).
## Evaluation
**MANTA-Bench**, our benchmark of decision questions from public data sets, has in-domain test sets (held-out testgroups of the training sources) and out-of-domain test sets (data sets that no MANTA training used).
MANTA-4B (this release) and MANTA-27B against the best other decision model and four chat models: GPT-6 Luna (chat), Claude Sonnet 5.5 andGemini 3.8 Flash through their APIs, at the lowest reasoning setting each API accepts, and MedGemma 27B, run locally.Every model of a row answers the same questions. MANTA answers in one forward pass, without reasoning; the otherdecision models answered zero-shot, through their APIs (Clef also with its open weights on our GPUs). Bold: the best value of the row. The[appendix](#appendix-full-results) has the full tables: every model, all questions, calibration.
<!-- manta:summary --><div style="overflow-x:auto"><table class="mt"><thead><tr><th style="color:#2F6BDF">Benchmark</th><th style="color:#2F6BDF">Questions</th><th style="color:#2F6BDF;background:rgba(47, 107, 223, 0.09)">MANTA-4B</th><th style="color:#2F6BDF">MANTA-27B</th><th style="color:#2F6BDF">Best other decision model</th><th style="color:#2F6BDF">Gemini 3.8 Flash</th><th style="color:#2F6BDF">Claude Sonnet 5.5</th><th style="color:#2F6BDF">GPT-6 Luna (chat)</th><th style="color:#2F6BDF">MedGemma 27B (local)</th></tr></thead><tbody><tr><td>MANTA-Bench medical</td><td>6,700</td><td style="background:rgba(47, 107, 223, 0.09)"><b>86.1</b></td><td><b>86.1</b></td><td>71.2 (liquid-d1-ultra)</td><td>76.0</td><td>74.6</td><td>62.4</td><td>52.3</td></tr><tr><td>MANTA-Bench medical, out-of-domain test sets</td><td>554</td><td style="background:rgba(47, 107, 223, 0.09)">71.5</td><td>74.4</td><td>73.3 (liquid-d1-ultra)</td><td>73.6</td><td><b>79.1</b></td><td>69.9</td><td>52.3</td></tr><tr><td>Medical QA (MedQA, MedMCQA, PubMedQA, HEAD-QA)</td><td>1,978</td><td style="background:rgba(47, 107, 223, 0.09)">75.0</td><td>82.7</td><td>85.9 (mammoth-1)</td><td><b>90.0</b></td><td>87.5</td><td>83.0</td><td>71.9</td></tr><tr><td>Medical knowledge and reasoning (MMLU-medical, MedXpertQA-Text)</td><td>976</td><td style="background:rgba(47, 107, 223, 0.09)">51.4</td><td>59.5</td><td>73.7 (mammoth-1)</td><td><b>78.8</b></td><td>71.9</td><td>64.8</td><td>47.9</td></tr><tr><td>Medical exam sets with images</td><td>1,005</td><td style="background:rgba(47, 107, 223, 0.09)">54.2</td><td>63.1</td><td>70.2 (liquid-d1-ultra)</td><td><b>87.1</b></td><td>78.6</td><td>63.3</td><td>47.5</td></tr><tr><td>MANTA-Bench general</td><td>5,792</td><td style="background:rgba(47, 107, 223, 0.09)">90.1</td><td><b>90.7</b></td><td>86.8 (pplx-decider-v1.2)</td><td>88.5</td><td>86.0</td><td>79.6</td><td>74.0</td></tr></tbody></table></div>
<sub>Accuracy in %. Questions: the comparison subsets (MANTA-Bench: at most 20 requests per medical source and 50 per general source; QA suite and exam sets: at most 500 requests per benchmark), the questions that all models of the row answered. Medical QA: the mean of the benchmarks of the row, equal weight; exam sets: the mean of MedXpertQA-MM and WorldMedQA-V. Out-of-domain: data sets that no MANTA training used. MedGemma 27B ran locally (vLLM, temperature 0).</sub>
<sub>MANTA-Bench general row: Not ranked (answered fewer than 90 % of the questions because of provider refusals): drex-max (54 %).</sub><!-- /manta:summary -->
## Examples: from dataset labels to decision questions
<!-- manta:examples -->Every training and evaluation request is converted from the original annotations of a public data set. The labels ofa release (CSV rows, label files, folder names, boxes and masks) are first mapped to canonical label strings; fixedrules then turn each label into a question with its allowed options and target.
| Question | Made from | Example ||---|---|---|| `choice` | any label space (also two-class spaces such as benign / malignant); above 24 classes, a seeded menu of 24 options that always holds the correct one | the finding of an endoscopy image || `noul` (yes / no) | labels that are yes / no answers (yes / no, true / false, present / absent); presence questions "Is there a *class* in the image?" for the classes of a box or mask label space that lists every instance | a biomarker present in an OCT scan || `score` (ordered levels) | a label space with ordered levels (lowest first); counts, in the bins 0, 1, 2, 3–4, 5–9, 10–19, 20–49, 50 or more | a stenosis grade, a cell count |
- **Regions.** A box or mask becomes text coordinates in the question, on a 0–1000 scale relative to the image: `{"bbox_2d": [x1, y1, x2, y2]}`, or `{"point_2d": [x, y]}` for a thin or overlapping structure. Nothing is drawn on the image. Regions that are too small or too large are left out.- **Targets.** Each target records where it comes from: `human` (the label of the release), `derived` (computed from the annotations, for example a presence or a count), `votes` (annotator votes). Captions and free-text answers are converted by a language model instead (target source `model`).- **Evaluation.** The question ids are task names without the data-set name (`disease`, `finding_in_box.box`), and the options of a choice question are shown in a fixed random order (`option_order="eval"`).
The four examples below come from the out-of-domain data sets of MANTA-Bench (A.1.1), which no MANTA training used.Each shows the image as the model receives it, the original annotation of the release, the labels we derive from it,and the request as it is evaluated, in the request format of the [Quickstart](#quickstart). Each request asks morequestions than shown here (for example the imaging technique); the examples keep one or two of them.
<details><summary><b>OLIVES</b> (macular OCT B-scans): a table row → a <code>choice</code> and a <code>noul</code></summary>
<img src="assets/examples/olives.jpg" alt="OLIVES OCT B-scan with intraretinal cysts" width="320">
<sub>OLIVES (Prabhushankar et al., NeurIPS 2022 Datasets and Benchmarks; [Zenodo 10.5281/zenodo.7105232](https://doi.org/10.5281/zenodo.7105232)), CC BY 4.0; resized.</sub>
Original annotation (one row of the release, selected columns):
```Disease Label: 1.0 DRT/ME: 1.0 IR HRF: 1.0 Fluid (IRF): 1.0 Fluid (SRF): 0.0 Vitreous debris: 0.0```
`Disease Label` 1 is diabetic macular edema (release README); a biomarker column is 1 = present, 0 = absent. Ourlabels: `disease: diabetic macular edema`, `bio_intraretinal_hyperreflective_foci: present`,`bio_subretinal_fluid: absent`, ... (11 biomarkers).
```json{ "state": {"context": "An optical coherence tomography (OCT) image of the retina of a human is provided (cross-sectional view)."}, "images": ["olives.jpg"], "questions": { "disease": { "type": "choice", "instructions": "Based on the retinal microstructural appearance in this optical coherence tomography image, is the underlying disease diabetic retinopathy or diabetic macular edema?", "criteria": {"diabetic macular edema": null, "diabetic retinopathy": null} }, "bio_intraretinal_hyperreflective_foci": { "type": "noul", "instructions": "In this optical coherence tomography B-scan of the macula, is intraretinal hyperreflective foci present or absent?", "criteria": {"true": "present", "false": "absent"} } }}```
Targets: `disease` = diabetic macular edema (human); `bio_intraretinal_hyperreflective_foci` = true (human). Thebiomarker labels are present / absent, so they become yes / no questions, with "present" and "absent" as thedescriptions of true and false. No `score`: the labels have no order.
</details>
<details><summary><b>GRAZPEDWRI-DX</b> (paediatric wrist radiographs): YOLO boxes → a region <code>choice</code> and a presence <code>noul</code></summary>
<img src="assets/examples/grazpedwri_dx.jpg" alt="Paediatric wrist radiograph with the fracture box of the question" width="300">
<sub>GRAZPEDWRI-DX (Nagy et al., Sci Data 9, 222 (2022); [figshare 14825193](https://figshare.com/articles/dataset/GRAZPEDWRI-DX/14825193)), CC BY 4.0; resized. The blue box is the region of the `finding_in_box.box` question, drawn here for the reader only: the model gets the coordinates as text, not a drawn box.</sub>
Original annotation (the YOLO label file of the image: class, x-centre, y-centre, width, height, relative to the image;class 3 = fracture, 5 = periosteal reaction, 8 = text):
```3 0.529747 0.457207 0.251899 0.1216228 0.036076 0.420045 0.056962 0.0765775 0.468354 0.571509 0.083544 0.1610365 0.632911 0.540541 0.032911 0.209459```
Our labels: `fracture: fracture visible`; boxes: fracture ×1, periosteal reaction ×2 (the text box is skipped).The fracture box becomes `[404, 396, 656, 518]` on the 0–1000 scale (x1 = 0.529747 − 0.251899 / 2 = 0.404, ...).
```json{ "state": {"context": "A digital radiograph (x-ray imaging) of the wrist of a pediatric human patient is provided.", "age": "15 years", "sex": "male"}, "images": ["grazpedwri_dx.jpg"], "questions": { "finding_in_box.box": { "type": "choice", "instructions": "Within the region of interest ({\"bbox_2d\": [404, 396, 656, 518]}), what is the best-matching radiographic finding?", "criteria": {"bone anomaly": null, "bone lesion": null, "foreign body": null, "fracture": null, "metal": null, "periosteal reaction": null, "pronator quadratus sign": null, "soft tissue swelling": null} }, "finding_box.fracture.present": { "type": "noul", "instructions": "Is there a fracture in the image?" } }}```
Targets: `finding_in_box.box` = fracture (human); `finding_box.fracture.present` = true (derived: the image has afracture box, and the box classes list every finding of the image). The same request asks the presence of each ofthe 8 findings (here periosteal reaction yes, the six others no) and the finding in the second periosteal-reactionbox. No `score`: the findings have no order and no count is asked.
</details>
<details><summary><b>CADICA</b> (invasive coronary angiography): a stenosis box → a <code>choice</code> and a region <code>score</code></summary>
<img src="assets/examples/cadica.jpg" alt="Coronary angiography keyframe with the stenosis box of the question" width="320">
<sub>CADICA ([Mendeley Data p9bpx9ctcv, version 5](https://data.mendeley.com/datasets/p9bpx9ctcv)), CC BY 4.0; resized. The orange box is the region of the `stenosis_degree.box` question, drawn here for the reader only: the model gets the coordinates as text, not a drawn box.</sub>
Original annotation (the ground-truth file of the keyframe: x, y, width, height in pixels of the 512 × 512 frame, andthe stenosis degree; the video is listed among the lesion videos of the patient):
```176 286 49 53 p0_20```
`p0_20` is a stenosis below 20 %. Our labels: `lesion: coronary lesion visible`; boxes: coronary artery stenosis ×1.The box becomes `[344, 559, 439, 662]` (x1 = 176 / 512 = 0.344, ...).
```json{ "state": {"context": "A biomedical image is provided."}, "images": ["cadica.jpg"], "questions": { "lesion": { "type": "choice", "instructions": "Based on the contrast-filled coronary artery lumen in this angiographic frame, is a stenotic coronary lesion visible?", "criteria": {"coronary lesion visible": null, "no coronary lesion": null} }, "stenosis_degree.box": { "type": "score", "instructions": "Within the region of interest ({\"bbox_2d\": [344, 559, 439, 662]}), what is the best-matching degree of luminal stenosis of the boxed coronary lesion?", "criteria": ["<20% stenosis", "20-50% stenosis", "50-70% stenosis", "70-90% stenosis", "90-98% stenosis", "99% stenosis", "100% (total occlusion)"] } }}```
Targets: `lesion` = coronary lesion visible (human); `stenosis_degree.box` = level 0, <20% stenosis (human). The twolesion labels are not yes / no words, so they stay a two-option `choice`; the stenosis degrees are ordered, so theybecome a `score`.
</details>
<details><summary><b>GastroVision</b> (GI endoscopy): a folder name → a <code>choice</code> with a 24-option menu</summary>
<img src="assets/examples/gastrovision.jpg" alt="Upper GI endoscopy image of a normal stomach" width="320">
<sub>GastroVision ([OSF 84e7f](https://osf.io/84e7f)), CC BY 4.0; resized.</sub>
Original annotation: none besides the folder of the image in the release, `Normal stomach/`. Our label:`finding: normal stomach`.
```json{ "state": {"context": "A biomedical image is provided."}, "images": ["gastrovision.jpg"], "questions": { "finding": { "type": "choice", "instructions": "Based on the endoscopic mucosal appearance, what is the best-matching finding, landmark or intervention in this GI endoscopy image?", "criteria": {"accessory tools": null, "angiectasia": null, "barrett's esophagus": null, "cecum": null, "colon diverticula": null, "colon polyps": null, "colorectal cancer": null, "duodenal bulb": null, "dyed-lifted-polyps": null, "dyed-resection-margins": null, "erythema": null, "esophageal varices": null, "esophagitis": null, "gastroesophageal junction normal z-line": null, "ileocecal valve": null, "mucosal inflammation large bowel": null, "normal esophagus": null, "normal stomach": null, "pylorus": null, "resected polyps": null, "resection margins": null, "retroflex rectum": null, "small bowel terminal ileum": null, "ulcer": null} } }}```
Target: `finding` = normal stomach (human). The release has 27 classes, so the question shows a seeded menu of 24that holds the correct class. No `noul` or `score`: the classes are neither yes / no answers nor ordered.
</details><!-- /manta:examples -->
## Citation
**Authors:** Gevaert Lab, Department of Computational Medicine, Stanford University. This author line and the entrybelow are temporary: the technical report will name the authors, and this section will then point to it. Please citethe technical report once it is available.
```bibtex@misc{manta2026, title = {MANTA: Medical Answers, Natively from Text And images}, author = {{Gevaert Lab, Stanford University}}, year = {2026}, howpublished = {\url{https://huggingface.co/gevaertlab/MANTA-4B}}, note = {Technical report forthcoming}}```
## Acknowledgements
MANTA-4B was trained on Marlowe, Stanford's GPU-based computational instrument, supported by Stanford Data Science and Stanford Research Computing. Evaluations were also run on the Sherlock cluster of Stanford Research Computing.
## Contact
Gevaert Lab, Department of Computational Medicine, Stanford University: the Community tab of this repository.
## Appendix: full results
All models in a table answer the same questions. MANTA answers in one forward pass, without reasoning; the otherdecision models answered zero-shot, through their APIs (Clef also with its open weights on our GPUs). Accuracy in %, ECE-15: expected calibration error (15 bins); bold:the best value of the column in that table.
<details><summary><b>A.1 MANTA-Bench: medical decisions</b></summary>
At most 200 requests per source: the in-domain test sets (held-out test groups of the training sources; MANTAtrained on their training splits, the other models answer zero-shot) and the out-of-domain test sets (data sets thatno MANTA training used).
<!-- manta:bench_medical --><div style="overflow-x:auto"><table class="mt"><thead><tr><th style="color:#2F6BDF">Model</th><th style="color:#2F6BDF">Accuracy</th><th style="color:#2F6BDF">ECE-15</th><th style="color:#2F6BDF">In-domain acc.</th><th style="color:#2F6BDF">In-domain ECE-15</th><th style="color:#2F6BDF">Out-of-domain acc.</th><th style="color:#2F6BDF">Out-of-domain ECE-15</th></tr></thead><tbody><tr class="s"><td>MANTA-27B</td><td><b>86.0</b> <span class="ci">[85.7, 86.4]</span></td><td>0.030</td><td><b>87.8</b></td><td>0.021</td><td><b>70.6</b></td><td>0.109</td></tr><tr class="o" style="background:rgba(47, 107, 223, 0.09)"><td>MANTA-4B</td><td>85.3 <span class="ci">[85.0, 85.7]</span></td><td>0.039</td><td>87.3</td><td>0.028</td><td>68.5</td><td>0.139</td></tr><tr><td>liquid-d1-ultra</td><td>71.0 <span class="ci">[70.6, 71.5]</span></td><td><b>0.013</b></td><td>71.2</td><td><b>0.013</b></td><td>69.3</td><td>0.035</td></tr><tr><td>mammoth-1</td><td>69.9 <span class="ci">[69.5, 70.4]</span></td><td>0.051</td><td>70.2</td><td>0.049</td><td>67.2</td><td>0.075</td></tr><tr><td>pplx-decider-v1.2</td><td>69.9 <span class="ci">[69.4, 70.3]</span></td><td>0.018</td><td>70.2</td><td>0.018</td><td>67.2</td><td>0.038</td></tr><tr><td>liquid-d1.1</td><td>69.6 <span class="ci">[69.2, 70.1]</span></td><td>0.039</td><td>70.0</td><td>0.037</td><td>66.5</td><td>0.075</td></tr><tr><td>liquid-d1</td><td>69.5 <span class="ci">[69.0, 69.9]</span></td><td>0.055</td><td>70.1</td><td>0.052</td><td>64.5</td><td>0.095</td></tr><tr><td>jev-1.14</td><td>69.0 <span class="ci">[68.6, 69.5]</span></td><td>0.041</td><td>69.6</td><td>0.040</td><td>64.0</td><td>0.053</td></tr><tr><td>drex-max</td><td>68.6 <span class="ci">[68.2, 69.1]</span></td><td>0.067</td><td>69.0</td><td>0.064</td><td>65.1</td><td>0.096</td></tr><tr><td>Clef (open weights, our GPUs)</td><td>68.6 <span class="ci">[68.2, 69.1]</span></td><td>0.033</td><td>68.8</td><td>0.033</td><td>66.8</td><td><b>0.030</b></td></tr><tr><td>Clef (API)</td><td>68.4 <span class="ci">[67.9, 68.8]</span></td><td>0.031</td><td>68.6</td><td>0.032</td><td>66.5</td><td>0.037</td></tr><tr><td>mercury-decide</td><td>67.6 <span class="ci">[67.1, 68.1]</span></td><td>0.150</td><td>67.8</td><td>0.148</td><td>65.9</td><td>0.168</td></tr><tr><td>morph-reflex</td><td>67.4 <span class="ci">[67.0, 67.9]</span></td><td>0.117</td><td>67.8</td><td>0.117</td><td>64.4</td><td>0.120</td></tr><tr><td>jev-1.13</td><td>67.0 <span class="ci">[66.5, 67.4]</span></td><td>0.058</td><td>67.6</td><td>0.058</td><td>62.0</td><td>0.062</td></tr><tr><td>elephant-1</td><td>66.7 <span class="ci">[66.3, 67.2]</span></td><td>0.070</td><td>67.4</td><td>0.064</td><td>60.8</td><td>0.121</td></tr><tr><td>clef-flash</td><td>66.3 <span class="ci">[65.8, 66.7]</span></td><td>0.027</td><td>66.4</td><td>0.024</td><td>65.1</td><td>0.061</td></tr><tr><td>pplx-decider-flash-v1.2</td><td>65.3 <span class="ci">[64.8, 65.7]</span></td><td>0.053</td><td>65.7</td><td>0.051</td><td>61.4</td><td>0.072</td></tr><tr><td>clef-omni</td><td>63.4 <span class="ci">[62.9, 63.8]</span></td><td>0.026</td><td>63.3</td><td>0.030</td><td>64.1</td><td>0.043</td></tr><tr><td>gpt-6-luna</td><td>63.4 <span class="ci">[62.9, 63.9]</span></td><td>0.153</td><td>63.2</td><td>0.157</td><td>64.8</td><td>0.127</td></tr><tr><td>joey-1</td><td>55.4 <span class="ci">[54.8, 55.8]</span></td><td>0.061</td><td>55.4</td><td>0.061</td><td>54.6</td><td>0.063</td></tr></tbody></table></div>
<sub>57,163 questions that all 20 models answered (51,334 in-domain, 5,829 out-of-domain); accuracy in %, 95 % bootstrap interval over requests (1000 draws).</sub>
Medical text questions only, all 27 models (also the text-only ones):
<div style="overflow-x:auto"><table class="mt"><thead><tr><th style="color:#2F6BDF">Model</th><th style="color:#2F6BDF">Accuracy</th><th style="color:#2F6BDF">ECE-15</th></tr></thead><tbody><tr class="s"><td>MANTA-27B</td><td><b>87.7</b> <span class="ci">[87.0, 88.4]</span></td><td>0.025</td></tr><tr class="o" style="background:rgba(47, 107, 223, 0.09)"><td>MANTA-4B</td><td>85.2 <span class="ci">[84.4, 86.0]</span></td><td>0.038</td></tr><tr><td>liquid-d1-ultra</td><td>82.0 <span class="ci">[81.1, 82.8]</span></td><td>0.030</td></tr><tr><td>pplx-decider-v1.2</td><td>79.6 <span class="ci">[78.8, 80.5]</span></td><td>0.059</td></tr><tr><td>mammoth-1</td><td>79.5 <span class="ci">[78.7, 80.4]</span></td><td>0.055</td></tr><tr><td>drex-max</td><td>79.4 <span class="ci">[78.5, 80.2]</span></td><td>0.068</td></tr><tr><td>liquid-d1.1</td><td>79.3 <span class="ci">[78.4, 80.1]</span></td><td>0.040</td></tr><tr><td>morph-reflex</td><td>79.0 <span class="ci">[78.2, 79.9]</span></td><td>0.092</td></tr><tr><td>jev-1.14</td><td>78.5 <span class="ci">[77.6, 79.4]</span></td><td>0.070</td></tr><tr><td>liquid-d1</td><td>78.4 <span class="ci">[77.5, 79.2]</span></td><td>0.068</td></tr><tr><td>jev-1.13</td><td>77.8 <span class="ci">[76.8, 78.7]</span></td><td>0.086</td></tr><tr><td>Clef (open weights, our GPUs)</td><td>77.7 <span class="ci">[76.8, 78.6]</span></td><td>0.057</td></tr><tr><td>gpt-6-luna</td><td>77.7 <span class="ci">[76.8, 78.6]</span></td><td>0.118</td></tr><tr><td>mercury-decide</td><td>77.6 <span class="ci">[76.7, 78.6]</span></td><td>0.126</td></tr><tr><td>Clef (API)</td><td>77.3 <span class="ci">[76.4, 78.2]</span></td><td>0.055</td></tr><tr><td>microsoft-decision-1</td><td>77.2 <span class="ci">[76.2, 78.0]</span></td><td>0.086</td></tr><tr><td>drex-v2.0</td><td>76.4 <span class="ci">[75.5, 77.4]</span></td><td>0.024</td></tr><tr><td>elephant-1</td><td>76.3 <span class="ci">[75.4, 77.2]</span></td><td>0.055</td></tr><tr><td>clef-omni</td><td>75.8 <span class="ci">[74.9, 76.7]</span></td><td>0.039</td></tr><tr><td>solar-decide</td><td>74.6 <span class="ci">[73.7, 75.5]</span></td><td>0.183</td></tr><tr><td>clef-flash</td><td>73.9 <span class="ci">[72.9, 74.7]</span></td><td>0.058</td></tr><tr><td>pplx-decider-flash-v1.2</td><td>73.5 <span class="ci">[72.6, 74.4]</span></td><td>0.100</td></tr><tr><td>drex-v1.5</td><td>72.9 <span class="ci">[71.9, 73.8]</span></td><td>0.090</td></tr><tr><td>tev1-4b</td><td>71.4 <span class="ci">[70.4, 72.4]</span></td><td>0.096</td></tr><tr><td>kev-4b</td><td>70.8 <span class="ci">[69.8, 71.7]</span></td><td><b>0.014</b></td></tr><tr><td>solar-decide-flash</td><td>69.2 <span class="ci">[68.2, 70.2]</span></td><td>0.139</td></tr><tr><td>joey-1</td><td>63.7 <span class="ci">[62.7, 64.7]</span></td><td>0.044</td></tr></tbody></table></div>
<sub>8,250 questions.</sub><!-- /manta:bench_medical -->
</details>
<!-- manta:bench_medical_per_source --><details><summary><b>A.1.1 MANTA-Bench: out-of-domain medical decisions per data set</b></summary>
The out-of-domain questions of A.1 (5,829 questions that all 20 models answered), split by data set: 9 data sets that no MANTA training used; every model answers them zero-shot.
**Summary over data sets.** Mean acc.: the unweighted mean of the per-data-set accuracies (each data set counts once, whatever its size; A.1 pools the questions instead). Firsts: the data sets where the model has the best accuracy (ties count for every tied model). Mean rank: the mean rank among the 20 models (1 = best; tied models share the better rank). Bold: the best value of the column.
<div style="overflow-x:auto"><table class="mt"><thead><tr><th style="color:#2F6BDF">Model</th><th style="color:#2F6BDF">Out-of-domain (9): mean acc.</th><th style="color:#2F6BDF">firsts</th><th style="color:#2F6BDF">mean rank</th></tr></thead><tbody><tr class="s"><td>MANTA-27B</td><td><b>64.4</b></td><td><b>3 / 9</b></td><td>4.7</td></tr><tr><td>liquid-d1-ultra</td><td>63.3</td><td>2 / 9</td><td><b>3.8</b></td></tr><tr class="o" style="background:rgba(47, 107, 223, 0.09)"><td>MANTA-4B</td><td>63.1</td><td><b>3 / 9</b></td><td>7.0</td></tr><tr><td>pplx-decider-v1.2</td><td>60.6</td><td>1 / 9</td><td>6.1</td></tr><tr><td>liquid-d1.1</td><td>60.0</td><td>0 / 9</td><td>8.4</td></tr><tr><td>mammoth-1</td><td>59.0</td><td>0 / 9</td><td>8.3</td></tr><tr><td>liquid-d1</td><td>58.7</td><td>0 / 9</td><td>10.0</td></tr><tr><td>Clef (open weights, our GPUs)</td><td>58.5</td><td>0 / 9</td><td>9.1</td></tr><tr><td>mercury-decide</td><td>58.4</td><td>0 / 9</td><td>9.7</td></tr><tr><td>drex-max</td><td>58.1</td><td>0 / 9</td><td>9.0</td></tr><tr><td>jev-1.14</td><td>58.0</td><td>1 / 9</td><td>10.2</td></tr><tr><td>Clef (API)</td><td>58.0</td><td>0 / 9</td><td>10.2</td></tr><tr><td>morph-reflex</td><td>57.9</td><td>0 / 9</td><td>10.3</td></tr><tr><td>gpt-6-luna</td><td>57.4</td><td>0 / 9</td><td>9.8</td></tr><tr><td>clef-flash</td><td>56.9</td><td>0 / 9</td><td>12.1</td></tr><tr><td>jev-1.13</td><td>55.7</td><td>0 / 9</td><td>13.8</td></tr><tr><td>pplx-decider-flash-v1.2</td><td>54.4</td><td>0 / 9</td><td>16.4</td></tr><tr><td>clef-omni</td><td>54.2</td><td>0 / 9</td><td>13.0</td></tr><tr><td>elephant-1</td><td>52.9</td><td>0 / 9</td><td>16.8</td></tr><tr><td>joey-1</td><td>46.4</td><td>0 / 9</td><td>16.6</td></tr></tbody></table></div>
<sub>Accuracy in %. Rows sorted by mean accuracy. Firsts and ranks use the accuracies as shown (one decimal).</sub>
**Accuracy per data set.** Accuracy in %; bold: the best model of the row; MANTA rank: the rank of MANTA-4B among the 20 models. Question types: the questions of the data set per type (`choice`: one of several named options; `noul`: yes / no; `score`: ordered levels, lowest first). Columns in the order of A.1 (pooled accuracy). Data sets with few questions (the Questions column) give noisy accuracies.
**Out-of-domain medical images**: 9 data sets, 5,829 questions; MANTA-4B first on 3, MANTA-27B on 3; a MANTA release first on 6.
<div style="overflow-x:auto"><table class="mt"><thead><tr><th style="color:#2F6BDF">Dataset</th><th style="color:#2F6BDF">Questions</th><th style="color:#2F6BDF">Question types</th><th style="color:#2F6BDF">MANTA-27B</th><th style="color:#2F6BDF;background:rgba(47, 107, 223, 0.09)">MANTA-4B</th><th style="color:#2F6BDF">liquid-d1-ultra</th><th style="color:#2F6BDF">mammoth-1</th><th style="color:#2F6BDF">pplx-decider-v1.2</th><th style="color:#2F6BDF">liquid-d1.1</th><th style="color:#2F6BDF">liquid-d1</th><th style="color:#2F6BDF">jev-1.14</th><th style="color:#2F6BDF">drex-max</th><th style="color:#2F6BDF">Clef (open weights, our GPUs)</th><th style="color:#2F6BDF">Clef (API)</th><th style="color:#2F6BDF">mercury-decide</th><th style="color:#2F6BDF">morph-reflex</th><th style="color:#2F6BDF">jev-1.13</th><th style="color:#2F6BDF">elephant-1</th><th style="color:#2F6BDF">clef-flash</th><th style="color:#2F6BDF">pplx-decider-flash-v1.2</th><th style="color:#2F6BDF">clef-omni</th><th style="color:#2F6BDF">gpt-6-luna</th><th style="color:#2F6BDF">joey-1</th><th style="color:#2F6BDF">MANTA rank</th></tr></thead><tbody><tr><td><code>bbbc054_microglia</code></td><td>296</td><td>choice 296</td><td>53.7</td><td style="background:rgba(47, 107, 223, 0.09)"><b>63.5</b></td><td>43.2</td><td>34.1</td><td>42.6</td><td>42.6</td><td>39.9</td><td>33.1</td><td>34.8</td><td>34.5</td><td>31.1</td><td>35.8</td><td>29.1</td><td>39.9</td><td>33.1</td><td>37.2</td><td>35.5</td><td>43.2</td><td>43.2</td><td>35.5</td><td>1</td></tr><tr><td><code>cadica</code></td><td>766</td><td>choice 662, score 104</td><td>80.9</td><td style="background:rgba(47, 107, 223, 0.09)"><b>83.0</b></td><td>72.7</td><td>72.8</td><td>76.4</td><td>72.5</td><td>71.9</td><td>73.8</td><td>72.7</td><td>75.3</td><td>74.3</td><td>72.5</td><td>72.6</td><td>69.5</td><td>71.8</td><td>72.6</td><td>71.7</td><td>72.7</td><td>75.6</td><td>75.6</td><td>1</td></tr><tr><td><code>dsad</code></td><td>612</td><td>choice 612</td><td>56.7</td><td style="background:rgba(47, 107, 223, 0.09)">49.5</td><td>59.3</td><td>56.4</td><td>48.2</td><td>56.4</td><td>53.4</td><td><b>59.8</b></td><td>50.0</td><td>49.0</td><td>52.8</td><td>51.3</td><td>47.5</td><td>50.5</td><td>40.7</td><td>50.5</td><td>43.1</td><td>46.4</td><td>40.5</td><td>34.0</td><td>12</td></tr><tr><td><code>fetal_planes_db_burgos_artizzu</code></td><td>273</td><td>choice 273</td><td>59.0</td><td style="background:rgba(47, 107, 223, 0.09)">65.9</td><td><b>71.4</b></td><td>52.4</td><td>64.8</td><td>65.6</td><td>57.9</td><td>60.4</td><td>59.0</td><td>58.6</td><td>58.6</td><td>61.2</td><td>65.9</td><td>52.4</td><td>43.2</td><td>54.9</td><td>57.9</td><td>44.7</td><td>67.0</td><td>49.5</td><td>3</td></tr><tr><td><code>fpus23</code></td><td>411</td><td>choice 411</td><td><b>50.1</b></td><td style="background:rgba(47, 107, 223, 0.09)">44.3</td><td>49.1</td><td>42.1</td><td>49.1</td><td>46.0</td><td>49.4</td><td>46.0</td><td>49.6</td><td>43.1</td><td>42.1</td><td>45.7</td><td>46.5</td><td>43.8</td><td>39.9</td><td>45.0</td><td>42.8</td><td>37.5</td><td>47.2</td><td>33.8</td><td>12</td></tr><tr><td><code>gastrovision</code></td><td>319</td><td>choice 319</td><td>63.6</td><td style="background:rgba(47, 107, 223, 0.09)"><b>66.8</b></td><td>65.8</td><td>65.5</td><td><b>66.8</b></td><td>62.4</td><td>64.9</td><td>60.8</td><td>63.3</td><td>66.1</td><td>63.3</td><td>64.9</td><td>65.2</td><td>61.1</td><td>62.4</td><td>60.2</td><td>57.7</td><td>59.9</td><td>50.8</td><td>46.7</td><td>1</td></tr><tr><td><code>grazpedwri_dx</code></td><td>1,379</td><td>choice 443, noul 936</td><td><b>82.6</b></td><td style="background:rgba(47, 107, 223, 0.09)">81.1</td><td>74.8</td><td>77.3</td><td>73.4</td><td>71.1</td><td>67.7</td><td>70.5</td><td>68.3</td><td>77.2</td><td>76.5</td><td>72.9</td><td>69.4</td><td>68.3</td><td>67.8</td><td>74.1</td><td>66.6</td><td>76.5</td><td>74.8</td><td>68.7</td><td>2</td></tr><tr><td><code>mll23</code></td><td>254</td><td>choice 254</td><td><b>57.9</b></td><td style="background:rgba(47, 107, 223, 0.09)">43.7</td><td>53.1</td><td>51.6</td><td>46.1</td><td>44.9</td><td>48.0</td><td>48.0</td><td>46.1</td><td>44.1</td><td>45.3</td><td>43.3</td><td>48.0</td><td>44.5</td><td>42.9</td><td>40.9</td><td>40.2</td><td>29.9</td><td>42.5</td><td>15.4</td><td>13</td></tr><tr><td><code>olives</code></td><td>1,519</td><td>choice 165, noul 1,354</td><td>74.7</td><td style="background:rgba(47, 107, 223, 0.09)">69.8</td><td><b>80.0</b></td><td>78.6</td><td>78.3</td><td>78.3</td><td>75.0</td><td>69.8</td><td>79.1</td><td>78.3</td><td>78.2</td><td>78.3</td><td>76.4</td><td>71.4</td><td>74.0</td><td>77.0</td><td>73.8</td><td>77.0</td><td>75.2</td><td>58.1</td><td>18</td></tr></tbody></table></div>
</details><!-- /manta:bench_medical_per_source -->
<details><summary><b>A.2 Medical QA: MedQA, MedMCQA, PubMedQA, HEAD-QA</b></summary>
Held-out test splits; options in a fixed random order (published numbers use the original order).<!-- manta:qa_trained -->Both MANTA releases trained on the training splits of MedQA, MedMCQA, PubMedQA, HEAD-QA; the tables report their test splits.<!-- /manta:qa_trained -->
<!-- manta:qa_classic --><div style="overflow-x:auto"><table class="mt"><thead><tr><th style="color:#2F6BDF">Model</th><th style="color:#2F6BDF">MedQA</th><th style="color:#2F6BDF">MedMCQA</th><th style="color:#2F6BDF">PubMedQA</th><th style="color:#2F6BDF">HEAD-QA</th><th style="color:#2F6BDF">Mean</th><th style="color:#2F6BDF">ECE-15 (mean)</th></tr></thead><tbody><tr><td>liquid-d1-ultra</td><td><b>91.8</b></td><td><b>78.4</b></td><td><b>82.2</b></td><td><b>91.6</b></td><td><b>86.0</b></td><td><b>0.026</b></td></tr><tr><td>mammoth-1</td><td>89.9</td><td>78.2</td><td>81.8</td><td>91.2</td><td>85.3</td><td>0.040</td></tr><tr><td>liquid-d1.1</td><td>89.9</td><td>74.9</td><td>80.8</td><td>90.1</td><td>83.9</td><td>0.039</td></tr><tr class="s"><td>MANTA-27B</td><td>88.5</td><td>75.8</td><td>80.6</td><td>89.5</td><td>83.6</td><td>0.059</td></tr><tr><td>drex-max</td><td>89.1</td><td>76.2</td><td>79.6</td><td>88.7</td><td>83.4</td><td>0.050</td></tr><tr><td>jev-1.14</td><td>89.1</td><td>75.4</td><td>78.6</td><td>90.3</td><td>83.4</td><td>0.058</td></tr><tr><td>pplx-decider-v1.2</td><td>88.7</td><td>74.5</td><td>80.4</td><td>89.4</td><td>83.3</td><td>0.044</td></tr><tr><td>jev-1.13</td><td>87.6</td><td>76.3</td><td>77.4</td><td>90.0</td><td>82.8</td><td>0.060</td></tr><tr><td>gpt-6-luna</td><td>90.0</td><td>75.9</td><td>75.6</td><td>89.7</td><td>82.8</td><td>0.072</td></tr><tr><td>liquid-d1</td><td>86.5</td><td>73.7</td><td>81.4</td><td>88.4</td><td>82.5</td><td>0.061</td></tr><tr><td>morph-reflex</td><td>87.0</td><td>73.5</td><td>79.0</td><td>87.5</td><td>81.8</td><td>0.066</td></tr><tr><td>drex-v2.0</td><td>87.2</td><td>71.1</td><td>80.4</td><td>86.5</td><td>81.3</td><td>0.041</td></tr><tr><td>elephant-1</td><td>81.0</td><td>71.8</td><td>79.4</td><td>86.6</td><td>79.7</td><td>0.042</td></tr><tr><td>microsoft-decision-1</td><td>82.1</td><td>72.8</td><td>76.4</td><td>87.4</td><td>79.7</td><td>0.061</td></tr><tr><td>Clef (open weights, our GPUs)</td><td>84.9</td><td>70.2</td><td>75.0</td><td>86.9</td><td>79.3</td><td>0.058</td></tr><tr><td>mercury-decide</td><td>85.9</td><td>69.3</td><td>74.8</td><td>85.3</td><td>78.8</td><td>0.096</td></tr><tr><td>solar-decide</td><td>83.9</td><td>71.2</td><td>74.2</td><td>85.4</td><td>78.7</td><td>0.144</td></tr><tr><td>Clef (API)</td><td>83.6</td><td>68.6</td><td>75.0</td><td>85.9</td><td>78.3</td><td>0.056</td></tr><tr><td>clef-omni</td><td>78.0</td><td>68.7</td><td>74.8</td><td>85.2</td><td>76.7</td><td>0.052</td></tr><tr class="o" style="background:rgba(47, 107, 223, 0.09)"><td>MANTA-4B</td><td>75.2</td><td>67.8</td><td>78.6</td><td>82.6</td><td>76.1</td><td>0.091</td></tr><tr><td>pplx-decider-flash-v1.2</td><td>76.6</td><td>64.6</td><td>76.2</td><td>82.4</td><td>74.9</td><td>0.112</td></tr><tr><td>clef-flash</td><td>74.3</td><td>64.5</td><td>75.8</td><td>82.5</td><td>74.3</td><td>0.061</td></tr><tr><td>drex-v1.5</td><td>73.8</td><td>62.8</td><td>74.4</td><td>80.5</td><td>72.9</td><td>0.084</td></tr><tr><td>solar-decide-flash</td><td>71.1</td><td>59.4</td><td>70.8</td><td>75.6</td><td>69.2</td><td>0.103</td></tr><tr><td>tev1-4b</td><td>67.4</td><td>57.9</td><td>75.0</td><td>75.5</td><td>69.0</td><td>0.072</td></tr><tr><td>kev-4b</td><td>65.1</td><td>50.9</td><td>74.0</td><td>71.9</td><td>65.5</td><td>0.049</td></tr><tr><td>joey-1</td><td>48.9</td><td>44.6</td><td>70.4</td><td>57.2</td><td>55.3</td><td>0.068</td></tr></tbody></table></div>
<sub>Accuracy in % on the questions that all 27 models answered (MedQA 1,271, MedMCQA 4,114, PubMedQA 500, HEAD-QA 2,658). Mean: equal weight per benchmark.</sub><!-- /manta:qa_classic -->
</details>
<details><summary><b>A.3 Medical knowledge and reasoning: MMLU-medical, MedXpertQA-Text</b></summary>
Official test splits, options in a fixed random order; no MANTA training used these benchmarks.
<!-- manta:qa_knowledge --><div style="overflow-x:auto"><table class="mt"><thead><tr><th style="color:#2F6BDF">Model</th><th style="color:#2F6BDF">MMLU-med.</th><th style="color:#2F6BDF">MedXpertQA-Text</th><th style="color:#2F6BDF">Mean</th><th style="color:#2F6BDF">ECE-15 (mean)</th></tr></thead><tbody><tr><td>mammoth-1</td><td>91.0</td><td><b>59.2</b></td><td><b>75.1</b></td><td><b>0.057</b></td></tr><tr><td>liquid-d1-ultra</td><td>91.4</td><td>42.6</td><td>67.0</td><td>0.100</td></tr><tr><td>elephant-1</td><td>86.6</td><td>45.9</td><td>66.2</td><td>0.062</td></tr><tr><td>drex-max</td><td>88.2</td><td>39.3</td><td>63.7</td><td>0.195</td></tr><tr><td>gpt-6-luna</td><td>88.6</td><td>37.6</td><td>63.1</td><td>0.138</td></tr><tr><td>pplx-decider-v1.2</td><td>88.9</td><td>36.7</td><td>62.8</td><td>0.149</td></tr><tr><td>liquid-d1.1</td><td>89.3</td><td>32.4</td><td>60.8</td><td>0.157</td></tr><tr><td>jev-1.14</td><td>91.6</td><td>29.8</td><td>60.7</td><td>0.171</td></tr><tr><td>jev-1.13</td><td>91.5</td><td>29.3</td><td>60.4</td><td>0.181</td></tr><tr class="s"><td>MANTA-27B</td><td>88.8</td><td>29.9</td><td>59.4</td><td>0.216</td></tr><tr><td>morph-reflex</td><td>86.3</td><td>32.3</td><td>59.3</td><td>0.220</td></tr><tr><td>Clef (open weights, our GPUs)</td><td>90.5</td><td>27.8</td><td>59.1</td><td>0.142</td></tr><tr><td>drex-v2.0</td><td>87.1</td><td>30.8</td><td>59.0</td><td>0.124</td></tr><tr><td>liquid-d1</td><td>87.9</td><td>29.7</td><td>58.8</td><td>0.177</td></tr><tr><td>microsoft-decision-1</td><td>87.3</td><td>29.2</td><td>58.2</td><td>0.187</td></tr><tr><td>Clef (API)</td><td>89.9</td><td>25.8</td><td>57.9</td><td>0.148</td></tr><tr><td>mercury-decide</td><td>86.5</td><td>26.8</td><td>56.6</td><td>0.258</td></tr><tr><td>solar-decide</td><td>86.5</td><td>26.7</td><td>56.6</td><td>0.292</td></tr><tr><td>clef-omni</td><td><b>93.3</b></td><td>18.6</td><td>56.0</td><td>0.166</td></tr><tr><td>clef-flash</td><td>91.9</td><td>19.0</td><td>55.5</td><td>0.193</td></tr><tr><td>pplx-decider-flash-v1.2</td><td>82.8</td><td>24.5</td><td>53.7</td><td>0.281</td></tr><tr><td>drex-v1.5</td><td>82.2</td><td>22.8</td><td>52.5</td><td>0.217</td></tr><tr class="o" style="background:rgba(47, 107, 223, 0.09)"><td>MANTA-4B</td><td>82.6</td><td>20.3</td><td>51.4</td><td>0.246</td></tr><tr><td>solar-decide-flash</td><td>79.0</td><td>17.1</td><td>48.1</td><td>0.236</td></tr><tr><td>tev1-4b</td><td>78.1</td><td>16.1</td><td>47.1</td><td>0.218</td></tr><tr><td>joey-1</td><td>59.3</td><td>30.9</td><td>45.1</td><td>0.065</td></tr><tr><td>kev-4b</td><td>73.2</td><td>14.6</td><td>43.9</td><td>0.122</td></tr></tbody></table></div>
<sub>Accuracy in % on the questions that all 27 models answered (MMLU-med. 1,788, MedXpertQA-Text 2,438). Mean: equal weight per benchmark.</sub><!-- /manta:qa_knowledge -->
</details>
<details><summary><b>A.4 Medical exam sets with images: MedXpertQA-MM, WorldMedQA-V</b></summary>
No MANTA training used these benchmarks.
<!-- manta:qa_exam --><div style="overflow-x:auto"><table class="mt"><thead><tr><th style="color:#2F6BDF">Model</th><th style="color:#2F6BDF">MedXpertQA-MM</th><th style="color:#2F6BDF">WorldMedQA-V (local)</th><th style="color:#2F6BDF">WorldMedQA-V (English)</th><th style="color:#2F6BDF">Mean</th><th style="color:#2F6BDF">ECE-15 (pooled)</th></tr></thead><tbody><tr><td>liquid-d1-ultra</td><td><b>59.2</b></td><td>84.3</td><td>78.7</td><td><b>70.3</b></td><td><b>0.102</b></td></tr><tr><td>mammoth-1</td><td>53.6</td><td>84.6</td><td>75.5</td><td>66.8</td><td>0.147</td></tr><tr><td>jev-1.14</td><td>47.6</td><td><b>88.1</b></td><td><b>82.2</b></td><td>66.3</td><td>0.148</td></tr><tr><td>liquid-d1.1</td><td>50.6</td><td>81.9</td><td>76.9</td><td>65.0</td><td>0.123</td></tr><tr><td>pplx-decider-v1.2</td><td>48.7</td><td>84.6</td><td>73.1</td><td>63.8</td><td>0.121</td></tr><tr class="s"><td>MANTA-27B</td><td>46.7</td><td>81.2</td><td>76.2</td><td>62.7</td><td>0.198</td></tr><tr><td>gpt-6-luna</td><td>46.0</td><td>83.6</td><td>74.5</td><td>62.5</td><td>0.200</td></tr><tr><td>jev-1.13</td><td>45.3</td><td>81.9</td><td>77.3</td><td>62.5</td><td>0.153</td></tr><tr><td>drex-max</td><td>48.4</td><td>79.2</td><td>72.7</td><td>62.2</td><td>0.221</td></tr><tr><td>liquid-d1</td><td>45.8</td><td>81.2</td><td>75.2</td><td>62.0</td><td>0.160</td></tr><tr><td>Clef (open weights, our GPUs)</td><td>42.1</td><td>80.2</td><td>75.5</td><td>60.0</td><td>0.177</td></tr><tr><td>morph-reflex</td><td>43.9</td><td>80.9</td><td>70.6</td><td>59.9</td><td>0.221</td></tr><tr><td>mercury-decide</td><td>40.5</td><td>80.5</td><td>72.7</td><td>58.6</td><td>0.322</td></tr><tr><td>elephant-1</td><td>40.4</td><td>75.8</td><td>73.4</td><td>57.5</td><td>0.176</td></tr><tr><td>Clef (API)</td><td>39.1</td><td>79.5</td><td>72.0</td><td>57.4</td><td>0.200</td></tr><tr><td>pplx-decider-flash-v1.2</td><td>35.2</td><td>71.0</td><td>72.7</td><td>53.5</td><td>0.293</td></tr><tr class="o" style="background:rgba(47, 107, 223, 0.09)"><td>MANTA-4B</td><td>32.2</td><td>75.4</td><td>72.4</td><td>53.1</td><td>0.285</td></tr><tr><td>clef-omni</td><td>31.8</td><td>73.7</td><td>72.0</td><td>52.4</td><td>0.186</td></tr><tr><td>clef-flash</td><td>33.0</td><td>71.7</td><td>71.0</td><td>52.1</td><td>0.197</td></tr><tr><td>joey-1</td><td>25.6</td><td>41.0</td><td>44.8</td><td>34.2</td><td>0.165</td></tr></tbody></table></div>
<sub>Accuracy in % on the questions that all 20 models answered (MedXpertQA-MM 1,577, WorldMedQA-V (local) 293, WorldMedQA-V (English) 286). Mean = (MedXpertQA-MM + WorldMedQA-V) / 2, with WorldMedQA-V the mean of its local and English versions (the same questions in two languages).</sub><!-- /manta:qa_exam -->
</details>
<details><summary><b>A.5 General decisions</b></summary>
MANTA-Bench general text and image sources, with the same rules (in-domain: MANTA trained on their trainingsplits; the other models answer zero-shot).
<!-- manta:general --><div style="overflow-x:auto"><table class="mt"><thead><tr><th style="color:#2F6BDF">Model</th><th style="color:#2F6BDF">Accuracy</th><th style="color:#2F6BDF">ECE-15</th><th style="color:#2F6BDF">In-domain acc.</th><th style="color:#2F6BDF">In-domain ECE-15</th><th style="color:#2F6BDF">Out-of-domain acc.</th><th style="color:#2F6BDF">Out-of-domain ECE-15</th></tr></thead><tbody><tr class="s"><td>MANTA-27B</td><td><b>91.3</b> <span class="ci">[90.8, 91.7]</span></td><td>0.011</td><td><b>91.3</b></td><td>0.010</td><td><b>92.2</b></td><td>0.041</td></tr><tr class="o" style="background:rgba(47, 107, 223, 0.09)"><td>MANTA-4B</td><td>90.4 <span class="ci">[89.9, 90.9]</span></td><td>0.009</td><td>90.4</td><td>0.009</td><td>90.7</td><td>0.040</td></tr><tr><td>pplx-decider-v1.2</td><td>87.2 <span class="ci">[86.6, 87.7]</span></td><td>0.013</td><td>87.1</td><td>0.012</td><td>91.1</td><td>0.087</td></tr><tr><td>mammoth-1</td><td>86.1 <span class="ci">[85.5, 86.7]</span></td><td>0.009</td><td>86.0</td><td>0.010</td><td>91.1</td><td>0.035</td></tr><tr><td>liquid-d1-ultra</td><td>85.6 <span class="ci">[84.9, 86.2]</span></td><td>0.010</td><td>85.5</td><td>0.009</td><td>91.1</td><td>0.067</td></tr><tr><td>Clef (open weights, our GPUs)</td><td>85.0 <span class="ci">[84.3, 85.6]</span></td><td><b>0.008</b></td><td>84.9</td><td>0.009</td><td>90.3</td><td>0.055</td></tr><tr><td>Clef (API)</td><td>84.6 <span class="ci">[83.9, 85.3]</span></td><td><b>0.008</b></td><td>84.5</td><td><b>0.008</b></td><td>89.6</td><td>0.057</td></tr><tr><td>elephant-1</td><td>84.2 <span class="ci">[83.5, 84.9]</span></td><td>0.014</td><td>84.2</td><td>0.013</td><td>88.1</td><td>0.039</td></tr><tr><td>pplx-decider-flash-v1.2</td><td>84.0 <span class="ci">[83.3, 84.6]</span></td><td>0.012</td><td>83.9</td><td>0.012</td><td>90.9</td><td>0.102</td></tr><tr><td>morph-reflex</td><td>84.0 <span class="ci">[83.4, 84.6]</span></td><td>0.065</td><td>83.9</td><td>0.067</td><td>89.4</td><td><b>0.025</b></td></tr><tr><td>liquid-d1</td><td>83.8 <span class="ci">[83.1, 84.5]</span></td><td>0.027</td><td>83.7</td><td>0.028</td><td>88.6</td><td>0.043</td></tr><tr><td>clef-omni</td><td>83.6 <span class="ci">[82.8, 84.3]</span></td><td>0.028</td><td>83.5</td><td>0.029</td><td>89.4</td><td>0.067</td></tr><tr><td>clef-flash</td><td>83.4 <span class="ci">[82.6, 84.0]</span></td><td>0.009</td><td>83.3</td><td>0.009</td><td>89.4</td><td>0.065</td></tr><tr><td>liquid-d1.1</td><td>83.3 <span class="ci">[82.7, 83.9]</span></td><td><b>0.008</b></td><td>83.2</td><td><b>0.008</b></td><td>91.5</td><td>0.048</td></tr><tr><td>mercury-decide</td><td>82.8 <span class="ci">[82.1, 83.4]</span></td><td>0.082</td><td>82.7</td><td>0.083</td><td>87.9</td><td>0.034</td></tr><tr><td>jev-1.14</td><td>81.6 <span class="ci">[80.9, 82.3]</span></td><td>0.028</td><td>81.5</td><td>0.028</td><td>90.7</td><td>0.030</td></tr><tr><td>jev-1.13</td><td>81.1 <span class="ci">[80.4, 81.7]</span></td><td>0.039</td><td>80.9</td><td>0.039</td><td>90.7</td><td>0.039</td></tr><tr><td>joey-1</td><td>77.7 <span class="ci">[76.7, 78.6]</span></td><td>0.024</td><td>77.5</td><td>0.024</td><td>85.4</td><td>0.038</td></tr><tr><td>gpt-6-luna</td><td>77.4 <span class="ci">[76.6, 78.2]</span></td><td>0.102</td><td>77.7</td><td>0.103</td><td>65.9</td><td>0.051</td></tr></tbody></table></div>
<sub>23,231 questions that all 19 models answered (22,759 in-domain, 472 out-of-domain); accuracy in %, 95 % bootstrap interval over requests (1000 draws).</sub>
<sub>Not ranked (answered fewer than 90 % of the questions because of provider refusals): drex-max (56 %).</sub><!-- /manta:general -->
</details>
<details><summary><b>A.6 Comparison with chat models</b></summary>
GPT-6 Luna (chat), Claude Sonnet 5.5, Gemini 3.8 Flash and MedGemma 27B with the decision models, on subsets ofA.1 to A.5; accuracy only (the chat models give no option probabilities).
MANTA-Bench medical, at most 20 requests per source:
<!-- manta:chat_block1 --><div style="overflow-x:auto"><table class="mt"><thead><tr><th style="color:#2F6BDF">Model</th><th style="color:#2F6BDF">Accuracy</th><th style="color:#2F6BDF">In-domain acc.</th><th style="color:#2F6BDF">Out-of-domain acc.</th></tr></thead><tbody><tr class="s"><td>MANTA-27B</td><td><b>86.1</b> <span class="ci">[85.0, 87.2]</span></td><td>87.2</td><td>74.4</td></tr><tr class="o" style="background:rgba(47, 107, 223, 0.09)"><td>MANTA-4B</td><td><b>86.1</b> <span class="ci">[85.0, 87.1]</span></td><td><b>87.4</b></td><td>71.5</td></tr><tr><td>Gemini 3.8 Flash</td><td>76.0 <span class="ci">[74.6, 77.4]</span></td><td>76.2</td><td>73.6</td></tr><tr><td>Claude Sonnet 5.5</td><td>74.6 <span class="ci">[73.2, 75.9]</span></td><td>74.2</td><td><b>79.1</b></td></tr><tr><td>liquid-d1-ultra</td><td>71.2 <span class="ci">[69.8, 72.5]</span></td><td>71.0</td><td>73.3</td></tr><tr><td>pplx-decider-v1.2</td><td>70.5 <span class="ci">[69.1, 71.9]</span></td><td>70.4</td><td>71.3</td></tr><tr><td>liquid-d1.1</td><td>70.4 <span class="ci">[68.9, 71.8]</span></td><td>70.5</td><td>69.0</td></tr><tr><td>mammoth-1</td><td>70.3 <span class="ci">[68.9, 71.7]</span></td><td>70.2</td><td>71.5</td></tr><tr><td>liquid-d1</td><td>69.9 <span class="ci">[68.4, 71.3]</span></td><td>70.1</td><td>67.1</td></tr><tr><td>Clef (open weights, our GPUs)</td><td>69.5 <span class="ci">[68.1, 70.9]</span></td><td>69.3</td><td>72.2</td></tr><tr><td>jev-1.14</td><td>69.5 <span class="ci">[68.1, 70.9]</span></td><td>69.9</td><td>64.8</td></tr><tr><td>drex-max</td><td>69.4 <span class="ci">[68.0, 71.0]</span></td><td>69.3</td><td>70.9</td></tr><tr><td>Clef (API)</td><td>69.1 <span class="ci">[67.8, 70.5]</span></td><td>69.0</td><td>70.9</td></tr><tr><td>mercury-decide</td><td>68.5 <span class="ci">[67.2, 69.9]</span></td><td>68.4</td><td>69.3</td></tr><tr><td>elephant-1</td><td>68.1 <span class="ci">[66.7, 69.4]</span></td><td>68.2</td><td>66.2</td></tr><tr><td>morph-reflex</td><td>68.1 <span class="ci">[66.7, 69.6]</span></td><td>68.0</td><td>68.6</td></tr><tr><td>jev-1.13</td><td>67.7 <span class="ci">[66.4, 69.1]</span></td><td>67.9</td><td>65.7</td></tr><tr><td>clef-flash</td><td>66.3 <span class="ci">[64.9, 67.8]</span></td><td>66.1</td><td>69.0</td></tr><tr><td>pplx-decider-flash-v1.2</td><td>65.8 <span class="ci">[64.4, 67.2]</span></td><td>65.9</td><td>65.0</td></tr><tr><td>clef-omni</td><td>64.3 <span class="ci">[62.9, 65.7]</span></td><td>63.7</td><td>70.4</td></tr><tr><td>gpt-6-luna</td><td>64.2 <span class="ci">[62.7, 65.5]</span></td><td>63.7</td><td>69.3</td></tr><tr><td>GPT-6 Luna (chat)</td><td>62.4 <span class="ci">[60.9, 63.9]</span></td><td>61.8</td><td>69.9</td></tr><tr><td>joey-1</td><td>56.6 <span class="ci">[55.1, 58.0]</span></td><td>56.6</td><td>56.0</td></tr><tr><td>MedGemma 27B (local)</td><td>52.3 <span class="ci">[51.0, 53.7]</span></td><td>52.3</td><td>52.3</td></tr></tbody></table></div>
<sub>6,700 questions that all 24 models answered; accuracy in %. Chat models (GPT-6 Luna chat, Claude Sonnet 5.5, Gemini 3.8 Flash) at the lowest reasoning setting their API accepts (Luna: none; Sonnet, Gemini: low), accuracy only; MedGemma 27B run locally (vLLM, temperature 0).</sub><!-- /manta:chat_block1 -->
Medical QA suite and exam sets, at most 500 requests per benchmark:
<!-- manta:chat_block2 --><div style="overflow-x:auto"><table class="mt"><thead><tr><th style="color:#2F6BDF">Model</th><th style="color:#2F6BDF">Accuracy</th><th style="color:#2F6BDF">MedQA</th><th style="color:#2F6BDF">MedMCQA</th><th style="color:#2F6BDF">PubMedQA</th><th style="color:#2F6BDF">HEAD-QA</th><th style="color:#2F6BDF">MMLU-med.</th><th style="color:#2F6BDF">MedXpertQA-Text</th><th style="color:#2F6BDF">MedXpertQA-MM</th><th style="color:#2F6BDF">WorldMedQA-V (local)</th><th style="color:#2F6BDF">WorldMedQA-V (English)</th></tr></thead><tbody><tr><td>Gemini 3.8 Flash</td><td><b>86.5</b> <span class="ci">[85.3, 87.5]</span></td><td><b>97.5</b></td><td><b>86.0</b></td><td>81.8</td><td><b>94.6</b></td><td>91.5</td><td><b>66.0</b></td><td><b>86.2</b></td><td><b>90.4</b></td><td><b>85.4</b></td></tr><tr><td>Claude Sonnet 5.5</td><td>81.6 <span class="ci">[80.3, 82.7]</span></td><td>95.9</td><td>80.8</td><td>80.0</td><td>93.2</td><td>90.9</td><td>53.0</td><td>72.2</td><td>87.9</td><td>82.1</td></tr><tr><td>mammoth-1</td><td>78.2 <span class="ci">[76.9, 79.5]</span></td><td>90.7</td><td>78.5</td><td>81.8</td><td>92.6</td><td>89.9</td><td>57.6</td><td>51.0</td><td>84.4</td><td>76.6</td></tr><tr><td>liquid-d1-ultra</td><td>77.5 <span class="ci">[76.2, 78.8]</span></td><td>91.8</td><td>76.7</td><td><b>82.2</b></td><td>92.2</td><td>91.1</td><td>42.9</td><td>58.4</td><td>84.4</td><td>79.6</td></tr><tr><td>GPT-6 Luna (chat)</td><td>73.9 <span class="ci">[72.5, 75.2]</span></td><td>89.9</td><td>75.7</td><td>75.6</td><td>90.8</td><td>89.2</td><td>40.4</td><td>49.2</td><td>81.2</td><td>73.4</td></tr><tr><td>liquid-d1.1</td><td>73.9 <span class="ci">[72.5, 75.3]</span></td><td>90.9</td><td>74.9</td><td>80.8</td><td>89.8</td><td>88.4</td><td>32.7</td><td>49.7</td><td>81.6</td><td>78.1</td></tr><tr><td>jev-1.14</td><td>73.8 <span class="ci">[72.5, 75.2]</span></td><td>88.7</td><td>75.5</td><td>78.6</td><td>90.0</td><td>90.9</td><td>31.3</td><td>45.4</td><td>87.6</td><td>83.2</td></tr><tr><td>drex-max</td><td>73.5 <span class="ci">[72.2, 74.8]</span></td><td>88.5</td><td>73.9</td><td>79.6</td><td>88.8</td><td>87.8</td><td>42.2</td><td>47.9</td><td>78.7</td><td>73.7</td></tr><tr><td>pplx-decider-v1.2</td><td>73.5 <span class="ci">[72.2, 74.8]</span></td><td>89.3</td><td>71.9</td><td>80.4</td><td>90.4</td><td>87.8</td><td>38.9</td><td>45.9</td><td>84.8</td><td>74.1</td></tr><tr><td>gpt-6-luna</td><td>73.5 <span class="ci">[72.1, 74.8]</span></td><td>90.7</td><td>74.5</td><td>75.6</td><td>90.8</td><td>87.8</td><td>40.6</td><td>44.8</td><td>83.3</td><td>74.8</td></tr><tr><td>jev-1.13</td><td>72.7 <span class="ci">[71.4, 74.2]</span></td><td>87.7</td><td>76.5</td><td>77.4</td><td>90.6</td><td>91.1</td><td>30.0</td><td>44.5</td><td>81.6</td><td>78.1</td></tr><tr class="s"><td>MANTA-27B</td><td>72.5 <span class="ci">[71.2, 74.0]</span></td><td>87.7</td><td>73.5</td><td>80.6</td><td>89.2</td><td>88.6</td><td>30.4</td><td>47.0</td><td>81.2</td><td>77.4</td></tr><tr><td>liquid-d1</td><td>72.1 <span class="ci">[70.7, 73.4]</span></td><td>88.7</td><td>73.1</td><td>81.4</td><td>88.0</td><td>87.6</td><td>31.5</td><td>43.9</td><td>80.9</td><td>75.9</td></tr><tr><td>elephant-1</td><td>71.5 <span class="ci">[70.0, 72.8]</span></td><td>81.7</td><td>70.9</td><td>79.4</td><td>88.0</td><td>85.6</td><td>47.6</td><td>40.3</td><td>75.9</td><td>73.7</td></tr><tr><td>morph-reflex</td><td>71.1 <span class="ci">[69.8, 72.5]</span></td><td>89.1</td><td>71.9</td><td>79.0</td><td>87.6</td><td>85.0</td><td>33.3</td><td>43.0</td><td>80.9</td><td>71.5</td></tr><tr><td>Clef (open weights, our GPUs)</td><td>70.0 <span class="ci">[68.7, 71.5]</span></td><td>85.2</td><td>69.2</td><td>75.0</td><td>86.9</td><td>91.9</td><td>29.2</td><td>40.3</td><td>80.1</td><td>75.9</td></tr><tr><td>Clef (API)</td><td>68.5 <span class="ci">[67.1, 70.0]</span></td><td>82.9</td><td>66.4</td><td>75.0</td><td>86.5</td><td>90.9</td><td>27.3</td><td>38.8</td><td>79.4</td><td>72.3</td></tr><tr><td>mercury-decide</td><td>68.3 <span class="ci">[66.9, 69.8]</span></td><td>86.6</td><td>66.4</td><td>74.8</td><td>86.5</td><td>84.0</td><td>27.7</td><td>39.4</td><td>80.1</td><td>73.0</td></tr><tr><td>clef-omni</td><td>65.7 <span class="ci">[64.2, 67.2]</span></td><td>76.5</td><td>69.6</td><td>74.8</td><td>87.3</td><td><b>92.3</b></td><td>17.2</td><td>29.8</td><td>73.4</td><td>72.3</td></tr><tr><td>pplx-decider-flash-v1.2</td><td>65.2 <span class="ci">[63.7, 66.6]</span></td><td>78.2</td><td>67.2</td><td>76.2</td><td>83.1</td><td>79.1</td><td>26.5</td><td>34.5</td><td>70.9</td><td>73.0</td></tr><tr class="o" style="background:rgba(47, 107, 223, 0.09)"><td>MANTA-4B</td><td>64.5 <span class="ci">[63.1, 66.0]</span></td><td>71.4</td><td>66.2</td><td>78.6</td><td>83.7</td><td>82.8</td><td>20.1</td><td>34.1</td><td>75.5</td><td>73.0</td></tr><tr><td>clef-flash</td><td>64.4 <span class="ci">[63.0, 65.9]</span></td><td>73.0</td><td>63.4</td><td>75.8</td><td>83.3</td><td>89.7</td><td>20.5</td><td>32.7</td><td>71.3</td><td>72.3</td></tr><tr><td>MedGemma 27B (local)</td><td>60.4 <span class="ci">[59.0, 61.9]</span></td><td>69.8</td><td>62.6</td><td>77.2</td><td>78.1</td><td>78.5</td><td>17.4</td><td>27.2</td><td>70.2</td><td>65.3</td></tr><tr><td>joey-1</td><td>48.3 <span class="ci">[46.9, 49.9]</span></td><td>51.4</td><td>43.7</td><td>70.4</td><td>58.8</td><td>58.8</td><td>32.3</td><td>26.7</td><td>40.4</td><td>44.9</td></tr></tbody></table></div>
<sub>3,959 questions that all 24 models answered; accuracy in %. Chat models (GPT-6 Luna chat, Claude Sonnet 5.5, Gemini 3.8 Flash) at the lowest reasoning setting their API accepts (Luna: none; Sonnet, Gemini: low), accuracy only; MedGemma 27B run locally (vLLM, temperature 0).</sub><!-- /manta:chat_block2 -->
General decisions, at most 50 requests per source:
<!-- manta:chat_block3 --><div style="overflow-x:auto"><table class="mt"><thead><tr><th style="color:#2F6BDF">Model</th><th style="color:#2F6BDF">Accuracy</th><th style="color:#2F6BDF">In-domain acc.</th><th style="color:#2F6BDF">Out-of-domain acc.</th></tr></thead><tbody><tr class="s"><td>MANTA-27B</td><td><b>90.7</b> <span class="ci">[89.6, 91.7]</span></td><td><b>90.6</b></td><td><b>96.0</b></td></tr><tr class="o" style="background:rgba(47, 107, 223, 0.09)"><td>MANTA-4B</td><td>90.1 <span class="ci">[89.0, 91.2]</span></td><td>90.0</td><td><b>96.0</b></td></tr><tr><td>Gemini 3.8 Flash</td><td>88.5 <span class="ci">[87.5, 89.6]</span></td><td>88.4</td><td><b>96.0</b></td></tr><tr><td>pplx-decider-v1.2</td><td>86.8 <span class="ci">[85.7, 87.9]</span></td><td>86.7</td><td>94.0</td></tr><tr><td>mammoth-1</td><td>86.0 <span class="ci">[84.9, 87.1]</span></td><td>85.9</td><td>93.0</td></tr><tr><td>Claude Sonnet 5.5</td><td>86.0 <span class="ci">[84.8, 87.2]</span></td><td>86.0</td><td>88.0</td></tr><tr><td>liquid-d1-ultra</td><td>85.2 <span class="ci">[83.9, 86.4]</span></td><td>85.0</td><td>93.0</td></tr><tr><td>Clef (open weights, our GPUs)</td><td>84.6 <span class="ci">[83.4, 85.9]</span></td><td>84.4</td><td>94.0</td></tr><tr><td>Clef (API)</td><td>84.4 <span class="ci">[83.2, 85.7]</span></td><td>84.3</td><td>93.0</td></tr><tr><td>elephant-1</td><td>84.4 <span class="ci">[83.2, 85.6]</span></td><td>84.3</td><td>93.0</td></tr><tr><td>morph-reflex</td><td>83.9 <span class="ci">[82.7, 85.1]</span></td><td>83.7</td><td>92.0</td></tr><tr><td>liquid-d1.1</td><td>83.4 <span class="ci">[82.3, 84.6]</span></td><td>83.2</td><td><b>96.0</b></td></tr><tr><td>pplx-decider-flash-v1.2</td><td>83.4 <span class="ci">[82.1, 84.7]</span></td><td>83.2</td><td>93.0</td></tr><tr><td>liquid-d1</td><td>83.2 <span class="ci">[82.0, 84.5]</span></td><td>83.1</td><td>92.0</td></tr><tr><td>clef-omni</td><td>83.0 <span class="ci">[81.6, 84.4]</span></td><td>82.8</td><td>92.0</td></tr><tr><td>clef-flash</td><td>82.8 <span class="ci">[81.4, 84.2]</span></td><td>82.6</td><td>93.0</td></tr><tr><td>mercury-decide</td><td>82.7 <span class="ci">[81.5, 83.9]</span></td><td>82.5</td><td>94.0</td></tr><tr><td>jev-1.14</td><td>81.7 <span class="ci">[80.3, 83.1]</span></td><td>81.5</td><td>95.0</td></tr><tr><td>jev-1.13</td><td>80.8 <span class="ci">[79.5, 82.2]</span></td><td>80.6</td><td>93.0</td></tr><tr><td>GPT-6 Luna (chat)</td><td>79.6 <span class="ci">[78.0, 81.1]</span></td><td>80.1</td><td>47.0</td></tr><tr><td>gpt-6-luna</td><td>77.0 <span class="ci">[75.5, 78.5]</span></td><td>77.3</td><td>59.0</td></tr><tr><td>joey-1</td><td>76.8 <span class="ci">[74.8, 78.5]</span></td><td>76.5</td><td>92.0</td></tr><tr><td>MedGemma 27B (local)</td><td>74.0 <span class="ci">[72.3, 75.8]</span></td><td>74.0</td><td>73.0</td></tr></tbody></table></div>
<sub>5,792 questions that all 23 models answered; accuracy in %. Chat models (GPT-6 Luna chat, Claude Sonnet 5.5, Gemini 3.8 Flash) at the lowest reasoning setting their API accepts (Luna: none; Sonnet, Gemini: low), accuracy only; MedGemma 27B run locally (vLLM, temperature 0).</sub>
<sub>Not ranked (answered fewer than 90 % of the questions because of provider refusals): drex-max (54 %).</sub><!-- /manta:chat_block3 -->
</details>
<details><summary><b>A.7 Compared models: provider model versions</b></summary>
<!-- manta:compared_models -->- **MANTA-27B**: the other MANTA release ([gevaertlab/MANTA-27B](https://huggingface.co/gevaertlab/MANTA-27B))- `clef`: cloudflare/clef (Cloudflare); open weights: [Cloudflare/clef](https://huggingface.co/Cloudflare/clef)- `clef-flash`: cloudflare/clef-flash (Cloudflare); open weights: [Cloudflare/clef-flash](https://huggingface.co/Cloudflare/clef-flash)- `clef-gpu`: the open Clef weights, run on our GPUs with the MANTA evaluation code; open weights: [Cloudflare/clef](https://huggingface.co/Cloudflare/clef)- `clef-omni`: cloudflare/clef-omni-20261009 (Cloudflare); open weights: [Cloudflare/clef-omni](https://huggingface.co/Cloudflare/clef-omni)- `drex-max`: nace-ai/drex-max-20261016 (DeepInfra)- `drex-v1.5`: nace-ai/drex-v1.5-20261009 (DeepInfra); open weights: [nace-ai/drex-v1.5](https://huggingface.co/nace-ai/drex-v1.5)- `drex-v2.0`: nace-ai/drex-v2.0-20261009 (DeepInfra); open weights: [nace-ai/drex-v2.0](https://huggingface.co/nace-ai/drex-v2.0)- `elephant-1`: baseten/elephant-1-20261021 (BaseTen); open weights: [baselabs/elephant-1](https://huggingface.co/baselabs/elephant-1)- `gpt-6-luna`: openai/gpt-6-luna-decisions-20261006 (OpenAI)- `jev-1.13`: typesafe/jev-1.13-20260917 (TypeSafe)- `jev-1.14`: typesafe/jev-1.14-20261014 (TypeSafe)- `joey-1`: baseten/joey-1-20261029 (BaseTen); open weights: [baselabs/joey-1](https://huggingface.co/baselabs/joey-1)- `kev-4b`: jaredpalmer/kev-4b-20260924 (Phala); open weights: [jaredpalmer/kev-4b](https://huggingface.co/jaredpalmer/kev-4b)- `liquid-d1`: liquid/d1-20260930 (Liquid)- `liquid-d1-ultra`: liquid/d1-ultra-20261015 (Liquid)- `liquid-d1.1`: liquid/d1.1-20261027 (Liquid)- `mammoth-1`: baseten/mammoth-1-20261021 (BaseTen); open weights: [baselabs/mammoth-1](https://huggingface.co/baselabs/mammoth-1)- `mercury-decide`: inception/mercury-decide-20260930 (Inception)- `microsoft-decision-1`: microsoft/microsoft-decision-1-20261009 (Azure)- `morph-reflex`: morph/reflex-20261103 (Morph)- `pplx-decider-flash-v1.2`: perplexity/pplx-decider-flash-v1.2-20261016 (Perplexity); open weights: [perplexity-ai/pplx-decider-flash-v1.2](https://huggingface.co/perplexity-ai/pplx-decider-flash-v1.2)- `pplx-decider-v1.2`: perplexity/pplx-decider-v1.2-20261016 (Perplexity); open weights: [perplexity-ai/pplx-decider-v1.2](https://huggingface.co/perplexity-ai/pplx-decider-v1.2)- `solar-decide`: upstage/solar-decide-20260928 (Upstage)- `solar-decide-flash`: upstage/solar-decide-flash-20261008 (Upstage)- `tev1-4b`: togethercomputer/tev1-4b-experimental-20260923 (Together); open weights: [togethercomputer/Tev1-4B-experimental](https://huggingface.co/togethercomputer/Tev1-4B-experimental)
Chat models (comparison with chat models only):
- `claude-sonnet-5.5`: anthropic/claude-sonnet-5.5 (Google)- `gemini-3.8-flash`: google/gemini-3.8-flash (Google)- `gpt-6-luna-chat`: openai/gpt-6-luna (Azure)- `medgemma-27b`: google/medgemma-27b-it@2d3e00ea38b50018bf5dd3aa1009457cd2d5a48f (run on our GPUs with vLLM); open weights: [google/medgemma-27b-it](https://huggingface.co/google/medgemma-27b-it)
<sub>Open weights: the public weights of the evaluated version in the builder's Hugging Face repository, from the builders' model cards, documentation and changelogs (checked on 9 Nov 2026).</sub><!-- /manta:compared_models -->
</details>
<details><summary><b>A.8 Reproduction</b></summary>
We compared the probabilities of this checkpoint with the predictions of the evaluation runs, on the sameevaluation requests.
<!-- manta:reproduce -->On 200 evaluation requests (493 questions) this checkpoint gives the saved option order for every question (0 mismatches), the same top option for 99.8 % of the questions and a largest probability difference of 0.055 against the predictions of the evaluation runs; against the unmerged training weights: 99.6 % same top option, largest difference 0.058. The differences come from bfloat16 rounding (the merged weights, one request per batch instead of the evaluation's packed batches); the questions whose top option differs are near-ties.<!-- /manta:reproduce -->
</details>1234567891011121314151617181920212223242526272829303132333435b0f1c8afd4454d5b950b0a38d0803b30d7f050b24cdf956af2ecca59c5360533 assets/accuracy_latency.png8c534eb13a3bbdd0b893a2638271e02a960d3ac3804d18cfad141d1416682a45 assets/examples/cadica.jpgb2f21efb7248489f87f3e674afcf888a38afc6b18e85ce4929f0d84856806450 assets/examples/gastrovision.jpge461626c461180a5ad2c3d4b5cee00c4ecdf31d57a413a83341965a384f57bab assets/examples/grazpedwri_dx.jpgfa2aae795d77774d8487d72e74b8c79ff1a2360933a11d079725267e921860d2 assets/examples/olives.jpg0780db737deaa18f51148e971b9d2aa7a3a19d3c151a6072b442c03009872e77 assets/manta_logo_cropped.pnga4aee8afcf2e0711942cf848899be66016f8d14a889ff9ede07bca099c28f715 chat_template.jinja75d7921d1cc2bdd1125f4d8786c891b34e7e1145a103408f7f150b385fe248df config.json970496741cd66905baa930dc37e0a4368e48876d5fb7a3c1327f0980f5d9b6b4 configuration_manta.pye0e18ca44e6d070c2290ea3f75d8c7a6adf5d2fb5d3b6c5ed3c836a3bd82c69f example.pyaf759685977655fe3b1f514f10e7be390d1b7bb890b623380be6a9836f0ca821 examples/image_request.json18bb96e583c67ee421d36317f13b36ecac91cf58040e44a03a9455e471a2d9cc examples/text_request.jsonc71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4 LICENSEbbedc3fda3305820b977265f01b8619d87570a6739de3a5582c3464840f1e57a LICENSE_base_modele94b5191aaa0246f74799690aeefb94977dccbfd22cbef9b5237e1be9171e09d manta/head.py0ab107292a9085732e6d9ca2559902d80770c264fcf478c409c042615efff230 manta/images.pyfaad9b08d2a197161fb37ea44c6e1fb7a0ad3515f5b8985be4d22d2640276c09 manta/__init__.pycd48d85bbfa355fcab0aaba56ca16490e6b8bf7cbda15edbd2f34b4d880803bb manta/lora.py0b4a4a403713d2978e15a6c0dd61c8bd5bbd95649612b20937374f4a57a7aa96 manta/model.py74c91817888d84c9c224675689a2793b1117018844986035c44e1f0553aa1064 manta/prompt.py5996e0889683f5691742238486e7dfbd8b50055be6a81b786ce73c8b1e0eeca3 manta/records.py30302e25cf67833e0c568bc1e6b3adc24f0dbeb015cc90c112127dcc67ebd632 manta/request.pya9d356d7bdf1ef4949e3e748e95b8e10ad9d4e2e838eddc38a0a7b6b94d1db8d merges.txt8fd59fa5f72284247bab247dd119594232d80ac568712706385a670e6a8af33a model-00001-of-00003.safetensors216777578f1be3c239d0cbf7cbf57a91fc8ab04b0281144980da31ea3d46c033 model-00002-of-00003.safetensorsf2be2efaca515b1bd79e0513d441b65d5884acbd6c655ecdd0f433c5152bc803 model-00003-of-00003.safetensors6a56c01e2dfd1a66bf90e7901aef1ebac54389031782348a33c2529501012065 modeling_manta.pyfe84416247070b9317119898d6df897143374b166688fafc524a8983b518b39e model.safetensors.index.json27225450ac9c6529872ee1924fcb0962ff5634834f817040f444118116f4e516 preprocessor_config.json7b5879f0a4b17719c3213e72899413c79acfa524301ef6ac9982eee8fa55a259 README.mda05647f2feea5d431f15f290efe14263844060626bf2f5386b8d64b51051178a requirements.txt316230d6a809701f4db5ea8f8fc862bc3a6f3229c937c174e674ff3ca0a64ac8 tokenizer_config.json5f9e4d4901a92b997e463c1f46055088b6cca5ca61a6522d1b9f64c4bb81cb42 tokenizer.json7768af27c1fafa9cc9011c1dc20067e03f8915e03b63504550e11d5066986d13 video_preprocessor_config.jsonce99b4cb2983d118806ce0a8b777a35b093e2000a503ebde25853284c9dfa003 vocab.json123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154{%- set image_count = namespace(value=0) %}{%- set video_count = namespace(value=0) %}{%- macro render_content(content, do_vision_count, is_system_content=false) %} {%- if content is string %} {{- content }} {%- elif content is iterable and content is not mapping %} {%- for item in content %} {%- if 'image' in item or 'image_url' in item or item.type == 'image' %} {%- if is_system_content %} {{- raise_exception('System message cannot contain images.') }} {%- endif %} {%- if do_vision_count %} {%- set image_count.value = image_count.value + 1 %} {%- endif %} {%- if add_vision_id %} {{- 'Picture ' ~ image_count.value ~ ': ' }} {%- endif %} {{- '<|vision_start|><|image_pad|><|vision_end|>' }} {%- elif 'video' in item or item.type == 'video' %} {%- if is_system_content %} {{- raise_exception('System message cannot contain videos.') }} {%- endif %} {%- if do_vision_count %} {%- set video_count.value = video_count.value + 1 %} {%- endif %} {%- if add_vision_id %} {{- 'Video ' ~ video_count.value ~ ': ' }} {%- endif %} {{- '<|vision_start|><|video_pad|><|vision_end|>' }} {%- elif 'text' in item %} {{- item.text }} {%- else %} {{- raise_exception('Unexpected item type in content.') }} {%- endif %} {%- endfor %} {%- elif content is none or content is undefined %} {{- '' }} {%- else %} {{- raise_exception('Unexpected content type.') }} {%- endif %}{%- endmacro %}{%- if not messages %} {{- raise_exception('No messages provided.') }}{%- endif %}{%- if tools and tools is iterable and tools is not mapping %} {{- '<|im_start|>system\n' }} {{- "# Tools\n\nYou have access to the following functions:\n\n<tools>" }} {%- for tool in tools %} {{- "\n" }} {{- tool | tojson }} {%- endfor %} {{- "\n</tools>" }} {{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>\nvalue_1\n</parameter>\n<parameter=example_parameter_2>\nThis is the value for the second parameter\nthat can span\nmultiple lines\n</parameter>\n</function>\n</tool_call>\n\n<IMPORTANT>\nReminder:\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\n- Required parameters MUST be specified\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\n</IMPORTANT>' }} {%- if messages[0].role == 'system' %} {%- set content = render_content(messages[0].content, false, true)|trim %} {%- if content %} {{- '\n\n' + content }} {%- endif %} {%- endif %} {{- '<|im_end|>\n' }}{%- else %} {%- if messages[0].role == 'system' %} {%- set content = render_content(messages[0].content, false, true)|trim %} {{- '<|im_start|>system\n' + content + '<|im_end|>\n' }} {%- endif %}{%- endif %}{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}{%- for message in messages[::-1] %} {%- set index = (messages|length - 1) - loop.index0 %} {%- if ns.multi_step_tool and message.role == "user" %} {%- set content = render_content(message.content, false)|trim %} {%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %} {%- set ns.multi_step_tool = false %} {%- set ns.last_query_index = index %} {%- endif %} {%- endif %}{%- endfor %}{%- if ns.multi_step_tool %} {{- raise_exception('No user query found in messages.') }}{%- endif %}{%- for message in messages %} {%- set content = render_content(message.content, true)|trim %} {%- if message.role == "system" %} {%- if not loop.first %} {{- raise_exception('System message must be at the beginning.') }} {%- endif %} {%- elif message.role == "user" %} {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }} {%- elif message.role == "assistant" %} {%- set reasoning_content = '' %} {%- if message.reasoning_content is string %} {%- set reasoning_content = message.reasoning_content %} {%- else %} {%- if '</think>' in content %} {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %} {%- set content = content.split('</think>')[-1].lstrip('\n') %} {%- endif %} {%- endif %} {%- set reasoning_content = reasoning_content|trim %} {%- if loop.index0 > ns.last_query_index %} {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content + '\n</think>\n\n' + content }} {%- else %} {{- '<|im_start|>' + message.role + '\n' + content }} {%- endif %} {%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %} {%- for tool_call in message.tool_calls %} {%- if tool_call.function is defined %} {%- set tool_call = tool_call.function %} {%- endif %} {%- if loop.first %} {%- if content|trim %} {{- '\n\n<tool_call>\n<function=' + tool_call.name + '>\n' }} {%- else %} {{- '<tool_call>\n<function=' + tool_call.name + '>\n' }} {%- endif %} {%- else %} {{- '\n<tool_call>\n<function=' + tool_call.name + '>\n' }} {%- endif %} {%- if tool_call.arguments is defined %} {%- for args_name, args_value in tool_call.arguments|items %} {{- '<parameter=' + args_name + '>\n' }} {%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %} {{- args_value }} {{- '\n</parameter>\n' }} {%- endfor %} {%- endif %} {{- '</function>\n</tool_call>' }} {%- endfor %} {%- endif %} {{- '<|im_end|>\n' }} {%- elif message.role == "tool" %} {%- if loop.previtem and loop.previtem.role != "tool" %} {{- '<|im_start|>user' }} {%- endif %} {{- '\n<tool_response>\n' }} {{- content }} {{- '\n</tool_response>' }} {%- if not loop.last and loop.nextitem.role != "tool" %} {{- '<|im_end|>\n' }} {%- elif loop.last %} {{- '<|im_end|>\n' }} {%- endif %} {%- else %} {{- raise_exception('Unexpected message role.') }} {%- endif %}{%- endfor %}{%- if add_generation_prompt %} {{- '<|im_start|>assistant\n' }} {%- if enable_thinking is defined and enable_thinking is false %} {{- '<think>\n\n</think>\n\n' }} {%- else %} {{- '<think>\n' }} {%- endif %}{%- endif %}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195{ "image_token_id": 248056, "text_config": { "attention_bias": false, "attention_dropout": 0.0, "attn_output_gate": true, "dtype": "bfloat16", "eos_token_id": 248044, "full_attention_interval": 4, "head_dim": 256, "hidden_act": "silu", "hidden_size": 2560, "initializer_range": 0.02, "intermediate_size": 9216, "layer_types": [ "linear_attention", "linear_attention", "linear_attention", "full_attention", "linear_attention", "linear_attention", "linear_attention", "full_attention", "linear_attention", "linear_attention", "linear_attention", "full_attention", "linear_attention", "linear_attention", "linear_attention", "full_attention", "linear_attention", "linear_attention", "linear_attention", "full_attention", "linear_attention", "linear_attention", "linear_attention", "full_attention", "linear_attention", "linear_attention", "linear_attention", "full_attention", "linear_attention", "linear_attention", "linear_attention", "full_attention" ], "linear_conv_kernel_dim": 4, "linear_key_head_dim": 128, "linear_num_key_heads": 16, "linear_num_value_heads": 32, "linear_value_head_dim": 128, "max_position_embeddings": 262144, "mlp_only_layers": [], "model_type": "qwen3_5_text", "mtp_num_hidden_layers": 1, "mtp_use_dedicated_embeddings": false, "num_attention_heads": 16, "num_hidden_layers": 32, "num_key_value_heads": 4, "rms_norm_eps": 1e-06, "tie_word_embeddings": false, "use_cache": true, "vocab_size": 248320, "mamba_ssm_dtype": "float32", "rope_parameters": { "mrope_interleaved": true, "mrope_section": [ 11, 11, 10 ], "rope_type": "default", "rope_theta": 10000000, "partial_rotary_factor": 0.25 } }, "tie_word_embeddings": false, "video_token_id": 248057, "vision_config": { "deepstack_visual_indexes": [], "depth": 24, "hidden_act": "gelu_pytorch_tanh", "hidden_size": 1024, "in_channels": 3, "initializer_range": 0.02, "intermediate_size": 4096, "model_type": "qwen3_5", "num_heads": 16, "num_position_embeddings": 2304, "out_hidden_size": 2560, "patch_size": 16, "spatial_merge_size": 2, "temporal_patch_size": 2 }, "vision_end_token_id": 248054, "vision_start_token_id": 248053, "architectures": [ "MantaForDecision" ], "model_type": "manta", "auto_map": { "AutoConfig": "configuration_manta.MantaConfig", "AutoModel": "modeling_manta.MantaForDecision" }, "dtype": "bfloat16", "head": { "width": 1024, "routing_layers": 2, "layers": 4, "heads": 16, "feedforward": 4096 }, "manta": { "model_name": "MANTA-4B", "format_version": 1, "fine_tuned_from": { "repo_id": "Qwen/Qwen3.5-4B", "revision": "851bf6e806efd8d0a36b00ddf55e13ccb7b8cd0a" }, "max_length": 4096, "max_image_tokens": 1024, "image_unit": 32, "attention": "sdpa", "prompt": { "format": "Cloudflare Clef joint schema prompt (huggingface.co/Cloudflare/clef, revision 0b331204bb13fbd2ca93a64df1956f5b55478ce5) with keep_order for choice questions", "system_prompt": "Read the complete state and schema. Decide every field jointly. Each answer must be exactly one of that field's allowed options.", "question_types": { "noul": 0, "choice": 1, "score": 2 }, "max_questions": 64, "max_choice_options": 255, "option_order_default": "eval", "option_order_eval": "choice options shuffled with random.Random('shuffle:<request id>') (trainer --eval-shuffle)", "question_ids_in_evaluation": "task" }, "input_cast": "floating-point inputs of every decoder layer and vision block cast to the dtype of its parameters (BF16), as FSDP2 did in the published evaluation", "checkpoint": { "merged_from_sha256": "218969d1ff99be06bb66d7e9bdbdd6072a979efad8751675967b8582bead45db", "merge": "W + (B @ A) * lora_alpha / r in FP32, one cast to BF16", "lora_modules": 298, "left_out": [ "mtp.layers.0.mlp.down_proj.weight", "mtp.layers.0.mlp.gate_proj.weight", "mtp.layers.0.mlp.up_proj.weight", "mtp.layers.0.self_attn.q_proj.weight", "mtp.fc.weight", "mtp.layers.0.self_attn.o_proj.weight", "mtp.layers.0.self_attn.k_proj.weight", "mtp.layers.0.self_attn.v_proj.weight", "mtp.layers.0.input_layernorm.weight", "mtp.layers.0.post_attention_layernorm.weight", "mtp.norm.weight", "mtp.pre_fc_norm_embedding.weight", "mtp.pre_fc_norm_hidden.weight", "mtp.layers.0.self_attn.k_norm.weight", "mtp.layers.0.self_attn.q_norm.weight" ], "tied_copies": { "lm_head.weight": "model.language_model.embed_tokens.weight" }, "parameters": 5287287300, "bytes": 10574582280 }, "training_code_commit": "7cf2c6a36292081cb4e49a13d056a45e93160e87", "environment": { "python": "3.12", "packages": { "torch": "2.6.0+cu124", "torchvision": "0.21.0+cu124", "transformers": "5.19.0", "peft": "0.21.2", "accelerate": "1.15.0", "safetensors": "0.8.0", "huggingface-hub": "2.2.0", "tokenizers": "0.23.3", "pillow": "12.2.0", "numpy": "2.2.6", "flash-linear-attention": "0.4.2", "fla-core": "0.4.2", "triton": "3.2.0", "einops": "0.8.2" }, "kernels": { "gated_delta_rule": "flash-linear-attention (fla)", "causal_conv1d": "PyTorch fallback of transformers (causal-conv1d not installed)", "attention": "sdpa" } } }, "transformers_version": "5.19.0"}123456789101112131415161718192021222324252627"""The configuration of MANTA (Medical Answers, Natively from Text And images): the Qwen3.5-architecture backboneconfiguration of the base model plus the decision head and the MANTA prompt settings.
from transformers import AutoConfig config = AutoConfig.from_pretrained("<MANTA folder or repository>", trust_remote_code=True)"""
from __future__ import annotations
from transformers.models.qwen3_5.configuration_qwen3_5 import Qwen3_5Config
class MantaConfig(Qwen3_5Config): """Qwen3_5Config (text_config, vision_config, token ids) plus:
head: the sizes of the joint schema head (width, routing_layers, layers, heads, feedforward); manta: the MANTA settings that the request encoding needs (max_length, max_image_tokens, image_unit, prompt) and the provenance of the checkpoint. """
model_type = "manta"
head: dict | None = None manta: dict | None = None
__all__ = ["MantaConfig"]1234567891011121314151617181920212223242526272829303132333435363738394041424344"""Answer the example requests with MANTA-4B (one GPU with about 16 GB).
python example.py # examples/text_request.json and image_request.json python example.py --request my_request.json
Prints, per question, the option probabilities (most probable first) and the answer."""
from __future__ import annotations
import argparseimport jsonimport sysfrom pathlib import Path
HERE = Path(__file__).resolve().parentsys.path.insert(0, str(HERE))
def main(argv=None) -> int: ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) ap.add_argument("--request", nargs="*", type=Path, default=[HERE / "examples" / "text_request.json", HERE / "examples" / "image_request.json"]) ap.add_argument("--release", default=str(HERE), help="the release folder or its Hub repository id") ap.add_argument("--device", default="cuda") ap.add_argument("--option-order", default="eval", choices=("eval", "given", "sorted")) args = ap.parse_args(argv)
from manta import Manta
model = Manta.from_pretrained(args.release, device=args.device) for path in args.request: request = json.loads(path.read_text()) result = model.predict(request, option_order=args.option_order) print(f"\n{path.name} ({result['prompt_tokens']} prompt tokens)") for qid, answer in result["questions"].items(): ranked = sorted(answer["probabilities"].items(), key=lambda kv: -kv[1]) shown = ", ".join(f"{option} {p:.3f}" for option, p in ranked) print(f" {qid} ({answer['type']}): answer {answer['answer']} | {shown}") return 0
if __name__ == "__main__": sys.exit(main())12345678910111213141516171819202122232425262728293031323334353637383940414243{ "id": "example-image-001", "state": "Chest radiograph of an adult outpatient.", "images": [ "https://upload.wikimedia.org/wikipedia/commons/a/a1/Normal_posteroanterior_%28PA%29_chest_radiograph_%28X-ray%29.jpg" ], "questions": { "modality": { "type": "choice", "instructions": "What is the imaging modality?", "criteria": { "xray": "Radiograph (X-ray)", "ct": "Computed tomography", "mri": "Magnetic resonance imaging", "ultrasound": "Ultrasound" } }, "view": { "type": "choice", "instructions": "What is the projection of this chest radiograph?", "criteria": { "pa": "Posteroanterior", "ap": "Anteroposterior", "lateral": "Lateral" } }, "finding": { "type": "choice", "instructions": "Which finding does the radiograph show?", "criteria": { "no_finding": "No finding", "consolidation": "Consolidation", "pleural_effusion": "Pleural effusion", "pneumothorax": "Pneumothorax", "cardiomegaly": "Cardiomegaly" } }, "abnormal": { "type": "noul", "instructions": "Is the radiograph abnormal?" } }}123456789101112131415161718192021222324252627282930{ "id": "example-text-001", "state": "Emergency department note. 67-year-old man with 3 days of fever (38.9 C), productive cough and right-sided pleuritic chest pain. Respiratory rate 26/min, SpO2 89 % on room air, blood pressure 118/72 mmHg. Crackles over the right lower zone. Chest radiograph: right lower lobe consolidation. WBC 15.2 x10^9/L, CRP 180 mg/L, urea 8.1 mmol/L. No leg swelling. History of hypertension.", "questions": { "diagnosis": { "type": "choice", "instructions": "What is the most likely diagnosis?", "criteria": { "community_acquired_pneumonia": "Community-acquired pneumonia", "pulmonary_embolism": "Pulmonary embolism", "acute_heart_failure": "Acute decompensated heart failure", "copd_exacerbation": "Acute exacerbation of COPD" } }, "hypoxemia": { "type": "noul", "instructions": "Does the patient have hypoxemia?" }, "severity": { "type": "score", "instructions": "How severe is the illness at presentation?", "criteria": [ "mild: outpatient care", "moderate: ward admission", "severe: high-dependency care", "critical: intensive care" ] } }}1234567891011121314151617181920212223242526272829"""MANTA: a medical decision model. One forward pass gives a probability for every option of every question of arequest (text and images); no text is generated. See README.md.
from manta import Manta model = Manta.from_pretrained(".") # the release folder (config.json + weights) result = model.predict(request) # request: the MANTA JSON format (manta.request)"""
import torch
if not torch.cuda.is_available(): # torch 2.6 raises "Cannot access accelerator device when none is available" in # torch.accelerator.current_accelerator() when no GPU is visible; torch >= 2.7 returns None. transformers 5.x # calls the function at import, so CPU nodes and CUDA_VISIBLE_DEVICES="" processes could not import it. _current_accelerator = torch.accelerator.current_accelerator
def _current_accelerator_or_none(*args, **kwargs): try: return _current_accelerator(*args, **kwargs) except RuntimeError: return None
torch.accelerator.current_accelerator = _current_accelerator_or_none
from manta.model import Manta # noqa: E402from manta.request import RequestError, validate_request # noqa: E402
__all__ = ["Manta", "RequestError", "validate_request"]__version__ = "1.0.0"123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191"""The joint schema head and the decision model (backbone + LoRA + head) of MANTA.
Copied from the training code, commit 7cf2c6a (model/head.py; only module names in docstrings shortened): CLEF_HEAD, SCALARS,_scalars_as_vectors, EvidenceRoutingLayer, JointSchemaHead and build_head. DecisionModel keeps the forward pass of theevaluation (no gradients; images through the vision tower, a text-only request skips it); the training-only`dummy_vision` argument and the profiler regions are left out.
The training code ported the head from Cloudflare Clef, joint_schema_model.py (Apache-2.0; huggingface.co/Cloudflare/clef,revision 0b331204bb13fbd2ca93a64df1956f5b55478ce5); the module and parameter names are Clef's.
Per question i and option o: logit = s_p * cos(lexical_o, q_i + g) + sigmoid(gate) *(s_j * cos(field_i, option_o) + MLP[field, option, field * option, |field - option|])."""
from __future__ import annotations
import mathfrom typing import Any
import torchimport torch.nn.functional as F
from manta.prompt import EncodedRecord
# Clef's joint_head_config.json without hidden_size (Clef and Clef-flash use the same values).CLEF_HEAD = {"width": 1024, "routing_layers": 2, "layers": 4, "heads": 16, "feedforward": 4096}
SCALARS = ("prior_logit_scale", "joint_logit_scale", "residual_gate")
def _scalars_as_vectors(module, state_dict, prefix, *args) -> None: for name in SCALARS: value = state_dict.get(prefix + name) if value is not None and value.ndim == 0: state_dict[prefix + name] = value.reshape(1)
class EvidenceRoutingLayer(torch.nn.Module): """Pre-LN cross-attention from the option queries to the token memory, then a feed-forward block."""
def __init__(self, width: int, heads: int, feedforward: int, dropout: float = 0.0) -> None: super().__init__() self.query_norm = torch.nn.LayerNorm(width) self.memory_norm = torch.nn.LayerNorm(width) self.attention = torch.nn.MultiheadAttention(width, heads, dropout=dropout, batch_first=True) self.attention_dropout = torch.nn.Dropout(dropout) self.feedforward_norm = torch.nn.LayerNorm(width) self.feedforward = torch.nn.Sequential( torch.nn.Linear(width, feedforward), torch.nn.GELU(), torch.nn.Dropout(dropout), torch.nn.Linear(feedforward, width), torch.nn.Dropout(dropout))
def forward(self, queries: torch.Tensor, memory: torch.Tensor) -> torch.Tensor: normalized_queries = self.query_norm(queries) routed, _ = self.attention(normalized_queries, self.memory_norm(memory), self.memory_norm(memory), need_weights=False) queries = queries + self.attention_dropout(routed) return queries + self.feedforward(self.feedforward_norm(queries))
class JointSchemaHead(torch.nn.Module): """One logit per allowed option for every question of a record, read from the backbone's final hidden states."""
def __init__(self, hidden_size: int, width: int, routing_layers: int, layers: int, heads: int, feedforward: int, dropout: float = 0.0) -> None: super().__init__() self.hidden_norm = torch.nn.LayerNorm(hidden_size) self.memory_projection = torch.nn.Linear(hidden_size, width, bias=False) self.question_projection = torch.nn.Linear(hidden_size, width, bias=False) self.option_question_projection = torch.nn.Linear(hidden_size, width, bias=False) self.global_projection = torch.nn.Linear(hidden_size, width, bias=False) self.option_context_projection = torch.nn.Linear(hidden_size, width, bias=False) self.option_lexical_projection = torch.nn.Linear(hidden_size, width, bias=False) self.type_embedding = torch.nn.Embedding(3, width) self.evidence_layers = torch.nn.ModuleList( [EvidenceRoutingLayer(width=width, heads=heads, feedforward=feedforward, dropout=dropout) for _ in range(routing_layers)]) self.option_summary_norm = torch.nn.LayerNorm(width) self.layers = torch.nn.ModuleList( [torch.nn.TransformerDecoderLayer(d_model=width, nhead=heads, dim_feedforward=feedforward, dropout=dropout, activation="gelu", batch_first=True, norm_first=True) for _ in range(layers)]) self.field_norm = torch.nn.LayerNorm(width) self.option_norm = torch.nn.LayerNorm(width) self.residual_scorer = torch.nn.Sequential( torch.nn.Linear(width * 4, width), torch.nn.GELU(), torch.nn.Dropout(dropout), torch.nn.Linear(width, 1)) # 1-element vectors, not 0-dim as in Clef: FSDP2 cannot shard 0-dim parameters. The load hook reshapes # Clef's 0-dim tensors, so joint_head.safetensors still loads with strict=True. self.prior_logit_scale = torch.nn.Parameter(torch.zeros(1)) self.joint_logit_scale = torch.nn.Parameter(torch.zeros(1)) self.residual_gate = torch.nn.Parameter(torch.zeros(1)) self.register_load_state_dict_pre_hook(_scalars_as_vectors)
@staticmethod def _mean_span(values: torch.Tensor, span: tuple[int, int]) -> torch.Tensor: start, end = span return values[start:end].mean(dim=0)
def forward(self, hidden_states: torch.Tensor, input_ids: torch.Tensor, attention_mask: torch.Tensor, records: list[EncodedRecord], output_embedding_weight: torch.Tensor) -> list[list[torch.Tensor]]: results: list[list[torch.Tensor]] = [] normalized_hidden = self.hidden_norm(hidden_states) for batch_index, record in enumerate(records): sequence_length = int(attention_mask[batch_index].sum().item()) sequence_hidden = normalized_hidden[batch_index, :sequence_length] memory = self.memory_projection(sequence_hidden).unsqueeze(0) global_vector = sequence_hidden[-1] question_vectors = torch.stack([self._mean_span(sequence_hidden, q.question_span) for q in record.questions]) type_ids = torch.tensor([q.question_type for q in record.questions], device=hidden_states.device) option_contexts, lexical_options, option_counts = [], [], [] for question in record.questions: option_contexts.append(torch.stack([self._mean_span(sequence_hidden, s) for s in question.option_spans])) lexical_options.append(torch.stack([ output_embedding_weight[input_ids[batch_index, start:end]].to(sequence_hidden.dtype).mean(dim=0) for start, end in question.option_spans])) option_counts.append(len(question.option_spans))
option_queries = [ self.option_context_projection(context) + self.option_lexical_projection(lexical) + self.option_question_projection(question_vectors[index]).unsqueeze(0) for index, (context, lexical) in enumerate(zip(option_contexts, lexical_options))] routed_options = torch.cat(option_queries, dim=0).unsqueeze(0) for layer in self.evidence_layers: routed_options = layer(routed_options, memory) split_options = list(torch.split(routed_options[0], option_counts, dim=0))
base_fields = self.question_projection(question_vectors) option_summaries = [] for field, options in zip(base_fields, split_options): routing_weights = torch.softmax(torch.matmul(options, field) / math.sqrt(options.shape[-1]), dim=0) option_summaries.append(torch.sum(routing_weights.unsqueeze(-1) * options, dim=0)) fields = (base_fields + self.option_summary_norm(torch.stack(option_summaries)) + self.global_projection(global_vector).unsqueeze(0) + self.type_embedding(type_ids)) fields = fields.unsqueeze(0) for layer in self.layers: fields = layer(fields, memory) fields = self.field_norm(fields[0])
record_logits: list[torch.Tensor] = [] for field, lexical, routed in zip(fields, lexical_options, split_options): anchor = F.normalize(question_vectors[len(record_logits)] + global_vector, dim=-1) prior_scale = self.prior_logit_scale.clamp(max=math.log(100.0)).exp() prior = prior_scale * torch.matmul(F.normalize(lexical, dim=-1), anchor) options = self.option_norm(routed) repeated_field = field.unsqueeze(0).expand_as(options) cosine = F.cosine_similarity(repeated_field, options, dim=-1) features = torch.cat([repeated_field, options, repeated_field * options, torch.abs(repeated_field - options)], dim=-1) residual = self.residual_scorer(features).squeeze(-1) joint_scale = self.joint_logit_scale.clamp(max=math.log(100.0)).exp() record_logits.append(prior + torch.sigmoid(self.residual_gate) * (joint_scale * cosine + residual)) results.append(record_logits) return results
def build_head(hidden_size: int, **overrides) -> JointSchemaHead: """A random-weight head with Clef's sizes (FP32). `overrides` change sizes, for example in tests.""" return JointSchemaHead(hidden_size=hidden_size, **{**CLEF_HEAD, **overrides})
def unwrap(model: torch.nn.Module) -> torch.nn.Module: """The Hugging Face model inside a PEFT wrapper (backbone.model.unwrap).""" get_base = getattr(model, "get_base_model", None) return get_base() if callable(get_base) else model
class DecisionModel(torch.nn.Module): """Backbone (with LoRA) + joint schema head. The parameter names are those of the training code, so that the release weights load with strict name and shape checks.
forward(batch from manta.prompt.collate_records) returns, per request and per question, one logit per option in the order of EncodedQuestion.option_ids. A softmax over the logits of one question gives its answer distribution. """
def __init__(self, backbone: torch.nn.Module, head: JointSchemaHead) -> None: super().__init__() self.backbone = backbone self.head = head
def forward(self, batch: dict[str, Any]) -> list[list[torch.Tensor]]: base = unwrap(self.backbone) media = {k: v.to(base.dtype) if k.startswith("pixel_values") else v for k, v in (batch.get("media") or {}).items()} text_model = base.model if not media and hasattr(text_model, "language_model"): text_model = text_model.language_model # text only: skip the vision tower with torch.no_grad(): hidden = text_model(input_ids=batch["input_ids"], attention_mask=batch["attention_mask"], use_cache=False, return_dict=True, **media).last_hidden_state return self.head(hidden.to(self.head.hidden_norm.weight.dtype), batch["input_ids"], batch["attention_mask"], batch["records"], base.get_output_embeddings().weight)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051"""Image input of MANTA: open an image and scale it down to at most `max_tokens` image tokens.
`open_image` is copied without change from the training code, commit 7cf2c6a (train/views.py); thetraining and the evaluation opened every image with it (max_tokens 1,024, unit 32). `load_image` reads the imagebytes of a request entry (a file path, an http(s) URL, a data URI or raw bytes)."""
from __future__ import annotations
import base64import ioimport mathimport urllib.requestfrom pathlib import Path
from PIL import Image
def open_image(data: bytes, max_tokens: int, unit: int) -> Image.Image: """An RGB image from its file bytes, scaled down to at most `max_tokens` image tokens of `unit` x `unit` pixels (32 for Qwen3.5: 16-pixel patches, 2 x 2 merge). The new sides are multiples of `unit`, so the processor keeps them. A smaller image keeps its size; the processor scales it up to its minimum (256 x 256 pixels for Qwen3.5).""" img = Image.open(io.BytesIO(data)).convert("RGB") w, h = img.size if w * h <= max_tokens * unit * unit: return img scale = math.sqrt(max_tokens * unit * unit / (w * h)) size = (max(unit, int(w * scale) // unit * unit), max(unit, int(h * scale) // unit * unit)) return img.resize(size, Image.Resampling.BICUBIC)
def image_bytes(entry) -> bytes: """The file bytes of one image entry of a request: bytes, a data URI (data:image/...;base64,...), an http(s) URL or a local file path.""" if isinstance(entry, (bytes, bytearray)): return bytes(entry) if not isinstance(entry, str): raise TypeError(f"an image entry is a file path, a URL, a data URI or bytes, not {type(entry).__name__}") if entry.startswith("data:"): return base64.b64decode(entry.split(",", 1)[1]) if entry.startswith(("http://", "https://")): # an explicit User-Agent: some hosts (e.g. Wikimedia) refuse urllib's default one with HTTP 403 req = urllib.request.Request(entry, headers={"User-Agent": "MANTA/1.0 (https://huggingface.co/gevaertlab/MANTA-4B)"}) with urllib.request.urlopen(req, timeout=60) as response: # noqa: S310 (the user gives the URL) return response.read() return Path(entry).expanduser().read_bytes()
def load_image(entry, max_tokens: int, unit: int) -> Image.Image: """One image entry of a request, opened as the evaluation opened it (open_image).""" return open_image(image_bytes(entry), max_tokens, unit)1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253"""LoRA on the language model of the Qwen3.5-4B backbone and on its vision tower.
Copied from the training code, commit 7cf2c6a (backbone/lora.py), with the sizes in the comments setto Qwen3.5-4B: LM_TARGETS, VISION_TARGETS and apply_lora. MANTA-4B: rank 128 and alpha 128 on both (merged into theweights of this checkpoint)."""
from __future__ import annotations
import torchfrom peft import LoraConfig, PeftModel, get_peft_model
# All large projections of the 32 decoder layers.# in_proj_a / in_proj_b (hidden -> 32 decay and beta gates) are left out: they are tiny gate projections.LM_TARGETS = ( r"model\.language_model\.layers\.\d+\." r"(self_attn\.(q_proj|k_proj|v_proj|o_proj)" r"|linear_attn\.(in_proj_qkv|in_proj_z|out_proj)" r"|mlp\.(gate_proj|up_proj|down_proj))")# The vision tower (24 blocks of width 1,024): attention and MLP of every block, and the patch merger that projects# into the language model. The patch embedding (a Conv3d) stays frozen.VISION_TARGETS = ( r"model\.visual\." r"(blocks\.\d+\.(attn\.(qkv|proj)|mlp\.(linear_fc1|linear_fc2))" r"|merger\.(linear_fc1|linear_fc2))")
def apply_lora( model: torch.nn.Module, rank: int = 16, alpha: int | None = None, dropout: float = 0.0, targets: str = LM_TARGETS, vision: bool = False, vision_rank: int | None = None, vision_alpha: int | None = None,) -> PeftModel: """Freeze the backbone and add LoRA adapters (A, B) to the target layers. B starts at zero. alpha None = rank.
vision=True also adds adapters to the vision tower (VISION_TARGETS), with rank vision_rank (None = rank) and alpha vision_alpha (None = the vision rank). PEFT's rank_pattern and alpha_pattern set them: PEFT 0.21 matches a pattern key as a regex to the module name (model.visual.blocks.0.attn.qkv, ...) or to the end of it after a dot. """ patterns = {} if vision: targets = f"(?:{targets})|(?:{VISION_TARGETS})" v_rank = vision_rank or rank patterns = {"rank_pattern": {VISION_TARGETS: v_rank}, "alpha_pattern": {VISION_TARGETS: vision_alpha or v_rank}} config = LoraConfig(r=rank, lora_alpha=alpha or rank, lora_dropout=dropout, target_modules=targets, bias="none", **patterns) return get_peft_model(model, config)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244"""Load MANTA and answer requests.
from manta import Manta model = Manta.from_pretrained("gevaertlab/MANTA-4B") # or a local folder of the repository result = model.predict(request) # manta.request: the request format
The standalone model loads with transformers (remote code of the repository: configuration_manta.py,modeling_manta.py):
AutoModel.from_pretrained(path, trust_remote_code=True, dtype=torch.bfloat16, attn_implementation="sdpa")
and the processor of the base model (tokenizer, image processor), copied into the repository. Manta adds the requestencoding of the published evaluation (manta.request, manta.prompt) and the softmax per question.
Manta.from_pretrained also loads the earlier adapter release (a folder whose config.json has "lora": the base modelfrom the Hub at the pinned revision + LoRA + head; needs peft), to compare the two on the same inputs.
Kernels of the published evaluation (requirements.txt): flash-linear-attention 0.4.2 for the Gated DeltaNet layers,the PyTorch causal conv1d of transformers (causal-conv1d not installed), SDPA attention."""
from __future__ import annotations
import importlib.metadataimport importlib.utilimport jsonimport warningsfrom pathlib import Pathfrom typing import Any
import torch
from manta.images import load_imagefrom manta.prompt import collate_records, encode_recordfrom manta.request import prompt_request
CONFIG = "config.json"DTYPE = torch.bfloat16
def _is_local(path: str) -> bool: return Path(path).expanduser().is_dir()
def read_config(path: str | Path) -> dict: """config.json of a local folder or of a Hub repository.""" if _is_local(str(path)): return json.loads((Path(path).expanduser() / CONFIG).read_text()) from huggingface_hub import hf_hub_download
return json.loads(Path(hf_hub_download(str(path), CONFIG)).read_text())
def environment_report(environment: dict) -> list[str]: """Differences between the installed packages and the environment of the published evaluation.""" notes = [] for name, wanted in (environment or {}).get("packages", {}).items(): try: have = importlib.metadata.version(name) except importlib.metadata.PackageNotFoundError: have = None if have is None or have.split("+")[0] != wanted.split("+")[0]: notes.append(f"{name} {have or 'not installed'} (evaluation: {wanted})") if importlib.util.find_spec("causal_conv1d") is not None: notes.append("causal_conv1d is installed: transformers then uses its conv1d kernel (evaluation: the PyTorch " "fallback)") return notes
def encode_request(processor: Any, request: dict[str, Any], max_length: int, max_image_tokens: int, unit: int): """encode_record of a request in prompt form, with the processor of the base model. Image entries that are not opened images yet (paths, URLs, data URIs, bytes) are opened with manta.images.load_image (the evaluation rule: at most max_image_tokens tokens of unit x unit pixels); a request without images gets no processor, as in the evaluation.""" images = [im if hasattr(im, "size") else load_image(im, max_image_tokens, unit) for im in request.get("images") or []] record = {**request, "images": images} return encode_record(processor.tokenizer, record, max_length=max_length, processor=processor if images else None)
class Manta: """A loaded MANTA model with its processor and settings (standalone or adapter release)."""
def __init__(self, model: torch.nn.Module, processor: Any, settings: dict, standalone: bool) -> None: self.model = model self.processor = processor self.settings = settings self.standalone = standalone self.max_length = int(settings["max_length"]) self.max_image_tokens = int(settings["max_image_tokens"]) ip = processor.image_processor self.unit = ip.patch_size * ip.merge_size # pixels per side of one image token (32) if self.unit != int(settings["image_unit"]): raise ValueError(f"the processor gives {self.unit} pixels per image token, the config " f"{settings['image_unit']}: another processor?")
@classmethod def from_pretrained(cls, path: str | Path = ".", device: str = "cuda", device_map: str | dict | None = None, base_model: str | None = None) -> Manta: """Load MANTA from a local folder or a Hub repository.
device: one GPU for the whole model (the BF16 weights take about 10.6 GB); device_map: a transformers device map instead ("auto" spreads the model over the visible GPUs). base_model: only for the adapter release (a local copy of the base model at the pinned revision).""" config = read_config(path) if device_map is None: dev = torch.device(device) device_map = {"": dev.index or 0} if dev.type == "cuda" else str(dev) if config.get("model_type") == "manta": return cls._standalone(str(path), config, device_map) if "lora" in config: return cls._adapter(path, config, device_map, base_model) raise ValueError(f"{path}: config.json is neither the MANTA model (model_type manta) nor the adapter release")
@classmethod def _standalone(cls, path: str, config: dict, device_map) -> Manta: from transformers import AutoModel, AutoProcessor
settings = config["manta"] for note in environment_report(settings.get("environment")): warnings.warn(f"MANTA: {note}; the probabilities can differ slightly from the published evaluation", stacklevel=3) # trust_remote_code: the folder's config.json has an auto_map (the model code); the processor itself is the # standard Qwen3VLProcessor of the base model (preprocessor_config.json), no remote code. processor = AutoProcessor.from_pretrained(path, trust_remote_code=True) model = AutoModel.from_pretrained(path, trust_remote_code=True, dtype=DTYPE, device_map=device_map, attn_implementation=settings.get("attention", "sdpa")) model.requires_grad_(False) model.eval() return cls(model, processor, settings, standalone=True)
@classmethod def _adapter(cls, path, config: dict, device_map, base_model: str | None) -> Manta: """The adapter release (MANTA-4B adapter folder): base model + LoRA + head, as in its manta.model.""" from safetensors.torch import load_file from transformers import AutoModelForImageTextToText, AutoProcessor
from manta.head import DecisionModel, build_head, unwrap from manta.lora import LM_TARGETS, apply_lora
folder = Path(path).expanduser() base = config["base_model"] source = base_model or base["repo_id"] revision = None if _is_local(source) else base["revision"] processor = AutoProcessor.from_pretrained(source, revision=revision) hf = AutoModelForImageTextToText.from_pretrained(source, revision=revision, dtype=DTYPE, device_map=device_map, attn_implementation=base["attention"]) hf.config.use_cache = False lo = config["lora"] backbone = apply_lora(hf, rank=lo["rank"], alpha=lo["alpha"], dropout=lo["dropout"], targets=LM_TARGETS, vision=lo["vision"], vision_rank=lo["vision_rank"], vision_alpha=lo["vision_alpha"]) h = config["head"] head = build_head(hf.config.text_config.hidden_size, **{k: h[k] for k in ("width", "routing_layers", "layers", "heads", "feedforward")}) model = DecisionModel(backbone, head) model.head.to(unwrap(model.backbone).get_output_embeddings().weight.device) state = load_file(str(folder / config["weights"]["file"])) own = {n: p for n, p in model.named_parameters() if p.requires_grad} if set(own) != set(state) or any(tuple(state[n].shape) != tuple(p.shape) for n, p in own.items()): raise ValueError("the adapter weights do not fit the model built from its config.json") with torch.no_grad(): for n, p in own.items(): p.data = state[n].to(device=p.device, dtype=DTYPE) del state _register_adapter_casts(model) model.requires_grad_(False) model.eval() settings = {k: config[k] for k in ("max_length", "max_image_tokens", "image_unit")} return cls(model, processor, settings, standalone=False)
@property def device(self) -> torch.device: if self.standalone: return self.model.get_output_embeddings().weight.device from manta.head import unwrap
return unwrap(self.model.backbone).get_output_embeddings().weight.device
def encode(self, request: dict[str, Any]): """The encoded prompt (manta.prompt.EncodedRecord) of a request in prompt form (manta.request.prompt_request or manta.records), with its images opened as in the evaluation.""" return encode_request(self.processor, request, self.max_length, self.max_image_tokens, self.unit)
@torch.no_grad() def logits(self, encoded: list) -> list[list[torch.Tensor]]: """Per encoded record and question: the head's logits in the encoded option order (float32, on the CPU).""" batch = collate_records(encoded, self.processor.tokenizer.pad_token_id, self.device) if self.standalone: out = self.model(input_ids=batch["input_ids"], attention_mask=batch["attention_mask"], records=batch["records"], **batch["media"]) else: out = self.model(batch) return [[z.detach().float().cpu() for z in rec] for rec in out]
def predict(self, requests: dict | list[dict], option_order: str = "eval", batch_size: int = 1) -> dict | list[dict]: """Answer one request (a dict) or a list of requests in the MANTA format (manta.request).
Per question: "type", "options" (the option ids in prompt order), "probabilities" (option id -> probability, a softmax over the question's options), "answer" (the most probable option id). Per request: "id", "prompt_tokens", and "truncated" (the prompt reached max_length: the end of the state was cut).""" single = isinstance(requests, dict) items = [requests] if single else list(requests) results = [] for start in range(0, len(items), max(1, batch_size)): chunk = items[start:start + max(1, batch_size)] prompts = [prompt_request(r, option_order) for r in chunk] encoded = [self.encode({**p, "images": r.get("images") or []}) for p, r in zip(prompts, chunk)] for p, enc, rec_logits in zip(prompts, encoded, self.logits(encoded)): answers = {} for q, z in zip(enc.questions, rec_logits, strict=True): probs = z.softmax(-1).tolist() answers[q.question_id] = { "type": p["questions"][q.question_id]["type"], "options": list(q.option_ids), "probabilities": dict(zip(q.option_ids, probs)), "answer": q.option_ids[max(range(len(probs)), key=probs.__getitem__)]} results.append({"id": p["id"], "questions": answers, "prompt_tokens": len(enc.input_ids), "truncated": len(enc.input_ids) >= self.max_length}) return results[0] if single else results
def _register_adapter_casts(model: torch.nn.Module) -> int: """The BF16 input cast of the evaluation (FSDP2) on the decoder layers and vision blocks of the adapter model (the same rule as modeling_manta.register_input_casts).""" import functools
from torch.utils._pytree import tree_map
def cast(dtype, x): if not isinstance(x, torch.Tensor) or not torch.is_floating_point(x) or x.dtype == dtype: return x return x.to(dtype)
def hook(module, args, kwargs): dtype = next((p.dtype for p in module.parameters() if p.is_floating_point()), None) if dtype is None: return args, kwargs f = functools.partial(cast, dtype) return tree_map(f, args), tree_map(f, kwargs)
blocks = [m for m in model.modules() if type(m).__name__ in ("Qwen3_5DecoderLayer", "Qwen3_5VisionBlock")] for m in blocks: m.register_forward_pre_hook(hook, with_kwargs=True) return len(blocks)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198r"""Encode a MANTA request as one prompt with token spans, and collate encoded requests into a batch.
Copied from the training code, commit 7cf2c6a (model/prompt.py), with one comment and one errormessage shortened: the constants,`render`, `question_options`, `EncodedQuestion`, `EncodedRecord`, `_tokens`, `_encode_media`, `encode_record` and`collate_records`. The training-only functions of that file (request_from_record, target_vectors, without_pixels,with_pixels, vision_dummy) are not here; manta.records holds the part of request_from_record that the evaluation used.
The training code ported this prompt from Cloudflare Clef, joint_schema_model.py (Apache-2.0; huggingface.co/Cloudflare/clef,revision 0b331204bb13fbd2ca93a64df1956f5b55478ce5). One change against Clef: a choice question with`"keep_order": true` keeps the option order of its criteria instead of Clef's sort by id.
The prompt of a request with one choice question. Each piece is tokenized alone, so that the instruction span andeach option span (in [ ] here) start and end at token boundaries:
<|im_start|>system\n{SYSTEM_PROMPT}<|im_end|>\n<|im_start|>user\nSTATE:\n{images}{state}\n\nSCHEMA FIELDS:\n \nFIELD 1\nID: status\nTYPE: choice\nINSTRUCTION: [What is the invoice status?]\nALLOWED OPTIONS:\n OPTION 1: [{"description":"Not sent.","option_id":"draft"}]\n OPTION 2: [{"description":"Invoice is past due.","option_id":"overdue"}]\nEND FIELD\n \n<|im_end|>\n<|im_start|>assistant\n<think>\n\n</think>\n\nJOINT SCHEMA DECISIONS:"""
from __future__ import annotations
import jsonfrom dataclasses import dataclassfrom dataclasses import field as dataclass_fieldfrom typing import Any
import torch
SYSTEM_PROMPT = ("Read the complete state and schema. Decide every field jointly. Each answer " "must be exactly one of that field's allowed options.")PROMPT_PREFIX = f"<|im_start|>system\n{SYSTEM_PROMPT}<|im_end|>\n<|im_start|>user\nSTATE:\n"PROMPT_SUFFIX = "\n<|im_end|>\n<|im_start|>assistant\n<think>\n\n</think>\n\nJOINT SCHEMA DECISIONS:"IMAGE_PLACEHOLDER = "<|vision_start|><|image_pad|><|vision_end|>"VIDEO_PLACEHOLDER = "<|vision_start|><|video_pad|><|vision_end|>"MEDIA_BATCH_KEYS = ("pixel_values", "image_grid_thw", "pixel_values_videos", "video_grid_thw")MEDIA_TOKEN_KEYS = ("mm_token_type_ids",)QUESTION_TYPES = {"noul": 0, "choice": 1, "score": 2}MAX_QUESTIONS = 64 # questions per requestMAX_LENGTH = 16384
def render(value: Any) -> str: """A string as is; any other value as compact JSON with sorted keys.""" if isinstance(value, str): return value return json.dumps(value, ensure_ascii=False, separators=(",", ":"), sort_keys=True)
def question_options(question: dict[str, Any]) -> list[tuple[str, Any]]: """(option id, description) in prompt order: noul true, false; choice sorted by id (in the order of the criteria if the question has "keep_order": true); score lowest level first.""" question_type = str(question["type"]) if question_type == "noul": criteria = {"true": "The proposition is true or the answer is yes.", "false": "The proposition is false or the answer is no."} criteria.update(question.get("criteria") or {}) return [(key, criteria[key]) for key in ("true", "false")] if question_type == "choice": options = [(str(key), value) for key, value in question["criteria"].items()] return options if question.get("keep_order") else sorted(options) return [(str(index), value) for index, value in enumerate(question["criteria"])]
@dataclass(frozen=True)class EncodedQuestion: question_id: str question_type: int question_span: tuple[int, int] option_spans: tuple[tuple[int, int], ...] option_ids: tuple[str, ...]
@dataclass(frozen=True)class EncodedRecord: input_ids: tuple[int, ...] questions: tuple[EncodedQuestion, ...] record_id: str media: dict[str, Any] | None = dataclass_field(default=None, compare=False, repr=False)
def _tokens(tokenizer: Any, text: str) -> list[int]: return tokenizer(text, add_special_tokens=False).input_ids
def _encode_media(processor: Any, record: dict[str, Any]) -> tuple[list[int], dict[str, Any] | None]: images = list(record.get("images") or []) videos = list(record.get("videos") or []) if not images and not videos: return [], None if processor is None: raise ValueError("records with images or videos require a processor") text = IMAGE_PLACEHOLDER * len(images) + VIDEO_PLACEHOLDER * len(videos) + "\n" encoded = processor(text=[text], images=images or None, videos=videos or None, return_tensors="pt", **(record.get("media_kwargs") or {})) media = {key: encoded[key] for key in MEDIA_BATCH_KEYS if key in encoded} for key in MEDIA_TOKEN_KEYS: if key in encoded: media[key] = encoded[key][0].tolist() return encoded["input_ids"][0].tolist(), media
def encode_record(tokenizer: Any, record: dict[str, Any], max_length: int = MAX_LENGTH, max_state_tokens: int | None = None, processor: Any | None = None) -> EncodedRecord: """Tokenize one request (state, questions, optional images and videos) into Clef's prompt with spans.
A state that is too long is cut from the end. The schema is never cut: a schema that does not fit into `max_length` raises ValueError. """ schema_ids = _tokens(tokenizer, "\n\nSCHEMA FIELDS:\n") questions: list[EncodedQuestion] = [] for question_index, (question_id, question) in enumerate(record["questions"].items()): schema_ids.extend(_tokens( tokenizer, f"\nFIELD {question_index + 1}\nID: {question_id}\nTYPE: {question['type']}\nINSTRUCTION: ")) question_start = len(schema_ids) instructions = question.get("instructions") if instructions is None or instructions == "": instructions = str(question_id) schema_ids.extend(_tokens(tokenizer, render(instructions))) question_end = len(schema_ids) schema_ids.extend(_tokens(tokenizer, "\nALLOWED OPTIONS:\n")) option_spans: list[tuple[int, int]] = [] option_ids: list[str] = [] for option_index, (option_id, description) in enumerate(question_options(question)): schema_ids.extend(_tokens(tokenizer, f"OPTION {option_index + 1}: ")) option_start = len(schema_ids) semantics = {"option_id": option_id} if description is not None: semantics["description"] = description schema_ids.extend(_tokens(tokenizer, render(semantics))) option_spans.append((option_start, len(schema_ids))) option_ids.append(option_id) schema_ids.extend(_tokens(tokenizer, "\n")) schema_ids.extend(_tokens(tokenizer, "END FIELD\n")) questions.append(EncodedQuestion( question_id=str(question_id), question_type=QUESTION_TYPES[str(question["type"])], question_span=(question_start, question_end), option_spans=tuple(option_spans), option_ids=tuple(option_ids)))
prefix_ids = _tokens(tokenizer, PROMPT_PREFIX) suffix_ids = _tokens(tokenizer, PROMPT_SUFFIX) media_ids, media = _encode_media(processor, record) if media is not None: media["token_offset"] = len(prefix_ids) prefix_ids = prefix_ids + media_ids state_ids = _tokens(tokenizer, render(record["state"])) if max_state_tokens is not None: state_ids = state_ids[:max_state_tokens] fixed_length = len(prefix_ids) + len(schema_ids) + len(suffix_ids) if fixed_length > max_length: raise ValueError(f"schema requires {fixed_length} tokens before state; maximum is {max_length}") state_ids = state_ids[: max_length - fixed_length] offset = len(prefix_ids) + len(state_ids) shifted = tuple( EncodedQuestion( question_id=q.question_id, question_type=q.question_type, question_span=(q.question_span[0] + offset, q.question_span[1] + offset), option_spans=tuple((start + offset, end + offset) for start, end in q.option_spans), option_ids=q.option_ids) for q in questions) input_ids = tuple(prefix_ids + state_ids + schema_ids + suffix_ids) if not input_ids or not shifted: raise ValueError("record produced no model input or questions") return EncodedRecord(input_ids=input_ids, questions=shifted, record_id=str(record.get("id", "unknown")), media=media)
def collate_records(records: list[EncodedRecord], pad_token_id: int, device: torch.device) -> dict[str, Any]: """Right-padded input_ids and attention_mask, the encoded records, and the media tensors of all records.""" for record in records: if record.media and not any(key in record.media for key in MEDIA_BATCH_KEYS): raise ValueError(f"{record.record_id} has image tokens but no pixel tensors") maximum_length = max(len(record.input_ids) for record in records) input_ids = torch.full((len(records), maximum_length), pad_token_id, dtype=torch.long, device=device) attention_mask = torch.zeros((len(records), maximum_length), dtype=torch.long, device=device) for index, record in enumerate(records): length = len(record.input_ids) input_ids[index, :length] = torch.tensor(record.input_ids, device=device) attention_mask[index, :length] = 1 media: dict[str, torch.Tensor] = {} for key in MEDIA_BATCH_KEYS: values = [record.media[key] for record in records if record.media and key in record.media] if values: media[key] = torch.cat(values, dim=0).to(device) for key in MEDIA_TOKEN_KEYS: if any(record.media and key in record.media for record in records): token_values = torch.zeros((len(records), maximum_length), dtype=torch.long, device=device) for index, record in enumerate(records): if record.media and key in record.media: offset = record.media["token_offset"] values = torch.tensor(record.media[key], dtype=torch.long, device=device) token_values[index, offset : offset + len(values)] = values media[key] = token_values return {"input_ids": input_ids, "attention_mask": attention_mask, "records": records, "media": media}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153"""Decision-1.0 records (the format of the MANTA training and evaluation data) -> MANTA requests, exactly as the evaluation built them.
This module serves the reproduction of the published evaluation. A user request in the MANTAJSON format does not need it (manta.request). The published evaluation (commit 7cf2c6a, trainer flags--eval-shuffle and --question-ids task; train.data.Encoder with fixed_questions=True) built each request so:
1. request_from_record without a random generator: the exclusive question pairs are kept apart in record order (`apart`), then the first 64 questions in record order. A choice question with criteria null is not supported (the evaluation refused it too).2. shuffle_options with random.Random(f"shuffle:{request id}"): the options of every choice question in a fixed random order (prompt "keep_order": true). EVAL_SHUFFLE_SEED gives the seed text.3. task_ids: the prompt shows neutral question ids (the stored id without its data-set prefix and without a collision suffix: isic2018.diagnosis -> diagnosis); the predictions keep the stored ids.4. Fallback (train.data.Encoder.encode): if the schema of the shuffled request does not fit, or its prompt reaches max_length while the stored prompt length (n_tokens) is shorter, the request of step 1 is encoded without the shuffle (Clef's sort of the options by id). `encode_row` applies this rule.
Copied from 7cf2c6a (only module names in docstrings shortened): `apart` (data/leaks.py), `shuffle_options`, COLLISION, `task_ids` and`renamed` (train/data.py). `eval_request` is request_from_record (model/prompt.py) without itstraining-only arguments."""
from __future__ import annotations
import jsonimport randomimport refrom collections.abc import Iterable
MAX_QUESTIONS = 64COLLISION = re.compile(r"__\d+$") # the suffix of a repeated question id in a recordEVAL_SHUFFLE_SEED = "shuffle:{request_id}" # the seed text of the evaluation option order
def apart(rec: dict, qids: list[str], rng: random.Random | None = None) -> list[str]: """The question ids without exclusive partners (decision-1.0 exclusive_with: two questions that give away each other's answer never share a request): the questions are taken in a random order (record order if rng is None), and a question whose partner was taken is left out. The result keeps the record order.""" if not any(rec["questions"][q].get("exclusive_with") for q in qids): return qids order = list(qids) if rng is not None: rng.shuffle(order) taken: set[str] = set() for q in order: partners = rec["questions"][q].get("exclusive_with") or [] if not any(p in taken for p in partners): taken.add(q) return [q for q in qids if q in taken]
def shuffle_options(request: dict, rng: random.Random, p: float = 1.0) -> dict: """Each choice question, with probability p: its options in a random order, kept by the prompt ("keep_order": true; model.prompt.question_options). The ids and targets do not change.""" questions = dict(request["questions"]) for qid, q in request["questions"].items(): if q["type"] != "choice" or rng.random() >= p: continue order = list(q["criteria"]) rng.shuffle(order) questions[qid] = {**q, "criteria": {o: q["criteria"][o] for o in order}, "keep_order": True} return {**request, "questions": questions}
def task_ids(record: dict, qids: Iterable[str]) -> dict[str, str]: """stored question id -> the id that the model sees with question_ids "task" (module docstring), for the questions `qids` of one request, in their order.""" datasets = {d for d in str((record.get("source") or {}).get("dataset") or "").split("+") if d} out: dict[str, str] = {} used: set[str] = set() for qid in qids: base = COLLISION.sub("", qid) head, dot, rest = base.partition(".") space = str((record["questions"].get(qid) or {}).get("label_space_id") or "").split(":", 1)[0] if dot and rest and (head in datasets or head == space): base = rest name, n = base, 1 while name in used: n += 1 name = f"{base}_{n}" used.add(name) out[qid] = name return out
def renamed(request: dict, names: dict[str, str]) -> dict: """The request with its questions and targets under the ids `names` (stored id -> shown id).""" return {**request, "questions": {names[q]: v for q, v in request["questions"].items()}, "targets": {names[q]: v for q, v in request["targets"].items()}}
def eval_request(rec: dict, images: list | None = None, max_questions: int = MAX_QUESTIONS) -> dict: """The evaluation request (id, state, questions, targets, images) of a decision-1.0 record: request_from_record of 7cf2c6a without a random generator (apart in record order, then the first `max_questions` questions).""" qids = apart(rec, list(rec["questions"]), None) if len(qids) > max_questions: qids = qids[:max_questions] questions, targets = {}, {} for qid in qids: q, dist = rec["questions"][qid], rec["targets"][qid]["dist"] criteria = q["criteria"] if q["type"] == "choice" and criteria is None: raise ValueError(f"{rec['id']} {qid}: a choice question with criteria null (label space " f"{q.get('label_space_id')!r}) is not supported") elif q["type"] == "noul" and criteria is not None: # D.noul stores None for a missing side; None would erase Clef's default description of that side criteria = {k: v for k, v in criteria.items() if v is not None} or None questions[qid] = {"type": q["type"], "instructions": q["instructions"], "criteria": criteria} targets[qid] = dict(dist) return {"id": rec["id"], "state": rec["state"], "questions": questions, "targets": targets, "images": list(images or [])}
SCHEMA_TOO_LONG = "schema requires" # the start of the ValueError of encode_record for a schema above max_length
def from_row(row: dict, images: list | None = None, shuffle: bool = True) -> tuple[dict, dict[str, str]]: """(the request as the model saw it, shown question id -> stored question id) of one evaluation row of the MANTA evaluation data (columns request_id and record; `images`: the opened images of the row, manta.images.open_image of each file in its images column). The request has the shown ids; shuffle=True: the evaluation option order (keep_order), shuffle=False: the request of the fallback (step 4 of the module docstring).""" record = json.loads(row["record"]) record["id"] = row["request_id"] request = eval_request(record, images) if shuffle: seed = EVAL_SHUFFLE_SEED.format(request_id=row["request_id"]) request = shuffle_options(request, random.Random(seed), 1.0) names = task_ids(record, request["questions"]) shown = renamed(request, names) return shown, {v: k for k, v in names.items()}
def encode_row(row: dict, images: list, encode, max_length: int): """(encoded record with the stored question ids, the shown request, fallback used) of one evaluation row, as the evaluation encoded it. `encode(request)` encodes a request in the MANTA prompt (manta.prompt.encode_record with the model's tokenizer, processor and max_length); row needs request_id, record and n_tokens.""" from dataclasses import replace
n_tokens = int(row["n_tokens"]) shown, stored = from_row(row, images, shuffle=True) enc = None try: enc = encode(shown) except ValueError as e: if not str(e).startswith(SCHEMA_TOO_LONG): raise fallback = enc is None or len(enc.input_ids) >= max_length > n_tokens if fallback: shown, stored = from_row(row, images, shuffle=False) enc = encode(shown) questions = tuple(replace(q, question_id=stored[q.question_id]) for q in enc.questions) return replace(enc, questions=questions), shown, fallback123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128"""The MANTA request format (JSON), its checks, and the option order of the prompt.
A request (examples/text_request.json, examples/image_request.json):
{ "id": "case-001", optional; a string. It seeds the default option order. "state": "...", a string, or any JSON value (shown as compact JSON, sorted keys) "images": ["chest_xray.png"], optional; file paths, http(s) URLs or data URIs, in prompt order "questions": { 1 to 64 questions; the order is the prompt order "<question id>": { "type": "choice" | "score" | "noul", "instructions": "...", the question text (if empty: the question id) "criteria": ... see below } } }
criteria per question type:- choice: an object option id -> description (a string, null, or any JSON value), 2 to 255 options. The answer is one option id.- score: a list of 2 to 255 ordered level descriptions, the lowest level first. The option ids are "0", "1", ...- noul (a yes/no question): null or omitted, or an object with "true" and/or "false" descriptions. The option ids are "true" and "false"; the defaults are "The proposition is true or the answer is yes." and "The proposition is false or the answer is no."
Question ids: the prompt shows them ("ID: <question id>"). Training and evaluation used short task names without adata-set name ("diagnosis", "modality", "finding_present"); use names of that kind.
Option order of the choice questions (option_order of Manta.predict; the answer probabilities do not depend on therule, only on the order that the prompt shows):- "eval" (default): the order of the published evaluation. The options in a fixed random order: random.Random("shuffle:<request id>") shuffles the options of each choice question in question order (one draw per choice question, then a shuffle). Training showed every choice question in a random order.- "given": the order of the criteria object.- "sorted": sorted by option id (the prompt of Cloudflare Clef).Score and noul options always keep their order (lowest level first; true, then false)."""
from __future__ import annotations
import copyimport randomfrom typing import Any
from manta.records import EVAL_SHUFFLE_SEED, shuffle_options
QUESTION_TYPES = ("choice", "score", "noul")MAX_QUESTIONS = 64MIN_OPTIONS, MAX_OPTIONS = 2, 255OPTION_ORDERS = ("eval", "given", "sorted")DEFAULT_ID = "request"REQUEST_KEYS = {"id", "state", "images", "questions"}QUESTION_KEYS = {"type", "instructions", "criteria"}
class RequestError(ValueError): """A request that does not follow the MANTA request format."""
def validate_request(request: dict[str, Any]) -> None: """Raise RequestError with the first problem of `request` (module docstring), else return None.""" if not isinstance(request, dict): raise RequestError(f"a request is a JSON object, not {type(request).__name__}") unknown = set(request) - REQUEST_KEYS if unknown: raise RequestError(f"unknown request keys {sorted(unknown)}; the keys are {sorted(REQUEST_KEYS)}") if "state" not in request: raise RequestError("the request has no state") if "id" in request and not isinstance(request["id"], str): raise RequestError("the request id must be a string") images = request.get("images") or [] if not isinstance(images, list): raise RequestError("images must be a list of file paths, URLs or data URIs") questions = request.get("questions") if not isinstance(questions, dict) or not questions: raise RequestError("questions must be a non-empty object: question id -> question") if len(questions) > MAX_QUESTIONS: raise RequestError(f"{len(questions)} questions; a request takes at most {MAX_QUESTIONS}") for qid, q in questions.items(): where = f"question {qid!r}" if not isinstance(qid, str) or not qid: raise RequestError(f"{where}: a question id is a non-empty string") if not isinstance(q, dict): raise RequestError(f"{where}: a question is a JSON object") unknown = set(q) - QUESTION_KEYS if unknown: raise RequestError(f"{where}: unknown keys {sorted(unknown)}; the keys are {sorted(QUESTION_KEYS)}") kind = q.get("type") if kind not in QUESTION_TYPES: raise RequestError(f"{where}: type {kind!r}; one of {', '.join(QUESTION_TYPES)}") if "instructions" in q and q["instructions"] is not None and not isinstance(q["instructions"], str): raise RequestError(f"{where}: instructions must be a string") criteria = q.get("criteria") if kind == "choice": if not isinstance(criteria, dict) or not MIN_OPTIONS <= len(criteria) <= MAX_OPTIONS: raise RequestError(f"{where}: a choice question needs criteria: an object of {MIN_OPTIONS} to " f"{MAX_OPTIONS} options (option id -> description)") if not all(isinstance(k, str) and k for k in criteria): raise RequestError(f"{where}: option ids are non-empty strings") elif kind == "score": if not isinstance(criteria, list) or not MIN_OPTIONS <= len(criteria) <= MAX_OPTIONS: raise RequestError(f"{where}: a score question needs criteria: a list of {MIN_OPTIONS} to " f"{MAX_OPTIONS} level descriptions, the lowest level first") elif criteria is not None: if not isinstance(criteria, dict) or not set(criteria) <= {"true", "false"}: raise RequestError(f"{where}: noul criteria are null or an object with the keys true and false")
def prompt_request(request: dict[str, Any], option_order: str = "eval") -> dict[str, Any]: """The request in the form of manta.prompt.encode_record (id, state, questions with keep_order where the order is kept; images stay as given: Manta opens them). `request` is not changed.""" validate_request(request) if option_order not in OPTION_ORDERS: raise RequestError(f"option_order {option_order!r}; one of {', '.join(OPTION_ORDERS)}") request_id = request.get("id") or DEFAULT_ID questions = {} for qid, q in request["questions"].items(): criteria = copy.deepcopy(q.get("criteria")) if q["type"] == "noul" and criteria is not None: # as the training data: a missing (null) side keeps the default description of that side criteria = {k: v for k, v in criteria.items() if v is not None} or None questions[qid] = {"type": q["type"], "instructions": q.get("instructions"), "criteria": criteria} if q["type"] == "choice" and option_order == "given": questions[qid]["keep_order"] = True out = {"id": request_id, "state": copy.deepcopy(request["state"]), "questions": questions} if option_order == "eval": out = shuffle_options(out, random.Random(EVAL_SHUFFLE_SEED.format(request_id=request_id)), 1.0) return out123version https://git-lfs.github.com/spec/v1oid sha256:8fd59fa5f72284247bab247dd119594232d80ac568712706385a670e6a8af33asize 4999096424123version https://git-lfs.github.com/spec/v1oid sha256:216777578f1be3c239d0cbf7cbf57a91fc8ab04b0281144980da31ea3d46c033size 4079530992123version https://git-lfs.github.com/spec/v1oid sha256:f2be2efaca515b1bd79e0513d441b65d5884acbd6c655ecdd0f433c5152bc803size 1496056608123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855{ "metadata": { "total_size": 10574582280, "total_parameters": 5287287300, "format": "MANTA-4B standalone: base Qwen/Qwen3.5-4B (revision 851bf6e806efd8d0a36b00ddf55e13ccb7b8cd0a) with the LoRA merged, and the decision head (head.*)" }, "weight_map": { "head.evidence_layers.0.attention.in_proj_bias": "model-00003-of-00003.safetensors", "head.evidence_layers.0.attention.in_proj_weight": "model-00003-of-00003.safetensors", "head.evidence_layers.0.attention.out_proj.bias": "model-00003-of-00003.safetensors", "head.evidence_layers.0.attention.out_proj.weight": "model-00003-of-00003.safetensors", "head.evidence_layers.0.feedforward.0.bias": "model-00003-of-00003.safetensors", "head.evidence_layers.0.feedforward.0.weight": "model-00003-of-00003.safetensors", "head.evidence_layers.0.feedforward.3.bias": "model-00003-of-00003.safetensors", "head.evidence_layers.0.feedforward.3.weight": "model-00003-of-00003.safetensors", "head.evidence_layers.0.feedforward_norm.bias": "model-00003-of-00003.safetensors", "head.evidence_layers.0.feedforward_norm.weight": "model-00003-of-00003.safetensors", "head.evidence_layers.0.memory_norm.bias": "model-00003-of-00003.safetensors", "head.evidence_layers.0.memory_norm.weight": "model-00003-of-00003.safetensors", "head.evidence_layers.0.query_norm.bias": "model-00003-of-00003.safetensors", "head.evidence_layers.0.query_norm.weight": "model-00003-of-00003.safetensors", "head.evidence_layers.1.attention.in_proj_bias": "model-00003-of-00003.safetensors", "head.evidence_layers.1.attention.in_proj_weight": "model-00003-of-00003.safetensors", "head.evidence_layers.1.attention.out_proj.bias": "model-00003-of-00003.safetensors", "head.evidence_layers.1.attention.out_proj.weight": "model-00003-of-00003.safetensors", "head.evidence_layers.1.feedforward.0.bias": "model-00003-of-00003.safetensors", "head.evidence_layers.1.feedforward.0.weight": "model-00003-of-00003.safetensors", "head.evidence_layers.1.feedforward.3.bias": "model-00003-of-00003.safetensors", "head.evidence_layers.1.feedforward.3.weight": "model-00003-of-00003.safetensors", "head.evidence_layers.1.feedforward_norm.bias": "model-00003-of-00003.safetensors", "head.evidence_layers.1.feedforward_norm.weight": "model-00003-of-00003.safetensors", "head.evidence_layers.1.memory_norm.bias": "model-00003-of-00003.safetensors", "head.evidence_layers.1.memory_norm.weight": "model-00003-of-00003.safetensors", "head.evidence_layers.1.query_norm.bias": "model-00003-of-00003.safetensors", "head.evidence_layers.1.query_norm.weight": "model-00003-of-00003.safetensors", "head.field_norm.bias": "model-00003-of-00003.safetensors", "head.field_norm.weight": "model-00003-of-00003.safetensors", "head.global_projection.weight": "model-00003-of-00003.safetensors", "head.hidden_norm.bias": "model-00003-of-00003.safetensors", "head.hidden_norm.weight": "model-00003-of-00003.safetensors", "head.joint_logit_scale": "model-00003-of-00003.safetensors", "head.layers.0.linear1.bias": "model-00003-of-00003.safetensors", "head.layers.0.linear1.weight": "model-00003-of-00003.safetensors", "head.layers.0.linear2.bias": "model-00003-of-00003.safetensors", "head.layers.0.linear2.weight": "model-00003-of-00003.safetensors", "head.layers.0.multihead_attn.in_proj_bias": "model-00003-of-00003.safetensors", "head.layers.0.multihead_attn.in_proj_weight": "model-00003-of-00003.safetensors", "head.layers.0.multihead_attn.out_proj.bias": "model-00003-of-00003.safetensors", "head.layers.0.multihead_attn.out_proj.weight": "model-00003-of-00003.safetensors", "head.layers.0.norm1.bias": "model-00003-of-00003.safetensors", "head.layers.0.norm1.weight": "model-00003-of-00003.safetensors", "head.layers.0.norm2.bias": "model-00003-of-00003.safetensors", "head.layers.0.norm2.weight": "model-00003-of-00003.safetensors", "head.layers.0.norm3.bias": "model-00003-of-00003.safetensors", "head.layers.0.norm3.weight": "model-00003-of-00003.safetensors", "head.layers.0.self_attn.in_proj_bias": "model-00003-of-00003.safetensors", "head.layers.0.self_attn.in_proj_weight": "model-00003-of-00003.safetensors", "head.layers.0.self_attn.out_proj.bias": "model-00003-of-00003.safetensors", "head.layers.0.self_attn.out_proj.weight": "model-00003-of-00003.safetensors", "head.layers.1.linear1.bias": "model-00003-of-00003.safetensors", "head.layers.1.linear1.weight": "model-00003-of-00003.safetensors", "head.layers.1.linear2.bias": "model-00003-of-00003.safetensors", "head.layers.1.linear2.weight": "model-00003-of-00003.safetensors", "head.layers.1.multihead_attn.in_proj_bias": "model-00003-of-00003.safetensors", "head.layers.1.multihead_attn.in_proj_weight": "model-00003-of-00003.safetensors", "head.layers.1.multihead_attn.out_proj.bias": "model-00003-of-00003.safetensors", "head.layers.1.multihead_attn.out_proj.weight": "model-00003-of-00003.safetensors", "head.layers.1.norm1.bias": "model-00003-of-00003.safetensors", "head.layers.1.norm1.weight": "model-00003-of-00003.safetensors", "head.layers.1.norm2.bias": "model-00003-of-00003.safetensors", "head.layers.1.norm2.weight": "model-00003-of-00003.safetensors", "head.layers.1.norm3.bias": "model-00003-of-00003.safetensors", "head.layers.1.norm3.weight": "model-00003-of-00003.safetensors", "head.layers.1.self_attn.in_proj_bias": "model-00003-of-00003.safetensors", "head.layers.1.self_attn.in_proj_weight": "model-00003-of-00003.safetensors", "head.layers.1.self_attn.out_proj.bias": "model-00003-of-00003.safetensors", "head.layers.1.self_attn.out_proj.weight": "model-00003-of-00003.safetensors", "head.layers.2.linear1.bias": "model-00003-of-00003.safetensors", "head.layers.2.linear1.weight": "model-00003-of-00003.safetensors", "head.layers.2.linear2.bias": "model-00003-of-00003.safetensors", "head.layers.2.linear2.weight": "model-00003-of-00003.safetensors", "head.layers.2.multihead_attn.in_proj_bias": "model-00003-of-00003.safetensors", "head.layers.2.multihead_attn.in_proj_weight": "model-00003-of-00003.safetensors", "head.layers.2.multihead_attn.out_proj.bias": "model-00003-of-00003.safetensors", "head.layers.2.multihead_attn.out_proj.weight": "model-00003-of-00003.safetensors", "head.layers.2.norm1.bias": "model-00003-of-00003.safetensors", "head.layers.2.norm1.weight": "model-00003-of-00003.safetensors", "head.layers.2.norm2.bias": "model-00003-of-00003.safetensors", "head.layers.2.norm2.weight": "model-00003-of-00003.safetensors", "head.layers.2.norm3.bias": "model-00003-of-00003.safetensors", "head.layers.2.norm3.weight": "model-00003-of-00003.safetensors", "head.layers.2.self_attn.in_proj_bias": "model-00003-of-00003.safetensors", "head.layers.2.self_attn.in_proj_weight": "model-00003-of-00003.safetensors", "head.layers.2.self_attn.out_proj.bias": "model-00003-of-00003.safetensors", "head.layers.2.self_attn.out_proj.weight": "model-00003-of-00003.safetensors", "head.layers.3.linear1.bias": "model-00003-of-00003.safetensors", "head.layers.3.linear1.weight": "model-00003-of-00003.safetensors", "head.layers.3.linear2.bias": "model-00003-of-00003.safetensors", "head.layers.3.linear2.weight": "model-00003-of-00003.safetensors", "head.layers.3.multihead_attn.in_proj_bias": "model-00003-of-00003.safetensors", "head.layers.3.multihead_attn.in_proj_weight": "model-00003-of-00003.safetensors", "head.layers.3.multihead_attn.out_proj.bias": "model-00003-of-00003.safetensors", "head.layers.3.multihead_attn.out_proj.weight": "model-00003-of-00003.safetensors", "head.layers.3.norm1.bias": "model-00003-of-00003.safetensors", "head.layers.3.norm1.weight": "model-00003-of-00003.safetensors", "head.layers.3.norm2.bias": "model-00003-of-00003.safetensors", "head.layers.3.norm2.weight": "model-00003-of-00003.safetensors", "head.layers.3.norm3.bias": "model-00003-of-00003.safetensors", "head.layers.3.norm3.weight": "model-00003-of-00003.safetensors", "head.layers.3.self_attn.in_proj_bias": "model-00003-of-00003.safetensors", "head.layers.3.self_attn.in_proj_weight": "model-00003-of-00003.safetensors", "head.layers.3.self_attn.out_proj.bias": "model-00003-of-00003.safetensors", "head.layers.3.self_attn.out_proj.weight": "model-00003-of-00003.safetensors", "head.memory_projection.weight": "model-00003-of-00003.safetensors", "head.option_context_projection.weight": "model-00003-of-00003.safetensors", "head.option_lexical_projection.weight": "model-00003-of-00003.safetensors", "head.option_norm.bias": "model-00003-of-00003.safetensors", "head.option_norm.weight": "model-00003-of-00003.safetensors", "head.option_question_projection.weight": "model-00003-of-00003.safetensors", "head.option_summary_norm.bias": "model-00003-of-00003.safetensors", "head.option_summary_norm.weight": "model-00003-of-00003.safetensors", "head.prior_logit_scale": "model-00003-of-00003.safetensors", "head.question_projection.weight": "model-00003-of-00003.safetensors", "head.residual_gate": "model-00003-of-00003.safetensors", "head.residual_scorer.0.bias": "model-00003-of-00003.safetensors", "head.residual_scorer.0.weight": "model-00003-of-00003.safetensors", "head.residual_scorer.3.bias": "model-00003-of-00003.safetensors", "head.residual_scorer.3.weight": "model-00003-of-00003.safetensors", "head.type_embedding.weight": "model-00003-of-00003.safetensors", "lm_head.weight": "model-00003-of-00003.safetensors", "model.language_model.embed_tokens.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.0.input_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.0.linear_attn.A_log": "model-00002-of-00003.safetensors", "model.language_model.layers.0.linear_attn.conv1d.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.0.linear_attn.dt_bias": "model-00002-of-00003.safetensors", "model.language_model.layers.0.linear_attn.in_proj_a.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.0.linear_attn.in_proj_b.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.0.linear_attn.in_proj_qkv.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.0.linear_attn.in_proj_z.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.0.linear_attn.norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.0.linear_attn.out_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.0.mlp.down_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.0.mlp.gate_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.0.mlp.up_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.0.post_attention_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.1.input_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.1.linear_attn.A_log": "model-00002-of-00003.safetensors", "model.language_model.layers.1.linear_attn.conv1d.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.1.linear_attn.dt_bias": "model-00002-of-00003.safetensors", "model.language_model.layers.1.linear_attn.in_proj_a.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.1.linear_attn.in_proj_b.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.1.linear_attn.in_proj_qkv.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.1.linear_attn.in_proj_z.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.1.linear_attn.norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.1.linear_attn.out_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.1.mlp.down_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.1.mlp.gate_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.1.mlp.up_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.1.post_attention_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.10.input_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.10.linear_attn.A_log": "model-00002-of-00003.safetensors", "model.language_model.layers.10.linear_attn.conv1d.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.10.linear_attn.dt_bias": "model-00002-of-00003.safetensors", "model.language_model.layers.10.linear_attn.in_proj_a.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.10.linear_attn.in_proj_b.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.10.linear_attn.in_proj_qkv.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.10.linear_attn.in_proj_z.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.10.linear_attn.norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.10.linear_attn.out_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.10.mlp.down_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.10.mlp.gate_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.10.mlp.up_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.10.post_attention_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.11.input_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.11.mlp.down_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.11.mlp.gate_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.11.mlp.up_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.11.post_attention_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.11.self_attn.k_norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.11.self_attn.k_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.11.self_attn.o_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.11.self_attn.q_norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.11.self_attn.q_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.11.self_attn.v_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.12.input_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.12.linear_attn.A_log": "model-00002-of-00003.safetensors", "model.language_model.layers.12.linear_attn.conv1d.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.12.linear_attn.dt_bias": "model-00002-of-00003.safetensors", "model.language_model.layers.12.linear_attn.in_proj_a.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.12.linear_attn.in_proj_b.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.12.linear_attn.in_proj_qkv.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.12.linear_attn.in_proj_z.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.12.linear_attn.norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.12.linear_attn.out_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.12.mlp.down_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.12.mlp.gate_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.12.mlp.up_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.12.post_attention_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.13.input_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.13.linear_attn.A_log": "model-00002-of-00003.safetensors", "model.language_model.layers.13.linear_attn.conv1d.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.13.linear_attn.dt_bias": "model-00002-of-00003.safetensors", "model.language_model.layers.13.linear_attn.in_proj_a.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.13.linear_attn.in_proj_b.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.13.linear_attn.in_proj_qkv.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.13.linear_attn.in_proj_z.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.13.linear_attn.norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.13.linear_attn.out_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.13.mlp.down_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.13.mlp.gate_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.13.mlp.up_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.13.post_attention_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.14.input_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.14.linear_attn.A_log": "model-00002-of-00003.safetensors", "model.language_model.layers.14.linear_attn.conv1d.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.14.linear_attn.dt_bias": "model-00002-of-00003.safetensors", "model.language_model.layers.14.linear_attn.in_proj_a.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.14.linear_attn.in_proj_b.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.14.linear_attn.in_proj_qkv.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.14.linear_attn.in_proj_z.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.14.linear_attn.norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.14.linear_attn.out_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.14.mlp.down_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.14.mlp.gate_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.14.mlp.up_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.14.post_attention_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.15.input_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.15.mlp.down_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.15.mlp.gate_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.15.mlp.up_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.15.post_attention_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.15.self_attn.k_norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.15.self_attn.k_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.15.self_attn.o_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.15.self_attn.q_norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.15.self_attn.q_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.15.self_attn.v_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.16.input_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.16.linear_attn.A_log": "model-00002-of-00003.safetensors", "model.language_model.layers.16.linear_attn.conv1d.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.16.linear_attn.dt_bias": "model-00002-of-00003.safetensors", "model.language_model.layers.16.linear_attn.in_proj_a.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.16.linear_attn.in_proj_b.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.16.linear_attn.in_proj_qkv.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.16.linear_attn.in_proj_z.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.16.linear_attn.norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.16.linear_attn.out_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.16.mlp.down_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.16.mlp.gate_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.16.mlp.up_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.16.post_attention_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.17.input_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.17.linear_attn.A_log": "model-00002-of-00003.safetensors", "model.language_model.layers.17.linear_attn.conv1d.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.17.linear_attn.dt_bias": "model-00002-of-00003.safetensors", "model.language_model.layers.17.linear_attn.in_proj_a.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.17.linear_attn.in_proj_b.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.17.linear_attn.in_proj_qkv.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.17.linear_attn.in_proj_z.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.17.linear_attn.norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.17.linear_attn.out_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.17.mlp.down_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.17.mlp.gate_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.17.mlp.up_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.17.post_attention_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.18.input_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.18.linear_attn.A_log": "model-00002-of-00003.safetensors", "model.language_model.layers.18.linear_attn.conv1d.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.18.linear_attn.dt_bias": "model-00002-of-00003.safetensors", "model.language_model.layers.18.linear_attn.in_proj_a.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.18.linear_attn.in_proj_b.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.18.linear_attn.in_proj_qkv.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.18.linear_attn.in_proj_z.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.18.linear_attn.norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.18.linear_attn.out_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.18.mlp.down_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.18.mlp.gate_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.18.mlp.up_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.18.post_attention_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.19.input_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.19.mlp.down_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.19.mlp.gate_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.19.mlp.up_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.19.post_attention_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.19.self_attn.k_norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.19.self_attn.k_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.19.self_attn.o_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.19.self_attn.q_norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.19.self_attn.q_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.19.self_attn.v_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.2.input_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.2.linear_attn.A_log": "model-00002-of-00003.safetensors", "model.language_model.layers.2.linear_attn.conv1d.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.2.linear_attn.dt_bias": "model-00002-of-00003.safetensors", "model.language_model.layers.2.linear_attn.in_proj_a.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.2.linear_attn.in_proj_b.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.2.linear_attn.in_proj_qkv.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.2.linear_attn.in_proj_z.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.2.linear_attn.norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.2.linear_attn.out_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.2.mlp.down_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.2.mlp.gate_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.2.mlp.up_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.2.post_attention_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.20.input_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.20.linear_attn.A_log": "model-00002-of-00003.safetensors", "model.language_model.layers.20.linear_attn.conv1d.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.20.linear_attn.dt_bias": "model-00002-of-00003.safetensors", "model.language_model.layers.20.linear_attn.in_proj_a.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.20.linear_attn.in_proj_b.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.20.linear_attn.in_proj_qkv.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.20.linear_attn.in_proj_z.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.20.linear_attn.norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.20.linear_attn.out_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.20.mlp.down_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.20.mlp.gate_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.20.mlp.up_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.20.post_attention_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.21.input_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.21.linear_attn.A_log": "model-00002-of-00003.safetensors", "model.language_model.layers.21.linear_attn.conv1d.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.21.linear_attn.dt_bias": "model-00002-of-00003.safetensors", "model.language_model.layers.21.linear_attn.in_proj_a.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.21.linear_attn.in_proj_b.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.21.linear_attn.in_proj_qkv.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.21.linear_attn.in_proj_z.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.21.linear_attn.norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.21.linear_attn.out_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.21.mlp.down_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.21.mlp.gate_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.21.mlp.up_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.21.post_attention_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.22.input_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.22.linear_attn.A_log": "model-00002-of-00003.safetensors", "model.language_model.layers.22.linear_attn.conv1d.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.22.linear_attn.dt_bias": "model-00002-of-00003.safetensors", "model.language_model.layers.22.linear_attn.in_proj_a.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.22.linear_attn.in_proj_b.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.22.linear_attn.in_proj_qkv.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.22.linear_attn.in_proj_z.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.22.linear_attn.norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.22.linear_attn.out_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.22.mlp.down_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.22.mlp.gate_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.22.mlp.up_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.22.post_attention_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.23.input_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.23.mlp.down_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.23.mlp.gate_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.23.mlp.up_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.23.post_attention_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.23.self_attn.k_norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.23.self_attn.k_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.23.self_attn.o_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.23.self_attn.q_norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.23.self_attn.q_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.23.self_attn.v_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.24.input_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.24.linear_attn.A_log": "model-00002-of-00003.safetensors", "model.language_model.layers.24.linear_attn.conv1d.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.24.linear_attn.dt_bias": "model-00002-of-00003.safetensors", "model.language_model.layers.24.linear_attn.in_proj_a.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.24.linear_attn.in_proj_b.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.24.linear_attn.in_proj_qkv.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.24.linear_attn.in_proj_z.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.24.linear_attn.norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.24.linear_attn.out_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.24.mlp.down_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.24.mlp.gate_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.24.mlp.up_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.24.post_attention_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.25.input_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.25.linear_attn.A_log": "model-00002-of-00003.safetensors", "model.language_model.layers.25.linear_attn.conv1d.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.25.linear_attn.dt_bias": "model-00002-of-00003.safetensors", "model.language_model.layers.25.linear_attn.in_proj_a.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.25.linear_attn.in_proj_b.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.25.linear_attn.in_proj_qkv.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.25.linear_attn.in_proj_z.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.25.linear_attn.norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.25.linear_attn.out_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.25.mlp.down_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.25.mlp.gate_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.25.mlp.up_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.25.post_attention_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.26.input_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.26.linear_attn.A_log": "model-00002-of-00003.safetensors", "model.language_model.layers.26.linear_attn.conv1d.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.26.linear_attn.dt_bias": "model-00002-of-00003.safetensors", "model.language_model.layers.26.linear_attn.in_proj_a.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.26.linear_attn.in_proj_b.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.26.linear_attn.in_proj_qkv.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.26.linear_attn.in_proj_z.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.26.linear_attn.norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.26.linear_attn.out_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.26.mlp.down_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.26.mlp.gate_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.26.mlp.up_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.26.post_attention_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.27.input_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.27.mlp.down_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.27.mlp.gate_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.27.mlp.up_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.27.post_attention_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.27.self_attn.k_norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.27.self_attn.k_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.27.self_attn.o_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.27.self_attn.q_norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.27.self_attn.q_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.27.self_attn.v_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.28.input_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.28.linear_attn.A_log": "model-00002-of-00003.safetensors", "model.language_model.layers.28.linear_attn.conv1d.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.28.linear_attn.dt_bias": "model-00002-of-00003.safetensors", "model.language_model.layers.28.linear_attn.in_proj_a.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.28.linear_attn.in_proj_b.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.28.linear_attn.in_proj_qkv.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.28.linear_attn.in_proj_z.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.28.linear_attn.norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.28.linear_attn.out_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.28.mlp.down_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.28.mlp.gate_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.28.mlp.up_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.28.post_attention_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.29.input_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.29.linear_attn.A_log": "model-00002-of-00003.safetensors", "model.language_model.layers.29.linear_attn.conv1d.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.29.linear_attn.dt_bias": "model-00002-of-00003.safetensors", "model.language_model.layers.29.linear_attn.in_proj_a.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.29.linear_attn.in_proj_b.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.29.linear_attn.in_proj_qkv.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.29.linear_attn.in_proj_z.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.29.linear_attn.norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.29.linear_attn.out_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.29.mlp.down_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.29.mlp.gate_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.29.mlp.up_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.29.post_attention_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.3.input_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.3.mlp.down_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.3.mlp.gate_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.3.mlp.up_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.3.post_attention_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.3.self_attn.k_norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.3.self_attn.k_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.3.self_attn.o_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.3.self_attn.q_norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.3.self_attn.q_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.3.self_attn.v_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.30.input_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.30.linear_attn.A_log": "model-00002-of-00003.safetensors", "model.language_model.layers.30.linear_attn.conv1d.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.30.linear_attn.dt_bias": "model-00002-of-00003.safetensors", "model.language_model.layers.30.linear_attn.in_proj_a.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.30.linear_attn.in_proj_b.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.30.linear_attn.in_proj_qkv.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.30.linear_attn.in_proj_z.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.30.linear_attn.norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.30.linear_attn.out_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.30.mlp.down_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.30.mlp.gate_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.30.mlp.up_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.30.post_attention_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.31.input_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.31.mlp.down_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.31.mlp.gate_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.31.mlp.up_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.31.post_attention_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.31.self_attn.k_norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.31.self_attn.k_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.31.self_attn.o_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.31.self_attn.q_norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.31.self_attn.q_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.31.self_attn.v_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.4.input_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.4.linear_attn.A_log": "model-00002-of-00003.safetensors", "model.language_model.layers.4.linear_attn.conv1d.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.4.linear_attn.dt_bias": "model-00002-of-00003.safetensors", "model.language_model.layers.4.linear_attn.in_proj_a.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.4.linear_attn.in_proj_b.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.4.linear_attn.in_proj_qkv.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.4.linear_attn.in_proj_z.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.4.linear_attn.norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.4.linear_attn.out_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.4.mlp.down_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.4.mlp.gate_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.4.mlp.up_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.4.post_attention_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.5.input_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.5.linear_attn.A_log": "model-00002-of-00003.safetensors", "model.language_model.layers.5.linear_attn.conv1d.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.5.linear_attn.dt_bias": "model-00002-of-00003.safetensors", "model.language_model.layers.5.linear_attn.in_proj_a.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.5.linear_attn.in_proj_b.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.5.linear_attn.in_proj_qkv.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.5.linear_attn.in_proj_z.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.5.linear_attn.norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.5.linear_attn.out_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.5.mlp.down_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.5.mlp.gate_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.5.mlp.up_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.5.post_attention_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.6.input_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.6.linear_attn.A_log": "model-00002-of-00003.safetensors", "model.language_model.layers.6.linear_attn.conv1d.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.6.linear_attn.dt_bias": "model-00002-of-00003.safetensors", "model.language_model.layers.6.linear_attn.in_proj_a.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.6.linear_attn.in_proj_b.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.6.linear_attn.in_proj_qkv.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.6.linear_attn.in_proj_z.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.6.linear_attn.norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.6.linear_attn.out_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.6.mlp.down_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.6.mlp.gate_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.6.mlp.up_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.6.post_attention_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.7.input_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.7.mlp.down_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.7.mlp.gate_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.7.mlp.up_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.7.post_attention_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.7.self_attn.k_norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.7.self_attn.k_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.7.self_attn.o_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.7.self_attn.q_norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.7.self_attn.q_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.7.self_attn.v_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.8.input_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.8.linear_attn.A_log": "model-00002-of-00003.safetensors", "model.language_model.layers.8.linear_attn.conv1d.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.8.linear_attn.dt_bias": "model-00002-of-00003.safetensors", "model.language_model.layers.8.linear_attn.in_proj_a.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.8.linear_attn.in_proj_b.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.8.linear_attn.in_proj_qkv.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.8.linear_attn.in_proj_z.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.8.linear_attn.norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.8.linear_attn.out_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.8.mlp.down_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.8.mlp.gate_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.8.mlp.up_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.8.post_attention_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.9.input_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.9.linear_attn.A_log": "model-00002-of-00003.safetensors", "model.language_model.layers.9.linear_attn.conv1d.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.9.linear_attn.dt_bias": "model-00002-of-00003.safetensors", "model.language_model.layers.9.linear_attn.in_proj_a.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.9.linear_attn.in_proj_b.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.9.linear_attn.in_proj_qkv.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.9.linear_attn.in_proj_z.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.9.linear_attn.norm.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.9.linear_attn.out_proj.weight": "model-00002-of-00003.safetensors", "model.language_model.layers.9.mlp.down_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.9.mlp.gate_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.9.mlp.up_proj.weight": "model-00001-of-00003.safetensors", "model.language_model.layers.9.post_attention_layernorm.weight": "model-00002-of-00003.safetensors", "model.language_model.norm.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.0.attn.proj.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.0.attn.proj.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.0.attn.qkv.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.0.attn.qkv.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.0.mlp.linear_fc1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.0.mlp.linear_fc1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.0.mlp.linear_fc2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.0.mlp.linear_fc2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.0.norm1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.0.norm1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.0.norm2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.0.norm2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.1.attn.proj.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.1.attn.proj.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.1.attn.qkv.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.1.attn.qkv.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.1.mlp.linear_fc1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.1.mlp.linear_fc1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.1.mlp.linear_fc2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.1.mlp.linear_fc2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.1.norm1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.1.norm1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.1.norm2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.1.norm2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.10.attn.proj.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.10.attn.proj.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.10.attn.qkv.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.10.attn.qkv.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.10.mlp.linear_fc1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.10.mlp.linear_fc1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.10.mlp.linear_fc2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.10.mlp.linear_fc2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.10.norm1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.10.norm1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.10.norm2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.10.norm2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.11.attn.proj.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.11.attn.proj.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.11.attn.qkv.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.11.attn.qkv.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.11.mlp.linear_fc1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.11.mlp.linear_fc1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.11.mlp.linear_fc2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.11.mlp.linear_fc2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.11.norm1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.11.norm1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.11.norm2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.11.norm2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.12.attn.proj.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.12.attn.proj.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.12.attn.qkv.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.12.attn.qkv.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.12.mlp.linear_fc1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.12.mlp.linear_fc1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.12.mlp.linear_fc2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.12.mlp.linear_fc2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.12.norm1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.12.norm1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.12.norm2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.12.norm2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.13.attn.proj.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.13.attn.proj.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.13.attn.qkv.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.13.attn.qkv.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.13.mlp.linear_fc1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.13.mlp.linear_fc1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.13.mlp.linear_fc2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.13.mlp.linear_fc2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.13.norm1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.13.norm1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.13.norm2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.13.norm2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.14.attn.proj.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.14.attn.proj.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.14.attn.qkv.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.14.attn.qkv.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.14.mlp.linear_fc1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.14.mlp.linear_fc1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.14.mlp.linear_fc2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.14.mlp.linear_fc2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.14.norm1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.14.norm1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.14.norm2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.14.norm2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.15.attn.proj.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.15.attn.proj.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.15.attn.qkv.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.15.attn.qkv.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.15.mlp.linear_fc1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.15.mlp.linear_fc1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.15.mlp.linear_fc2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.15.mlp.linear_fc2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.15.norm1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.15.norm1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.15.norm2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.15.norm2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.16.attn.proj.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.16.attn.proj.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.16.attn.qkv.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.16.attn.qkv.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.16.mlp.linear_fc1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.16.mlp.linear_fc1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.16.mlp.linear_fc2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.16.mlp.linear_fc2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.16.norm1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.16.norm1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.16.norm2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.16.norm2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.17.attn.proj.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.17.attn.proj.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.17.attn.qkv.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.17.attn.qkv.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.17.mlp.linear_fc1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.17.mlp.linear_fc1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.17.mlp.linear_fc2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.17.mlp.linear_fc2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.17.norm1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.17.norm1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.17.norm2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.17.norm2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.18.attn.proj.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.18.attn.proj.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.18.attn.qkv.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.18.attn.qkv.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.18.mlp.linear_fc1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.18.mlp.linear_fc1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.18.mlp.linear_fc2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.18.mlp.linear_fc2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.18.norm1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.18.norm1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.18.norm2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.18.norm2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.19.attn.proj.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.19.attn.proj.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.19.attn.qkv.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.19.attn.qkv.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.19.mlp.linear_fc1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.19.mlp.linear_fc1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.19.mlp.linear_fc2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.19.mlp.linear_fc2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.19.norm1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.19.norm1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.19.norm2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.19.norm2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.2.attn.proj.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.2.attn.proj.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.2.attn.qkv.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.2.attn.qkv.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.2.mlp.linear_fc1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.2.mlp.linear_fc1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.2.mlp.linear_fc2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.2.mlp.linear_fc2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.2.norm1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.2.norm1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.2.norm2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.2.norm2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.20.attn.proj.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.20.attn.proj.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.20.attn.qkv.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.20.attn.qkv.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.20.mlp.linear_fc1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.20.mlp.linear_fc1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.20.mlp.linear_fc2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.20.mlp.linear_fc2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.20.norm1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.20.norm1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.20.norm2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.20.norm2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.21.attn.proj.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.21.attn.proj.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.21.attn.qkv.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.21.attn.qkv.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.21.mlp.linear_fc1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.21.mlp.linear_fc1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.21.mlp.linear_fc2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.21.mlp.linear_fc2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.21.norm1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.21.norm1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.21.norm2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.21.norm2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.22.attn.proj.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.22.attn.proj.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.22.attn.qkv.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.22.attn.qkv.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.22.mlp.linear_fc1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.22.mlp.linear_fc1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.22.mlp.linear_fc2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.22.mlp.linear_fc2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.22.norm1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.22.norm1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.22.norm2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.22.norm2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.23.attn.proj.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.23.attn.proj.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.23.attn.qkv.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.23.attn.qkv.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.23.mlp.linear_fc1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.23.mlp.linear_fc1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.23.mlp.linear_fc2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.23.mlp.linear_fc2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.23.norm1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.23.norm1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.23.norm2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.23.norm2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.3.attn.proj.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.3.attn.proj.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.3.attn.qkv.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.3.attn.qkv.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.3.mlp.linear_fc1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.3.mlp.linear_fc1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.3.mlp.linear_fc2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.3.mlp.linear_fc2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.3.norm1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.3.norm1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.3.norm2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.3.norm2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.4.attn.proj.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.4.attn.proj.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.4.attn.qkv.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.4.attn.qkv.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.4.mlp.linear_fc1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.4.mlp.linear_fc1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.4.mlp.linear_fc2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.4.mlp.linear_fc2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.4.norm1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.4.norm1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.4.norm2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.4.norm2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.5.attn.proj.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.5.attn.proj.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.5.attn.qkv.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.5.attn.qkv.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.5.mlp.linear_fc1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.5.mlp.linear_fc1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.5.mlp.linear_fc2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.5.mlp.linear_fc2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.5.norm1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.5.norm1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.5.norm2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.5.norm2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.6.attn.proj.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.6.attn.proj.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.6.attn.qkv.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.6.attn.qkv.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.6.mlp.linear_fc1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.6.mlp.linear_fc1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.6.mlp.linear_fc2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.6.mlp.linear_fc2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.6.norm1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.6.norm1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.6.norm2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.6.norm2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.7.attn.proj.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.7.attn.proj.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.7.attn.qkv.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.7.attn.qkv.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.7.mlp.linear_fc1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.7.mlp.linear_fc1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.7.mlp.linear_fc2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.7.mlp.linear_fc2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.7.norm1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.7.norm1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.7.norm2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.7.norm2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.8.attn.proj.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.8.attn.proj.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.8.attn.qkv.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.8.attn.qkv.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.8.mlp.linear_fc1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.8.mlp.linear_fc1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.8.mlp.linear_fc2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.8.mlp.linear_fc2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.8.norm1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.8.norm1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.8.norm2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.8.norm2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.9.attn.proj.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.9.attn.proj.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.9.attn.qkv.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.9.attn.qkv.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.9.mlp.linear_fc1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.9.mlp.linear_fc1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.9.mlp.linear_fc2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.9.mlp.linear_fc2.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.9.norm1.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.9.norm1.weight": "model-00002-of-00003.safetensors", "model.visual.blocks.9.norm2.bias": "model-00002-of-00003.safetensors", "model.visual.blocks.9.norm2.weight": "model-00002-of-00003.safetensors", "model.visual.merger.linear_fc1.bias": "model-00002-of-00003.safetensors", "model.visual.merger.linear_fc1.weight": "model-00002-of-00003.safetensors", "model.visual.merger.linear_fc2.bias": "model-00002-of-00003.safetensors", "model.visual.merger.linear_fc2.weight": "model-00002-of-00003.safetensors", "model.visual.merger.norm.bias": "model-00002-of-00003.safetensors", "model.visual.merger.norm.weight": "model-00002-of-00003.safetensors", "model.visual.patch_embed.proj.bias": "model-00002-of-00003.safetensors", "model.visual.patch_embed.proj.weight": "model-00002-of-00003.safetensors", "model.visual.pos_embed.weight": "model-00002-of-00003.safetensors" }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251"""MANTA (Medical Answers, Natively from Text And images): the standalone decision model for transformers.
import torch from transformers import AutoModel model = AutoModel.from_pretrained("<MANTA folder or repository>", trust_remote_code=True, dtype=torch.bfloat16)
MantaForDecision = the Qwen3.5-architecture backbone of the base model (transformers' Qwen3_5Model and its LM head; thetrained LoRA weights are merged into it) + the joint schema head (`head`). forward(input_ids, attention_mask,records, **image inputs) returns, per request and per question, one logit per option in the order ofEncodedQuestion.option_ids (the request encoding: manta.prompt.encode_record of the MANTA repository). A softmax overthe logits of one question gives its probabilities. No text is generated.
The head code (CLEF_HEAD, SCALARS, _scalars_as_vectors, EvidenceRoutingLayer, JointSchemaHead, build_head) is copiedwithout change from the training code (commit 7cf2c6a, model/head.py), which ported it fromCloudflare Clef, joint_schema_model.py (Apache-2.0; huggingface.co/Cloudflare/clef, revision0b331204bb13fbd2ca93a64df1956f5b55478ce5). The forward pass follows model.head.DecisionModel of 7cf2c6a.
Input cast: the published evaluation ran under FSDP2 with MixedPrecisionPolicy(param_dtype=bfloat16), which caststhe floating-point inputs of every decoder layer and vision block to BF16 (for example the vision rotary embeddings,which transformers computes in FP32). MantaForDecision registers the same cast on these modules (to the dtype oftheir parameters), so a BF16 model computes with the numbers of the evaluation."""
from __future__ import annotations
import functoolsimport mathfrom typing import Any
import torchimport torch.nn.functional as Ffrom torch.utils._pytree import tree_mapfrom transformers.models.qwen3_5.modeling_qwen3_5 import Qwen3_5Model, Qwen3_5PreTrainedModel
from .configuration_manta import MantaConfig
EncodedRecord = Any # manta.prompt.EncodedRecord: the head reads question_span, option_spans, question_type
# --- the joint schema head: copied without change from the training code 7cf2c6a, model/head.py ---
# Clef's joint_head_config.json without hidden_size (Clef and Clef-flash use the same values).CLEF_HEAD = {"width": 1024, "routing_layers": 2, "layers": 4, "heads": 16, "feedforward": 4096}
SCALARS = ("prior_logit_scale", "joint_logit_scale", "residual_gate")
def _scalars_as_vectors(module, state_dict, prefix, *args) -> None: for name in SCALARS: value = state_dict.get(prefix + name) if value is not None and value.ndim == 0: state_dict[prefix + name] = value.reshape(1)
class EvidenceRoutingLayer(torch.nn.Module): """Pre-LN cross-attention from the option queries to the token memory, then a feed-forward block."""
def __init__(self, width: int, heads: int, feedforward: int, dropout: float = 0.0) -> None: super().__init__() self.query_norm = torch.nn.LayerNorm(width) self.memory_norm = torch.nn.LayerNorm(width) self.attention = torch.nn.MultiheadAttention(width, heads, dropout=dropout, batch_first=True) self.attention_dropout = torch.nn.Dropout(dropout) self.feedforward_norm = torch.nn.LayerNorm(width) self.feedforward = torch.nn.Sequential( torch.nn.Linear(width, feedforward), torch.nn.GELU(), torch.nn.Dropout(dropout), torch.nn.Linear(feedforward, width), torch.nn.Dropout(dropout))
def forward(self, queries: torch.Tensor, memory: torch.Tensor) -> torch.Tensor: normalized_queries = self.query_norm(queries) routed, _ = self.attention(normalized_queries, self.memory_norm(memory), self.memory_norm(memory), need_weights=False) queries = queries + self.attention_dropout(routed) return queries + self.feedforward(self.feedforward_norm(queries))
class JointSchemaHead(torch.nn.Module): """One logit per allowed option for every question of a record, read from the backbone's final hidden states."""
def __init__(self, hidden_size: int, width: int, routing_layers: int, layers: int, heads: int, feedforward: int, dropout: float = 0.0) -> None: super().__init__() self.hidden_norm = torch.nn.LayerNorm(hidden_size) self.memory_projection = torch.nn.Linear(hidden_size, width, bias=False) self.question_projection = torch.nn.Linear(hidden_size, width, bias=False) self.option_question_projection = torch.nn.Linear(hidden_size, width, bias=False) self.global_projection = torch.nn.Linear(hidden_size, width, bias=False) self.option_context_projection = torch.nn.Linear(hidden_size, width, bias=False) self.option_lexical_projection = torch.nn.Linear(hidden_size, width, bias=False) self.type_embedding = torch.nn.Embedding(3, width) self.evidence_layers = torch.nn.ModuleList( [EvidenceRoutingLayer(width=width, heads=heads, feedforward=feedforward, dropout=dropout) for _ in range(routing_layers)]) self.option_summary_norm = torch.nn.LayerNorm(width) self.layers = torch.nn.ModuleList( [torch.nn.TransformerDecoderLayer(d_model=width, nhead=heads, dim_feedforward=feedforward, dropout=dropout, activation="gelu", batch_first=True, norm_first=True) for _ in range(layers)]) self.field_norm = torch.nn.LayerNorm(width) self.option_norm = torch.nn.LayerNorm(width) self.residual_scorer = torch.nn.Sequential( torch.nn.Linear(width * 4, width), torch.nn.GELU(), torch.nn.Dropout(dropout), torch.nn.Linear(width, 1)) # 1-element vectors, not 0-dim as in Clef: FSDP2 cannot shard 0-dim parameters. The load hook reshapes # Clef's 0-dim tensors, so joint_head.safetensors still loads with strict=True. self.prior_logit_scale = torch.nn.Parameter(torch.zeros(1)) self.joint_logit_scale = torch.nn.Parameter(torch.zeros(1)) self.residual_gate = torch.nn.Parameter(torch.zeros(1)) self.register_load_state_dict_pre_hook(_scalars_as_vectors)
@staticmethod def _mean_span(values: torch.Tensor, span: tuple[int, int]) -> torch.Tensor: start, end = span return values[start:end].mean(dim=0)
def forward(self, hidden_states: torch.Tensor, input_ids: torch.Tensor, attention_mask: torch.Tensor, records: list[EncodedRecord], output_embedding_weight: torch.Tensor) -> list[list[torch.Tensor]]: results: list[list[torch.Tensor]] = [] normalized_hidden = self.hidden_norm(hidden_states) for batch_index, record in enumerate(records): sequence_length = int(attention_mask[batch_index].sum().item()) sequence_hidden = normalized_hidden[batch_index, :sequence_length] memory = self.memory_projection(sequence_hidden).unsqueeze(0) global_vector = sequence_hidden[-1] question_vectors = torch.stack([self._mean_span(sequence_hidden, q.question_span) for q in record.questions]) type_ids = torch.tensor([q.question_type for q in record.questions], device=hidden_states.device) option_contexts, lexical_options, option_counts = [], [], [] for question in record.questions: option_contexts.append(torch.stack([self._mean_span(sequence_hidden, s) for s in question.option_spans])) lexical_options.append(torch.stack([ output_embedding_weight[input_ids[batch_index, start:end]].to(sequence_hidden.dtype).mean(dim=0) for start, end in question.option_spans])) option_counts.append(len(question.option_spans))
option_queries = [ self.option_context_projection(context) + self.option_lexical_projection(lexical) + self.option_question_projection(question_vectors[index]).unsqueeze(0) for index, (context, lexical) in enumerate(zip(option_contexts, lexical_options))] routed_options = torch.cat(option_queries, dim=0).unsqueeze(0) for layer in self.evidence_layers: routed_options = layer(routed_options, memory) split_options = list(torch.split(routed_options[0], option_counts, dim=0))
base_fields = self.question_projection(question_vectors) option_summaries = [] for field, options in zip(base_fields, split_options): routing_weights = torch.softmax(torch.matmul(options, field) / math.sqrt(options.shape[-1]), dim=0) option_summaries.append(torch.sum(routing_weights.unsqueeze(-1) * options, dim=0)) fields = (base_fields + self.option_summary_norm(torch.stack(option_summaries)) + self.global_projection(global_vector).unsqueeze(0) + self.type_embedding(type_ids)) fields = fields.unsqueeze(0) for layer in self.layers: fields = layer(fields, memory) fields = self.field_norm(fields[0])
record_logits: list[torch.Tensor] = [] for field, lexical, routed in zip(fields, lexical_options, split_options): anchor = F.normalize(question_vectors[len(record_logits)] + global_vector, dim=-1) prior_scale = self.prior_logit_scale.clamp(max=math.log(100.0)).exp() prior = prior_scale * torch.matmul(F.normalize(lexical, dim=-1), anchor) options = self.option_norm(routed) repeated_field = field.unsqueeze(0).expand_as(options) cosine = F.cosine_similarity(repeated_field, options, dim=-1) features = torch.cat([repeated_field, options, repeated_field * options, torch.abs(repeated_field - options)], dim=-1) residual = self.residual_scorer(features).squeeze(-1) joint_scale = self.joint_logit_scale.clamp(max=math.log(100.0)).exp() record_logits.append(prior + torch.sigmoid(self.residual_gate) * (joint_scale * cosine + residual)) results.append(record_logits) return results
def build_head(hidden_size: int, **overrides) -> JointSchemaHead: """A random-weight head with Clef's sizes (FP32). `overrides` change sizes, for example in tests.""" return JointSchemaHead(hidden_size=hidden_size, **{**CLEF_HEAD, **overrides})
# --- the standalone model ---
INPUT_CAST_MODULES = ("Qwen3_5DecoderLayer", "Qwen3_5VisionBlock") # the FSDP2 units of the evaluation
def _cast_float(dtype: torch.dtype, x: Any) -> Any: """torch.distributed.fsdp._fully_shard._fsdp_common._cast_fp_tensor (torch 2.6).""" if not isinstance(x, torch.Tensor) or not torch.is_floating_point(x) or x.dtype == dtype: return x return x.to(dtype)
def _cast_inputs(module: torch.nn.Module, args: tuple, kwargs: dict) -> tuple[tuple, dict]: dtype = next((p.dtype for p in module.parameters() if p.is_floating_point()), None) if dtype is None: return args, kwargs cast = functools.partial(_cast_float, dtype) return tree_map(cast, args), tree_map(cast, kwargs)
def register_input_casts(model: torch.nn.Module) -> int: """The input cast of the evaluation (module docstring) on every decoder layer and vision block; returns the number of modules.""" blocks = [m for m in model.modules() if type(m).__name__ in INPUT_CAST_MODULES] for m in blocks: m.register_forward_pre_hook(_cast_inputs, with_kwargs=True) return len(blocks)
class MantaForDecision(Qwen3_5PreTrainedModel): """The Qwen3.5 backbone (model, lm_head) with the merged MANTA weights + the joint schema head (head)."""
config_class = MantaConfig config: MantaConfig _no_split_modules = ["Qwen3_5DecoderLayer", "Qwen3_5VisionBlock", "JointSchemaHead"] _keys_to_ignore_on_load_unexpected = [r"^mtp.*"]
def __init__(self, config: MantaConfig) -> None: super().__init__(config) self.model = Qwen3_5Model(config) self.lm_head = torch.nn.Linear(config.text_config.hidden_size, config.text_config.vocab_size, bias=False) sizes = {**CLEF_HEAD, **(config.head or {})} self.head = JointSchemaHead(hidden_size=config.text_config.hidden_size, **{k: sizes[k] for k in ("width", "routing_layers", "layers", "heads", "feedforward")}) self.input_casts = register_input_casts(self) self.post_init()
def get_input_embeddings(self): return self.model.get_input_embeddings()
def set_input_embeddings(self, value): self.model.set_input_embeddings(value)
def get_output_embeddings(self): return self.lm_head
def forward(self, input_ids: torch.Tensor, attention_mask: torch.Tensor, records: list, pixel_values: torch.Tensor | None = None, image_grid_thw: torch.Tensor | None = None, mm_token_type_ids: torch.Tensor | None = None, pixel_values_videos: torch.Tensor | None = None, video_grid_thw: torch.Tensor | None = None, **kwargs) -> list[list[torch.Tensor]]: """Per request (records: manta.prompt.EncodedRecord, in batch order) and per question: one logit per option. The inputs come from manta.prompt.collate_records (input_ids, attention_mask, records, media).""" media = {"pixel_values": pixel_values, "image_grid_thw": image_grid_thw, "mm_token_type_ids": mm_token_type_ids, "pixel_values_videos": pixel_values_videos, "video_grid_thw": video_grid_thw} media = {k: v.to(self.dtype) if k.startswith("pixel_values") else v for k, v in media.items() if v is not None} text_model = self.model if media else self.model.language_model # text only: skip the vision tower hidden = text_model(input_ids=input_ids, attention_mask=attention_mask, use_cache=False, return_dict=True, **media).last_hidden_state weight = self.head.hidden_norm.weight return self.head(hidden.to(device=weight.device, dtype=weight.dtype), input_ids.to(weight.device), attention_mask.to(weight.device), records, self.lm_head.weight.to(weight.device))
__all__ = ["MantaForDecision", "JointSchemaHead"]123456789101112131415161718192021{ "size": { "longest_edge": 16777216, "shortest_edge": 65536 }, "patch_size": 16, "temporal_patch_size": 2, "merge_size": 2, "image_mean": [ 0.5, 0.5, 0.5 ], "image_std": [ 0.5, 0.5, 0.5 ], "processor_class": "Qwen3VLProcessor", "image_processor_type": "Qwen2VLImageProcessorFast"}1234567891011121314151617181920# MANTA-4B: the package versions of the published evaluation (uv.lock of the training code,# commit 7cf2c6a; config.json "environment"). Python 3.12, Linux, NVIDIA GPU (sm_80 or newer).# pip install -r requirements.txt# CUDA 12.4 builds of torch and torchvision:--extra-index-url https://download.pytorch.org/whl/cu124torch==2.6.0torchvision==0.21.0transformers==5.19.0peft==0.21.2accelerate==1.15.0safetensors==0.8.0huggingface-hub==2.2.0tokenizers==0.23.3pillow==12.2.0numpy==2.2.6# The Gated DeltaNet kernel of the evaluation (transformers uses it when it is installed):flash-linear-attention==0.4.2fla-core==0.4.2einops==0.8.2# Do not install causal-conv1d: the evaluation used the PyTorch conv1d of transformers.123version https://git-lfs.github.com/spec/v1oid sha256:5f9e4d4901a92b997e463c1f46055088b6cca5ca61a6522d1b9f64c4bb81cb42size 12807982123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305{ "add_prefix_space": false, "added_tokens_decoder": { "248044": { "content": "<|endoftext|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248045": { "content": "<|im_start|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248046": { "content": "<|im_end|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248047": { "content": "<|object_ref_start|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248048": { "content": "<|object_ref_end|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248049": { "content": "<|box_start|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248050": { "content": "<|box_end|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248051": { "content": "<|quad_start|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248052": { "content": "<|quad_end|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248053": { "content": "<|vision_start|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248054": { "content": "<|vision_end|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248055": { "content": "<|vision_pad|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248056": { "content": "<|image_pad|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248057": { "content": "<|video_pad|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248058": { "content": "<tool_call>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "248059": { "content": "</tool_call>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "248060": { "content": "<|fim_prefix|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "248061": { "content": "<|fim_middle|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "248062": { "content": "<|fim_suffix|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "248063": { "content": "<|fim_pad|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "248064": { "content": "<|repo_name|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "248065": { "content": "<|file_sep|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "248066": { "content": "<tool_response>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "248067": { "content": "</tool_response>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "248068": { "content": "<think>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "248069": { "content": "</think>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "248070": { "content": "<|audio_start|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248071": { "content": "<|audio_end|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248072": { "content": "<tts_pad>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248073": { "content": "<tts_text_bos>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248074": { "content": "<tts_text_eod>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248075": { "content": "<tts_text_bos_single>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "248076": { "content": "<|audio_pad|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true } }, "additional_special_tokens": [ "<|im_start|>", "<|im_end|>", "<|object_ref_start|>", "<|object_ref_end|>", "<|box_start|>", "<|box_end|>", "<|quad_start|>", "<|quad_end|>", "<|vision_start|>", "<|vision_end|>", "<|vision_pad|>", "<|image_pad|>", "<|video_pad|>" ], "bos_token": null, "chat_template": "{%- set image_count = namespace(value=0) %}\n{%- set video_count = namespace(value=0) %}\n{%- macro render_content(content, do_vision_count, is_system_content=false) %}\n {%- if content is string %}\n {{- content }}\n {%- elif content is iterable and content is not mapping %}\n {%- for item in content %}\n {%- if 'image' in item or 'image_url' in item or item.type == 'image' %}\n {%- if is_system_content %}\n {{- raise_exception('System message cannot contain images.') }}\n {%- endif %}\n {%- if do_vision_count %}\n {%- set image_count.value = image_count.value + 1 %}\n {%- endif %}\n {%- if add_vision_id %}\n {{- 'Picture ' ~ image_count.value ~ ': ' }}\n {%- endif %}\n {{- '<|vision_start|><|image_pad|><|vision_end|>' }}\n {%- elif 'video' in item or item.type == 'video' %}\n {%- if is_system_content %}\n {{- raise_exception('System message cannot contain videos.') }}\n {%- endif %}\n {%- if do_vision_count %}\n {%- set video_count.value = video_count.value + 1 %}\n {%- endif %}\n {%- if add_vision_id %}\n {{- 'Video ' ~ video_count.value ~ ': ' }}\n {%- endif %}\n {{- '<|vision_start|><|video_pad|><|vision_end|>' }}\n {%- elif 'text' in item %}\n {{- item.text }}\n {%- else %}\n {{- raise_exception('Unexpected item type in content.') }}\n {%- endif %}\n {%- endfor %}\n {%- elif content is none or content is undefined %}\n {{- '' }}\n {%- else %}\n {{- raise_exception('Unexpected content type.') }}\n {%- endif %}\n{%- endmacro %}\n{%- if not messages %}\n {{- raise_exception('No messages provided.') }}\n{%- endif %}\n{%- if tools and tools is iterable and tools is not mapping %}\n {{- '<|im_start|>system\\n' }}\n {{- \"# Tools\\n\\nYou have access to the following functions:\\n\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\" }}\n {{- '\\n\\nIf you choose to call a function ONLY reply in the following format with NO suffix:\\n\\n<tool_call>\\n<function=example_function_name>\\n<parameter=example_parameter_1>\\nvalue_1\\n</parameter>\\n<parameter=example_parameter_2>\\nThis is the value for the second parameter\\nthat can span\\nmultiple lines\\n</parameter>\\n</function>\\n</tool_call>\\n\\n<IMPORTANT>\\nReminder:\\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\\n- Required parameters MUST be specified\\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\\n</IMPORTANT>' }}\n {%- if messages[0].role == 'system' %}\n {%- set content = render_content(messages[0].content, false, true)|trim %}\n {%- if content %}\n {{- '\\n\\n' + content }}\n {%- endif %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n{%- else %}\n {%- if messages[0].role == 'system' %}\n {%- set content = render_content(messages[0].content, false, true)|trim %}\n {{- '<|im_start|>system\\n' + content + '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}\n{%- for message in messages[::-1] %}\n {%- set index = (messages|length - 1) - loop.index0 %}\n {%- if ns.multi_step_tool and message.role == \"user\" %}\n {%- set content = render_content(message.content, false)|trim %}\n {%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}\n {%- set ns.multi_step_tool = false %}\n {%- set ns.last_query_index = index %}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if ns.multi_step_tool %}\n {{- raise_exception('No user query found in messages.') }}\n{%- endif %}\n{%- for message in messages %}\n {%- set content = render_content(message.content, true)|trim %}\n {%- if message.role == \"system\" %}\n {%- if not loop.first %}\n {{- raise_exception('System message must be at the beginning.') }}\n {%- endif %}\n {%- elif message.role == \"user\" %}\n {{- '<|im_start|>' + message.role + '\\n' + content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {%- set reasoning_content = '' %}\n {%- if message.reasoning_content is string %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- else %}\n {%- if '</think>' in content %}\n {%- set reasoning_content = content.split('</think>')[0].rstrip('\\n').split('<think>')[-1].lstrip('\\n') %}\n {%- set content = content.split('</think>')[-1].lstrip('\\n') %}\n {%- endif %}\n {%- endif %}\n {%- set reasoning_content = reasoning_content|trim %}\n {%- if loop.index0 > ns.last_query_index %}\n {{- '<|im_start|>' + message.role + '\\n<think>\\n' + reasoning_content + '\\n</think>\\n\\n' + content }}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}\n {%- for tool_call in message.tool_calls %}\n {%- if tool_call.function is defined %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {%- if loop.first %}\n {%- if content|trim %}\n {{- '\\n\\n<tool_call>\\n<function=' + tool_call.name + '>\\n' }}\n {%- else %}\n {{- '<tool_call>\\n<function=' + tool_call.name + '>\\n' }}\n {%- endif %}\n {%- else %}\n {{- '\\n<tool_call>\\n<function=' + tool_call.name + '>\\n' }}\n {%- endif %}\n {%- if tool_call.arguments is defined %}\n {%- for args_name, args_value in tool_call.arguments|items %}\n {{- '<parameter=' + args_name + '>\\n' }}\n {%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}\n {{- args_value }}\n {{- '\\n</parameter>\\n' }}\n {%- endfor %}\n {%- endif %}\n {{- '</function>\\n</tool_call>' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.previtem and loop.previtem.role != \"tool\" %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- content }}\n {{- '\\n</tool_response>' }}\n {%- if not loop.last and loop.nextitem.role != \"tool\" %}\n {{- '<|im_end|>\\n' }}\n {%- elif loop.last %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- else %}\n {{- raise_exception('Unexpected message role.') }}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n {%- if enable_thinking is defined and enable_thinking is false %}\n {{- '<think>\\n\\n</think>\\n\\n' }}\n {%- else %}\n {{- '<think>\\n' }}\n {%- endif %}\n{%- endif %}", "clean_up_tokenization_spaces": false, "eos_token": "<|im_end|>", "errors": "replace", "model_max_length": 262144, "pad_token": "<|endoftext|>", "split_special_tokens": false, "tokenizer_class": "Qwen2Tokenizer", "unk_token": null, "add_bos_token": false, "pretokenize_regex": "(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\\r\\n\\p{L}\\p{N}]?[\\p{L}\\p{M}]+|\\p{N}| ?[^\\s\\p{L}\\p{M}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+", "extra_special_tokens": { "audio_bos_token": "<|audio_start|>", "audio_eos_token": "<|audio_end|>", "audio_token": "<|audio_pad|>", "image_token": "<|image_pad|>", "video_token": "<|video_pad|>", "vision_bos_token": "<|vision_start|>", "vision_eos_token": "<|vision_end|>" }}123456789101112131415161718192021{ "size": { "longest_edge": 25165824, "shortest_edge": 4096 }, "patch_size": 16, "temporal_patch_size": 2, "merge_size": 2, "image_mean": [ 0.5, 0.5, 0.5 ], "image_std": [ 0.5, 0.5, 0.5 ], "processor_class": "Qwen3VLProcessor", "video_processor_type": "Qwen3VLVideoProcessor"}.gitattributesAdded+38
LICENSEAdded+201
LICENSE_base_modelAdded+202
README.mdAdded+920
SHA256SUMSAdded+35
assets/accuracy_latency.pngAdded

Large File Pointer Details
- SHA256: b0f1c8afd4454d5b950b0a38d0803b30d7f050b24cdf956af2ecca59c5360533
- Pointer size: 131 Bytes
- Size of remote file: 291 kB
assets/examples/cadica.jpgAdded

assets/examples/gastrovision.jpgAdded

assets/examples/grazpedwri_dx.jpgAdded

assets/examples/olives.jpgAdded

assets/manta_logo_cropped.pngAdded

Large File Pointer Details
- SHA256: 0780db737deaa18f51148e971b9d2aa7a3a19d3c151a6072b442c03009872e77
- Pointer size: 131 Bytes
- Size of remote file: 119 kB
chat_template.jinjaAdded+154
config.jsonAdded+195
configuration_manta.pyAdded+27
example.pyAdded+44
examples/image_request.jsonAdded+43
examples/text_request.jsonAdded+30
manta/__init__.pyAdded+29
manta/head.pyAdded+191
manta/images.pyAdded+51
manta/lora.pyAdded+53
manta/model.pyAdded+244
manta/prompt.pyAdded+198
manta/records.pyAdded+153
manta/request.pyAdded+128
merges.txtAdded
model-00001-of-00003.safetensorsAdded+3
model-00002-of-00003.safetensorsAdded+3
model-00003-of-00003.safetensorsAdded+3
model.safetensors.index.jsonAdded+855
modeling_manta.pyAdded+251
preprocessor_config.jsonAdded+21
requirements.txtAdded+20
tokenizer.jsonAdded+3
tokenizer_config.jsonAdded+305
video_preprocessor_config.jsonAdded+21
vocab.jsonAdded