What was changed
- The language-model linear layers are stored in 8 bits with bitsandbytes LLM.int8() (
load_in_8bit=True,
llm_int8_threshold=6.0, outlier columns computed in fp16). lm_head, vision_tower and embed_vision stay in
bf16 (llm_int8_skip_modules). The full settings are in quantization_config in config.json; apart from that
field, config.json is identical to the source. No weights were retrained.
- Added
torchcast_31b_int8_server.py: a serving wrapper that splits the 60 decoder layers across 2 or 3 GPUs, moves
attention masks between GPUs for the torchcast_hybrid attention, loads the vision tower and lm_head on the CPU
and then frees them (only the 26 option-letter rows of lm_head are kept), and adds dynamic micro-batching.
- Unchanged from the source:
torchcast_decision/ (with its LICENSE and NOTICE), decision_config.json
(temperatures 0.8 / 0.6 / 0.6, yes/no floor 0.801), tokenizer, chat template, LICENSE. See NOTICE for the full
list and SHA256SUMS for file hashes.
Quick start
Requirements: Python 3.12, at least two CUDA GPUs with 24 GB each (tested on RTX 3090, Ampere) and
about 32 GB of free CPU RAM while loading (peak 31.1 GiB resident, 1.8 GiB once the model is loaded). Versions this
was tested with are in requirements.txt.
pip install -r requirements.txt # torch, transformers, bitsandbytes, accelerate, safetensorshf download kazik151/torchcast-decision-31b-int8 --local-dir torchcast-decision-31b-int8cd torchcast-decision-31b-int8 && sha256sum -c SHA256SUMS CUDA_VISIBLE_DEVICES=0,1 PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True \ python torchcast_31b_int8_server.py --model . --host 127.0.0.1 --port 18011
Loading takes about 20 seconds on our machine with the files already in the OS page cache, plus however long your
disk needs to read 34 GB. The server speaks the same API as the original torchcast_decision server
(POST /v1/systemone, GET /health, GET /v1/models) plus POST /v1/systemone/batch:
curl -s localhost:18011/v1/systemone -H 'Content-Type: application/json' -d '{ "state": "Invoice #42: total due 1,200 EUR, payment within 14 days of the issue date.", "questions": { "deadline": {"type": "noul", "instructions": "Does the text mention a payment deadline?"}, "topic": {"type": "choice", "instructions": "What is this document?", "criteria": {"invoice": "An invoice", "contract": "A contract", "letter": "A private letter"}} }}'
Useful options: --max-batch-tokens (default 8192 padded tokens per forward pass; lower it if you hit out-of-memory
errors on long prompts), --max-length (prompt budget, at most 16,384 tokens; longer prompts keep the head and the
tail of the state, as in the original).
Do not load these weights with plain transformers text generation, vLLM or llama.cpp: you would lose the
bidirectional global attention and get different probabilities, exactly as with the original weights.
Agreement with the original bf16 model
Measured by us, not by the JevBench maintainers. 167 Polish public-sector web pages (text only, median 5.4k tokens,
up to 27k) with two questions each: a yes/no question (noul) and a 5-way choice. The same pages and prompts were
run through the original bf16 weights (3× RTX 3090, torchcast_decision with only the GPU placement changed) and
through this INT8 checkpoint (2× RTX 3090); the token counts of all 167 prompts match between the two runs.
Table with columns: Metric (n = 167), INT8 vs bf16| Metric (n = 167) | INT8 vs bf16 |
|---|
Same yes/no decision (noul ≥ 0.5) | 164 / 167 (98.2 %) |
| Same 5-way choice | 164 / 167 (98.2 %) |
| Mean |Δ P(yes)| | 0.016 |
| Largest |Δ P(yes)| on one page | 0.60 |
| Mean total-variation distance of the 5-way distribution | 0.024 |
Read this as "INT8 makes nearly the same decisions as bf16 on this data", not as an accuracy figure. The pages are
Polish while the model is documented for English, the sample is small, and a few borderline items can move a lot (see
the largest difference). We did not run JevBench. If you measure INT8 against bf16 on other data, please share the
numbers in the Community tab.
Speed and memory
Measured on RTX 3090 cards with this repository's files and the default settings, one request at a time, a single
yes/no question per prompt. Each length was run twice: identical probabilities, latencies within 1 %.
Table with columns: Prompt length (tokens), Latency, 2× RTX 3090, Latency, 3× RTX 3090| Prompt length (tokens) | Latency, 2× RTX 3090 | Latency, 3× RTX 3090 |
|---|
| 1,277 | 1.5 s | 1.5 s |
| 4,841 | 6.7 s | 6.6 s |
| 9,801 | 16.7 s | – |
| 16,371 (the cap; a 24k-token prompt is cut to this) | 32 s | – |
Table with columns: GPU memory (nvidia-smi), 2× RTX 3090, 3× RTX 3090| GPU memory (nvidia-smi) | 2× RTX 3090 | 3× RTX 3090 |
|---|
| After loading | 15.3 + 14.6 GiB | 10.8 + 9.5 + 9.6 GiB |
| Peak | 20.0 + 19.5 GiB (16k-token prompt) | 12.5 + 11.1 + 11.3 GiB (prompts up to 4.8k tokens) |
A third GPU lowers memory per card but does not speed things up: the layers run one GPU after another. On the
167-page evaluation above (median 5.4k tokens, two questions per page, an earlier build of the same server) the whole
run took 32 minutes, a median of 7.9 s per page.
LLM.int8() matrix multiplications are much slower than bf16 on a single large GPU, and the layers run one GPU after
the other, so expect seconds per long prompt rather than the tens of milliseconds the original reports on an H100.
Limitations
- At least two GPUs: the bundled server refuses to start on one GPU. A single 48 GB GPU should fit the 34 GB of
weights, but we have not tested it and the server would need a one-GPU layout.
- Text only, like the original 31B package (no images).
- Probabilities are close to, not identical with, the bf16 model. Repeated runs of the same requests on our machine gave
bit-identical probabilities. Requests that the server batches together can differ slightly from the same requests
sent one at a time (up to 0.011 in probability in our test, with the same decisions).
- Everything in the original card's "Intended use and limitations" applies: English text-based decision research;
probabilities can be unreliable on new domains.
Licence and attribution
Apache License 2.0 (see LICENSE), the same as the source. Model weights: Torchcast Decision 31B v1.0 by
Torchcast AI, a fine-tune of Gemma-4-31B-it by Google (Apache License 2.0,
Gemma 4 licence); quantized by kazik151. Serving package
torchcast_decision/: Torchcast AI, Apache License 2.0, bundled unmodified. torchcast_31b_int8_server.py:
Apache License 2.0. The modifications are listed in NOTICE. This repository is not affiliated with or endorsed by
Torchcast AI, Google, TypeSafe AI or the JevBench maintainers.