votum 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- votum-0.1.0/LICENSE +201 -0
- votum-0.1.0/NOTICE +28 -0
- votum-0.1.0/PKG-INFO +362 -0
- votum-0.1.0/README.md +337 -0
- votum-0.1.0/pyproject.toml +40 -0
- votum-0.1.0/setup.cfg +4 -0
- votum-0.1.0/src/votum/__init__.py +12 -0
- votum-0.1.0/src/votum/build.py +135 -0
- votum-0.1.0/src/votum/cli.py +48 -0
- votum-0.1.0/src/votum/config.py +40 -0
- votum-0.1.0/src/votum/fp8.py +155 -0
- votum-0.1.0/src/votum/modeling.py +265 -0
- votum-0.1.0/src/votum/prompt.py +199 -0
- votum-0.1.0/src/votum/request.py +172 -0
- votum-0.1.0/src/votum/vision.py +339 -0
- votum-0.1.0/src/votum/vllm/__init__.py +15 -0
- votum-0.1.0/src/votum/vllm/client.py +174 -0
- votum-0.1.0/src/votum/vllm/isolate.py +422 -0
- votum-0.1.0/src/votum/vllm/model.py +130 -0
- votum-0.1.0/src/votum/vllm/server.py +167 -0
- votum-0.1.0/src/votum.egg-info/PKG-INFO +362 -0
- votum-0.1.0/src/votum.egg-info/SOURCES.txt +34 -0
- votum-0.1.0/src/votum.egg-info/dependency_links.txt +1 -0
- votum-0.1.0/src/votum.egg-info/entry_points.txt +5 -0
- votum-0.1.0/src/votum.egg-info/requires.txt +17 -0
- votum-0.1.0/src/votum.egg-info/top_level.txt +1 -0
- votum-0.1.0/tests/test_data_clean.py +562 -0
- votum-0.1.0/tests/test_fp8.py +84 -0
- votum-0.1.0/tests/test_gpu_smoke.py +62 -0
- votum-0.1.0/tests/test_gpu_smoke_fp8.py +48 -0
- votum-0.1.0/tests/test_masks.py +104 -0
- votum-0.1.0/tests/test_prompt.py +66 -0
- votum-0.1.0/tests/test_request.py +30 -0
- votum-0.1.0/tests/test_server.py +64 -0
- votum-0.1.0/tests/test_training_kit.py +128 -0
- votum-0.1.0/tests/test_vision.py +231 -0
votum-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
votum-0.1.0/NOTICE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Votum
|
|
2
|
+
Copyright 2026 Claudio Vieira
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (see LICENSE).
|
|
5
|
+
|
|
6
|
+
Votum is a decision model fine-tuned from swiss-ai/Apertus-v1.5-8B (Apertus 1.5, Swiss AI Initiative). The base model is
|
|
7
|
+
distributed under the Apache License 2.0 and the Apertus Acceptable Use Policy v1.5
|
|
8
|
+
(https://github.com/swiss-ai/apertus-legal/blob/main/apertus_1.5/USAGE_POLICY.pdf); anyone who uses or redistributes Votum
|
|
9
|
+
with the base model is bound by that policy. Votum is not affiliated with or endorsed by the Swiss AI Initiative,
|
|
10
|
+
EPFL, ETH Zurich or CSCS.
|
|
11
|
+
|
|
12
|
+
This software contains code derived from the following projects:
|
|
13
|
+
|
|
14
|
+
- jeff-serve (https://github.com/j-geuter/Jeff, formerly j-geuter/jeff-serve), Apache License 2.0.
|
|
15
|
+
Copyright 2026 Jonathan Geuter, Andrew Cheng, David Alvarez-Melis.
|
|
16
|
+
src/votum/request.py converts TypeSafe questions to options the way jeff's typesafe.py does (which follows
|
|
17
|
+
JevBench's semif_direct adapter, https://github.com/fstandhartinger/jevbench, MIT License).
|
|
18
|
+
- Apertus 1.5 image tokenizer, Apache License 2.0: src/votum/vision.py is a standalone copy of the image tokenizer's
|
|
19
|
+
encoder and image processor from the Swiss AI Initiative's transformers (Apertus1p5VisionTokenizerModel,
|
|
20
|
+
Apertus1p5ImageProcessor; https://github.com/swiss-ai/transformers).
|
|
21
|
+
|
|
22
|
+
Test images (tests/fixtures/images, also shown in assets/examples_vision*.png):
|
|
23
|
+
|
|
24
|
+
- wreck.jpg, market.jpg, airplane.jpg, railyard.jpg: historical photographs from the Flickr Commons, licensed "no known
|
|
25
|
+
copyright restrictions" (https://flickr.com/commons/usage/), from the COCO 2017 test set (images 499685, 444112,
|
|
26
|
+
517361, 383758).
|
|
27
|
+
- coffee.jpg: photograph by Rachel Michetti, dedicated to the public domain (CC0), from the scikit-image sample data.
|
|
28
|
+
- reminder.png: made for this repository.
|
votum-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: votum
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Votum: a single-pass decision model on Apertus-1.5-8B (probabilities over the options of a question, no generation)
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
Requires-Python: >=3.11
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
License-File: NOTICE
|
|
10
|
+
Requires-Dist: torch>=2.5
|
|
11
|
+
Requires-Dist: transformers>=4.56
|
|
12
|
+
Requires-Dist: peft>=0.17
|
|
13
|
+
Requires-Dist: safetensors>=0.4
|
|
14
|
+
Requires-Dist: huggingface_hub>=0.34
|
|
15
|
+
Provides-Extra: vllm
|
|
16
|
+
Requires-Dist: vllm==0.33.0; extra == "vllm"
|
|
17
|
+
Requires-Dist: fastapi>=0.110; extra == "vllm"
|
|
18
|
+
Requires-Dist: uvicorn>=0.29; extra == "vllm"
|
|
19
|
+
Provides-Extra: vision
|
|
20
|
+
Requires-Dist: pillow>=10; extra == "vision"
|
|
21
|
+
Requires-Dist: torchvision>=0.20; extra == "vision"
|
|
22
|
+
Provides-Extra: test
|
|
23
|
+
Requires-Dist: pytest>=8; extra == "test"
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
<h1 align="center">votum</h1>
|
|
27
|
+
|
|
28
|
+
<p align="center"><b>A decision model on a fully open LLM backbone.</b></p>
|
|
29
|
+
|
|
30
|
+
<p align="center">
|
|
31
|
+
<a href="https://huggingface.co/votum-ai/Votum-8B"><img alt="Model: Votum-8B on Hugging Face" src="https://img.shields.io/badge/model-Votum--8B-DA291C?logo=huggingface&logoColor=white"></a>
|
|
32
|
+
<a href="https://huggingface.co/datasets/votum-ai/Votum-Pool"><img alt="Training data: Votum-Pool on Hugging Face" src="https://img.shields.io/badge/data-Votum--Pool-DA291C?logo=huggingface&logoColor=white"></a>
|
|
33
|
+
<img alt="Python 3.11 or newer" src="https://img.shields.io/badge/python-3.11%2B-1D1D1F">
|
|
34
|
+
<img alt="License: Apache-2.0" src="https://img.shields.io/badge/license-Apache--2.0-1D1D1F">
|
|
35
|
+
</p>
|
|
36
|
+
|
|
37
|
+
<p align="center">
|
|
38
|
+
<a href="#quickstart">Quickstart</a> ·
|
|
39
|
+
<a href="#request-and-response">Request and response</a> ·
|
|
40
|
+
<a href="#images">Images</a> ·
|
|
41
|
+
<a href="#run-it-as-a-server">Server</a> ·
|
|
42
|
+
<a href="#speed">Speed</a> ·
|
|
43
|
+
<a href="#fine-tuning">Fine-tuning</a> ·
|
|
44
|
+
<a href="#documentation">Documentation</a>
|
|
45
|
+
</p>
|
|
46
|
+
|
|
47
|
+
**Votum** turns <img src="https://raw.githubusercontent.com/hypathia/votum/cd0a1f8960bf2824d46b593ea2ef4a19d4233f95/assets/flag.svg" width="14" height="14" alt="Swiss flag"> [Apertus-1.5-8B](https://huggingface.co/swiss-ai/Apertus-v1.5-8B)
|
|
48
|
+
into a decision model. You give it some context (an email, a document, a JSON record, a photo), a question about it and
|
|
49
|
+
the possible answers. It gives back a probability for each answer.
|
|
50
|
+
|
|
51
|
+
It does not write text. It reads the prompt once and scores the answers, so a short decision takes under 100 ms,
|
|
52
|
+
the result is always one of your options, and the probabilities always sum to one.
|
|
53
|
+
|
|
54
|
+
<picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/hypathia/votum/cd0a1f8960bf2824d46b593ea2ef4a19d4233f95/assets/examples_dark.png"><img src="https://raw.githubusercontent.com/hypathia/votum/cd0a1f8960bf2824d46b593ea2ef4a19d4233f95/assets/examples.png" alt="Four requests answered by Votum-8B. An email about a double charge: team is Billing and payments (0.96), the customer asks for money back (0.90), urgency is medium (0.41). A JSON order record: the total is 65.0 (0.73), no discount was applied (0.91). A photo of a derailed locomotive: a locomotive derailed (0.46), people are at the scene (0.76), the damage is serious (0.47). A photo of a market in front of a church: a street market (0.76), fruit or vegetables are for sale (0.79), the large building is a church (0.79)."></picture>
|
|
55
|
+
|
|
56
|
+
The open weights and the open dataset are on Hugging Face: [Votum-8B](https://huggingface.co/votum-ai/Votum-8B),
|
|
57
|
+
[Votum-8B-FP8](https://huggingface.co/votum-ai/Votum-8B-FP8) (smaller) and the training data,
|
|
58
|
+
[Votum-Pool](https://huggingface.co/datasets/votum-ai/Votum-Pool). This repository holds the code.
|
|
59
|
+
|
|
60
|
+
## Quickstart
|
|
61
|
+
|
|
62
|
+
Requirements: Python 3.11 or newer and an NVIDIA GPU.
|
|
63
|
+
|
|
64
|
+
| GPU memory | Model | Notes |
|
|
65
|
+
|---|---|---|
|
|
66
|
+
| 24 GB or more | [votum-ai/Votum-8B](https://huggingface.co/votum-ai/Votum-8B) | the full model, a 16 GB download |
|
|
67
|
+
| 16 GB | [votum-ai/Votum-8B-FP8](https://huggingface.co/votum-ai/Votum-8B-FP8) | FP8-quantized weights, a 9 GB download; it gives the same answer as the full model 96 to 99 % of the time |
|
|
68
|
+
|
|
69
|
+
**1. Install the package.**
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pip install votum
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**2. Get access to the model.** The model is gated: accept the Apertus Acceptable Use Policy on
|
|
76
|
+
[votum-ai/Votum-8B](https://huggingface.co/votum-ai/Votum-8B), then log in:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
hf auth login
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**3. Run a request.** The email from the figure above, with its three questions:
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
from votum import Votum
|
|
86
|
+
|
|
87
|
+
# On a 16 GB GPU, use "votum-ai/Votum-8B-FP8" instead.
|
|
88
|
+
vm = Votum.from_pretrained("votum-ai/Votum-8B")
|
|
89
|
+
|
|
90
|
+
request = {
|
|
91
|
+
"state": "Hi, I was charged twice for my October invoice (INV-4411). Could you refund one of the two payments?",
|
|
92
|
+
"questions": {
|
|
93
|
+
"team": {
|
|
94
|
+
"type": "choice",
|
|
95
|
+
"instructions": "Which team should handle this ticket?",
|
|
96
|
+
"criteria": {
|
|
97
|
+
"billing": "Billing and payments",
|
|
98
|
+
"tech": "Technical support",
|
|
99
|
+
"sales": "Sales",
|
|
100
|
+
"hr": "Human resources",
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
"refund": {
|
|
104
|
+
"type": "noul",
|
|
105
|
+
"instructions": "Does the customer ask for money back?",
|
|
106
|
+
},
|
|
107
|
+
"urgency": {
|
|
108
|
+
"type": "score",
|
|
109
|
+
"instructions": "How urgent is this ticket?",
|
|
110
|
+
"criteria": ["low", "medium", "high"],
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
out = vm.decide(request)
|
|
116
|
+
|
|
117
|
+
print(out["answers"])
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
{
|
|
122
|
+
"team": {
|
|
123
|
+
"type": "choice",
|
|
124
|
+
"choice": "billing",
|
|
125
|
+
"confidence": 0.9619,
|
|
126
|
+
"probabilities": {
|
|
127
|
+
"billing": 0.9619,
|
|
128
|
+
"tech": 0.0079,
|
|
129
|
+
"sales": 0.0243,
|
|
130
|
+
"hr": 0.0059,
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
"refund": {
|
|
134
|
+
"type": "noul",
|
|
135
|
+
"noul": 0.8994,
|
|
136
|
+
},
|
|
137
|
+
"urgency": {
|
|
138
|
+
"type": "score",
|
|
139
|
+
"score": 0.9621,
|
|
140
|
+
"confidence": 0.4133,
|
|
141
|
+
"legend": {
|
|
142
|
+
"0": "low",
|
|
143
|
+
"1": "medium",
|
|
144
|
+
"2": "high",
|
|
145
|
+
},
|
|
146
|
+
"probabilities": {
|
|
147
|
+
"0": 0.3123,
|
|
148
|
+
"1": 0.4133,
|
|
149
|
+
"2": 0.2744,
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Votum returns probabilities, not just a label, so high-confidence answers can be acted on and the rest escalated.
|
|
156
|
+
|
|
157
|
+
## Request and response
|
|
158
|
+
|
|
159
|
+
A request has two parts:
|
|
160
|
+
|
|
161
|
+
- **`state`**: the context to decide on. A string, or any JSON object.
|
|
162
|
+
- **`questions`**: up to 8 questions about that state, keyed by an id. They are answered together.
|
|
163
|
+
|
|
164
|
+
Every question has `instructions` (the question text), a `type` and, depending on the type, `criteria`:
|
|
165
|
+
|
|
166
|
+
| `type` | Use | `criteria` |
|
|
167
|
+
|---|---|---|
|
|
168
|
+
| `choice` | one of several options | the options: `{id: description}`, or a list of ids |
|
|
169
|
+
| `noul` | a yes/no question | optional: `{"true": description, "false": description}` |
|
|
170
|
+
| `score` | a rating on a scale | the levels, lowest first |
|
|
171
|
+
|
|
172
|
+
The answer to a question holds its `type` and these fields:
|
|
173
|
+
|
|
174
|
+
| Field | Returned for | Value |
|
|
175
|
+
|---|---|---|
|
|
176
|
+
| `choice` | `choice` | id of the most likely option |
|
|
177
|
+
| `noul` | `noul` | probability that the answer is yes |
|
|
178
|
+
| `score` | `score` | expected level, counting from 0 (0.96 is close to level 1, the second one) |
|
|
179
|
+
| `confidence` | `choice`, `score` | probability of the most likely option or level |
|
|
180
|
+
| `probabilities` | `choice`, `score` | probability of every option or level |
|
|
181
|
+
| `legend` | `score` | level index to level text |
|
|
182
|
+
|
|
183
|
+
Notes:
|
|
184
|
+
|
|
185
|
+
- **Option descriptions.** `{"billing": "Billing and payments"}` works better than a bare `"billing"`.
|
|
186
|
+
- **Languages.** Votum was built for English, German, French and Italian; instructions can be in the language of the
|
|
187
|
+
state or in English.
|
|
188
|
+
- **Context.** The state, one question and its options must fit in 8,192 tokens. A longer request is refused with an
|
|
189
|
+
error, never truncated.
|
|
190
|
+
- **Questions.** The architecture puts no limit on the number of questions per request: each question is scored in
|
|
191
|
+
its own pass over the shared state, so only a single question's prompt has to fit. The server accepts 64 per
|
|
192
|
+
request by default (`VOTUM_MAX_QUESTIONS`).
|
|
193
|
+
|
|
194
|
+
The request format (`noul`, `instructions`, `criteria`) is that of [Jev and Jeff](#acknowledgements), so their clients
|
|
195
|
+
work unchanged.
|
|
196
|
+
|
|
197
|
+
## Images
|
|
198
|
+
|
|
199
|
+
A state can hold images. Put one anywhere in it as `{"image": ...}`:
|
|
200
|
+
|
|
201
|
+
```python
|
|
202
|
+
request = {
|
|
203
|
+
"state": {
|
|
204
|
+
"photo": {
|
|
205
|
+
"image": "wreck.jpg",
|
|
206
|
+
},
|
|
207
|
+
"line": "mountain branch, km 41",
|
|
208
|
+
},
|
|
209
|
+
"questions": {
|
|
210
|
+
"incident": {
|
|
211
|
+
"type": "choice",
|
|
212
|
+
"instructions": "What happened?",
|
|
213
|
+
"criteria": {
|
|
214
|
+
"derailment": "A locomotive derailed",
|
|
215
|
+
"collision": "Two trains collided",
|
|
216
|
+
"fire": "A fire",
|
|
217
|
+
"none": "Nothing, normal operation",
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
out = vm.decide(request)
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
In Python, the image can be a file path (as here), raw bytes, a PIL image or a base64 string. Over HTTP it must be
|
|
227
|
+
base64-encoded, either plain or as a data URL (`"data:image/png;base64,..."`): the server never opens files or URLs
|
|
228
|
+
named in a request.
|
|
229
|
+
|
|
230
|
+
This needs two more packages: `pip install "votum[vision]"`.
|
|
231
|
+
|
|
232
|
+
Image support is a preview. Votum-8B was never trained on images: everyday photos work well, text inside scanned
|
|
233
|
+
documents does not yet. [docs/images.md](https://github.com/hypathia/votum/blob/cd0a1f8960bf2824d46b593ea2ef4a19d4233f95/docs/images.md) has more examples, the measured accuracy and the settings.
|
|
234
|
+
|
|
235
|
+
## Run it as a server
|
|
236
|
+
|
|
237
|
+
`votum serve` starts an HTTP server built on vLLM, which batches concurrent requests:
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
pip install "votum[vllm]"
|
|
241
|
+
votum serve --model votum-ai/Votum-8B --port 8011
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
curl -s localhost:8011/v1/systemone -H 'content-type: application/json' -d '{
|
|
246
|
+
"state": "The printer on floor 3 is jammed again.",
|
|
247
|
+
"questions": {
|
|
248
|
+
"team": {
|
|
249
|
+
"type": "choice",
|
|
250
|
+
"instructions": "Which team?",
|
|
251
|
+
"criteria": {
|
|
252
|
+
"it": "IT support",
|
|
253
|
+
"fac": "Facilities"
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}'
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
The endpoint takes the same request as `vm.decide` and returns the same answers. It follows Jev's System One API, so
|
|
261
|
+
Jev clients work against it. [docs/serving.md](https://github.com/hypathia/votum/blob/cd0a1f8960bf2824d46b593ea2ef4a19d4233f95/docs/serving.md) covers the API key, memory and the other settings.
|
|
262
|
+
|
|
263
|
+
## Speed
|
|
264
|
+
|
|
265
|
+
Measured on one NVIDIA RTX 4090 (24 GB) with the full Votum-8B, running as a server:
|
|
266
|
+
|
|
267
|
+
| Request | Prompt tokens | Latency | Decisions/s, many requests at once |
|
|
268
|
+
|---|---:|---:|---:|
|
|
269
|
+
| 1 question about a short text | ~450 | ~40 ms | 23.5 |
|
|
270
|
+
| 1 question about a long document | ~3,000 | ~320 ms | 3.1 |
|
|
271
|
+
| 8 questions about a long document | ~3,300 | ~470 ms | 15.8 |
|
|
272
|
+
|
|
273
|
+
Asking several questions about the same state at once is cheaper than asking them one by one, because the state is
|
|
274
|
+
read only once. With eight questions per request, the long document gives 5 times as many decisions per second as
|
|
275
|
+
with one.
|
|
276
|
+
|
|
277
|
+
For comparison, Apertus-1.5-8B generating the choice and its probabilities as structured output takes about 1.1 s for
|
|
278
|
+
the short text, against about 40 ms. [docs/benchmarks.md](https://github.com/hypathia/votum/blob/cd0a1f8960bf2824d46b593ea2ef4a19d4233f95/docs/benchmarks.md) says exactly how each number was measured.
|
|
279
|
+
|
|
280
|
+
## How good are the answers?
|
|
281
|
+
|
|
282
|
+
Accuracy on public test sets outside the training data:
|
|
283
|
+
|
|
284
|
+
| Task | Accuracy | Accuracy among the most confident half |
|
|
285
|
+
|---|---:|---:|
|
|
286
|
+
| Yes/no questions about a passage (BoolQ) | 88.9 % | 98.2 % |
|
|
287
|
+
| Topic of a text, in 12 languages (SIB-200) | 82.4 % | 97.4 % |
|
|
288
|
+
| Customer intent among 77 options (BANKING77) | 70.4 % | 85.3 % |
|
|
289
|
+
| School and university exam questions (MMLU) | 60.4 % | 82.1 % |
|
|
290
|
+
|
|
291
|
+
Accuracy is much higher on high-confidence answers, so the confidence can be used to route. The
|
|
292
|
+
[model card](https://huggingface.co/votum-ai/Votum-8B#evaluation) has the full evaluation and the
|
|
293
|
+
[limitations](https://huggingface.co/votum-ai/Votum-8B#limitations).
|
|
294
|
+
|
|
295
|
+
## How it works
|
|
296
|
+
|
|
297
|
+
Votum is Apertus-1.5-8B with a LoRA adapter (rank 16, all 32 layers), a custom attention mask and a pointer head. The
|
|
298
|
+
language-model head is not used: nothing is generated.
|
|
299
|
+
|
|
300
|
+
<picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/hypathia/votum/cd0a1f8960bf2824d46b593ea2ef4a19d4233f95/assets/architecture_dark.png"><img src="https://raw.githubusercontent.com/hypathia/votum/cd0a1f8960bf2824d46b593ea2ef4a19d4233f95/assets/architecture.png" alt="One request through the model in three panels: the prompt with header, state, questions and options; the attention mask between those blocks; the pointer-head formula z_j = <q_0, W_o LN(h_j)> / 16 with p_j = softmax(z / T)_j, and the score and probability of each option"></picture>
|
|
301
|
+
|
|
302
|
+
**1. One prompt.** A request is rendered as a single prompt: a header that lists its questions, then the state, then
|
|
303
|
+
each question with its options. Every option ends with an end token.
|
|
304
|
+
|
|
305
|
+
**2. Custom attention mask.** Eight of the 32 layers (3, 7, …, 31) attend in both directions; the other 24 are
|
|
306
|
+
causal. On top of that, a block mask isolates the parts of the prompt:
|
|
307
|
+
|
|
308
|
+
- the header does not attend to the state, and the state does not attend to the questions, so both are the same for
|
|
309
|
+
every question of a request and are computed once;
|
|
310
|
+
- an option attends to the header, the state and its own question, never to another option, and nothing outside an
|
|
311
|
+
option attends to it;
|
|
312
|
+
- all options of a question start at the same position id, so their order carries no signal.
|
|
313
|
+
|
|
314
|
+
The mask buys two things: answers that do not depend on the order of the options, and a header and state that are
|
|
315
|
+
computed once and shared by every question of a request. It costs two: options cannot be
|
|
316
|
+
weighed against each other (the model rarely picks "none of the above" when it is right), and the model only works
|
|
317
|
+
with the `votum` loader, not with plain transformers or vLLM.
|
|
318
|
+
|
|
319
|
+
**3. Pointer head.** Option *j* gets a score *z<sub>j</sub>* from the final hidden state *h<sub>j</sub>* at its end
|
|
320
|
+
token, and a softmax over the options of a question gives the probabilities *p<sub>j</sub>* (formula in the figure).
|
|
321
|
+
*q*<sub>0</sub> is a learned 256-dimensional query, *W<sub>o</sub>* a 256 × 4096 projection, LN a layer norm, and *T*
|
|
322
|
+
a temperature per question type, which can be [recalibrated](https://github.com/hypathia/votum/blob/cd0a1f8960bf2824d46b593ea2ef4a19d4233f95/training/README.md#step-4-calibrate-and-measure) on your own data.
|
|
323
|
+
|
|
324
|
+
[docs/internals.md](https://github.com/hypathia/votum/blob/cd0a1f8960bf2824d46b593ea2ef4a19d4233f95/docs/internals.md) covers the weights, the two implementations and how to reproduce the release.
|
|
325
|
+
|
|
326
|
+
## Fine-tuning
|
|
327
|
+
|
|
328
|
+
[training/README.md](https://github.com/hypathia/votum/blob/cd0a1f8960bf2824d46b593ea2ef4a19d4233f95/training/README.md) covers fine-tuning on your own data: prepare the rows, train from the released
|
|
329
|
+
model, export the checkpoint and [refit the calibration temperatures](https://github.com/hypathia/votum/blob/cd0a1f8960bf2824d46b593ea2ef4a19d4233f95/training/README.md#step-4-calibrate-and-measure). One 24 GB GPU is enough.
|
|
330
|
+
|
|
331
|
+
## Documentation
|
|
332
|
+
|
|
333
|
+
| Page | What is in it |
|
|
334
|
+
|---|---|
|
|
335
|
+
| [docs/serving.md](https://github.com/hypathia/votum/blob/cd0a1f8960bf2824d46b593ea2ef4a19d4233f95/docs/serving.md) | the HTTP server: API, API key, memory, settings |
|
|
336
|
+
| [docs/images.md](https://github.com/hypathia/votum/blob/cd0a1f8960bf2824d46b593ea2ef4a19d4233f95/docs/images.md) | images in requests: set-up, examples, accuracy |
|
|
337
|
+
| [docs/benchmarks.md](https://github.com/hypathia/votum/blob/cd0a1f8960bf2824d46b593ea2ef4a19d4233f95/docs/benchmarks.md) | speed measurements and how they were made |
|
|
338
|
+
| [docs/internals.md](https://github.com/hypathia/votum/blob/cd0a1f8960bf2824d46b593ea2ef4a19d4233f95/docs/internals.md) | how the model works inside, the repository layout, tests, reproducing the release |
|
|
339
|
+
| [training/README.md](https://github.com/hypathia/votum/blob/cd0a1f8960bf2824d46b593ea2ef4a19d4233f95/training/README.md) | fine-tuning on your own data |
|
|
340
|
+
|
|
341
|
+
## Acknowledgements
|
|
342
|
+
|
|
343
|
+
Votum builds on other people's work:
|
|
344
|
+
|
|
345
|
+
- **[Apertus](https://huggingface.co/swiss-ai/Apertus-v1.5-8B)**, by the Swiss AI Initiative (EPFL, ETH Zurich, CSCS):
|
|
346
|
+
the open model underneath Votum.
|
|
347
|
+
- **Jev**: the original decision models. Votum uses their request format (`choice`, `noul`, `score`).
|
|
348
|
+
- **[Jeff](https://github.com/j-geuter/Jeff)**, by Jonathan Geuter, Andrew Cheng and David Alvarez-Melis
|
|
349
|
+
([Releasing the Inner Jev](https://arxiv.org/abs/2610.17205)): the open recipe for turning a language model into a
|
|
350
|
+
decision model. Our evaluation was checked against their published numbers, and the code that reads requests is
|
|
351
|
+
derived from theirs (see `NOTICE`).
|
|
352
|
+
- **[JevPertus](https://huggingface.co/jaluus/jevpertus-v1.5-8B)** ([code](https://github.com/Jaluus/JevPertus)): an
|
|
353
|
+
earlier decision model built on the same Apertus-1.5-8B.
|
|
354
|
+
- **[JevBench](https://github.com/fstandhartinger/jevbench)** and the **Jev Decision Index**: independent public
|
|
355
|
+
benchmarks for decision models, on which Votum is measured.
|
|
356
|
+
|
|
357
|
+
## License
|
|
358
|
+
|
|
359
|
+
Apache-2.0 (`LICENSE`, `NOTICE`). The Apertus model underneath carries the
|
|
360
|
+
[Apertus Acceptable Use Policy](https://github.com/swiss-ai/apertus-legal/blob/main/apertus_1.5/USAGE_POLICY.pdf),
|
|
361
|
+
which applies to anyone who uses Votum. Votum is an independent project, not affiliated with or endorsed by the Swiss
|
|
362
|
+
AI Initiative.
|