Website | Technical report | Contact
Themata
Themata is a typed decision model for Greek and English. A caller supplies a text, a question, and candidate descriptions, and Themata returns a calibrated probability for each candidate. It handles three decision types, which are Choice (one of several options), Noul (whether a proposition is true), and Score (ordered levels). Candidates are encoded as isolated attention branches that start at the same position, so reordering the candidates reorders the output and changes nothing else. It is built on the text backbone of Gemma 4 E4B and runs on a laptop processor through its own C++ engine.
Summary
- Accuracy is 0.854 on 26,927 held-out questions from 14 sources, against 0.700 for the stock Gemma 4 E4B prompted with answer labels. The paired difference is 15.4 points, with a 95% interval of 12.5 to 18.0.
- Log loss is 0.415 against 0.854, and calibration error is 0.006 against 0.040, both after each model's own temperature scaling.
- Answering only its most confident 73% of questions, Themata keeps 95% accuracy. The stock model keeps 95% on 10%.
- Reversing Choice candidates changed no logit in a full-model check before training, and a reversed question encodes identically. The stock model changed its answer on 18.2% of Choice questions.
- The Q6_K engine chose the GPU model's answer on all 100 held-out questions checked. With the weights of an earlier training run, it took a median of 3.4 seconds per decision on an 8-core laptop processor.
Model details
| Property | Value |
|---|---|
| Backbone | google/gemma-4-E4B-it text model, revision ee0ef602, 42 layers |
| Adaptation | LoRA rank 8 on attention projections and a shared decision head, 17,655,811 trained parameters |
| Languages | Greek (el) and English (en) |
| Decision types | Choice, Noul, and Score (up to ten levels) |
| Input | The encoder accepts up to 65,536 tokens per question. The longest test question has 8,043, and the engine was measured up to 3,954 |
| Calibration temperature | 1.105 |
| Licence | CC BY-SA 4.0 |
Files
| File | Format | Use |
|---|---|---|
themata-q6_k.gguf |
GGUF with Q6_K matrices and bfloat16 embeddings | Serving with the engine on CPU |
bf16/ |
safetensors with a bfloat16 backbone (LoRA merged) and float32 head | Reference precision with the engine |
engine/themata-score |
Compiled binary for x86-64 Linux with AVX2 | Scoring encoded questions |
engine/THIRD-PARTY-NOTICES.md |
Text | Notices of the components inside the engine |
engine/themata_encode.py |
Python | Encoding questions and decoding answers |
themata-report.pdf |
Technical report | |
LICENSE-GEMMA-APACHE-2.0.txt |
Text | Licence of the Gemma 4 E4B base model |
Evaluation
The test split holds 26,927 questions (20,084 Greek and 6,843 English), grouped so that related records never cross partitions. Calibrated values use each system's temperature fitted on a separate calibration split.
| Metric | Stock Gemma 4 E4B, raw | Stock, calibrated | Themata, raw | Themata, calibrated |
|---|---|---|---|---|
| Accuracy | 0.700 | 0.700 | 0.854 | 0.854 |
| Macro F1 | 0.714 | 0.714 | 0.844 | 0.844 |
| Log loss | 2.088 | 0.854 | 0.416 | 0.415 |
| Brier score | 0.492 | 0.381 | 0.172 | 0.172 |
| Calibration error | 0.245 | 0.040 | 0.013 | 0.006 |
Themata is ahead on every decision type, on both languages, and on 13 of the 14 sources. Without HERA, tool calling, and the two sources written for this work, it reaches 0.848 against 0.697 on the remaining 23,271 questions, a paired difference of 15.1 points with a 95% interval of 11.6 to 18.0. Per-source results, accuracy by number of candidates, and the engine checks are in the technical report.
Usage
The engine runs on x86-64 Linux with AVX2, FMA, and F16C. It needs glibc 2.38
or later, libstdc++, and libgomp. Its SHA-256 is
ba92400092d4f9999a7860eae798ecb5c418cabd87add55202f01160cdd506fd.
Write one question per line.
{"id": "t1", "task_type": "choice", "state": "Η παραγγελία μου ήρθε σπασμένη και θέλω τα χρήματά μου πίσω.", "instructions": "What does the customer want?", "candidates": [{"key": "refund", "description": "A refund of the payment."}, {"key": "replacement", "description": "A replacement item."}, {"key": "info", "description": "Information about the order."}]}
task_type is choice, noul (two candidates with keys false and true),
or score (levels ordered from lowest to highest). Then encode, score, and
decode.
pip install transformers # only for the Gemma tokenizer
chmod +x engine/themata-score
python engine/themata_encode.py encode questions.jsonl > requests.jsonl
engine/themata-score themata-q6_k.gguf 8 < requests.jsonl > results.jsonl
python engine/themata_encode.py decode questions.jsonl results.jsonl
decode prints calibrated probabilities by candidate key, the answer, and for
Score the expected level. engine/themata-score bf16 8 bf16 runs the bfloat16
weights instead.
Training data
The training split holds 215,717 questions from 12 published Greek and English datasets (ArgKP-2021-GR, MASSIVE, GoEmotions, AgoraSpeech, Greek Legal Code, HERA, Aikia offensive, GreekReddit, Greek SA, maritime piracy incidents, SentiMP-GR, and Greek tool calling) and two sources written for this work. Not all of it is human-labelled. Tool calling is synthetic, HERA is machine-generated, and parts of the Greek text are machine translations. The technical report describes each source and gives its licence. The prepared corpus is not released.
Limitations and intended use
Themata is intended for classifying, checking, and grading Greek and English text inside software, where a caller supplies the candidates and uses the probabilities to accept an answer or pass the case on. It does not generate text or explain its decisions. Results come from one training run on a split this project defined, and 856 of the 12,148 test records also appeared in the test split of an earlier run. Performance outside the 14 sources is not established, and accuracy falls as the number of candidates grows. Adding or removing a candidate can change the probabilities of the others, and only their order is guaranteed not to matter. It is not suitable as the only basis for a decision with legal, medical, financial, or employment consequences for a person, and thresholds should be validated on the caller's own data.
Licence
This release is licensed under
CC BY-SA 4.0. Two training
sources, HERA and SentiMP-GR, carry the same licence, and the technical report
credits every source. The base model Gemma 4 E4B is licensed under Apache-2.0,
and LICENSE-GEMMA-APACHE-2.0.txt holds that text. These weights modify it with
merged LoRA updates and a new decision head. The engine binary includes the
components listed in engine/THIRD-PARTY-NOTICES.md.
Citation
@techreport{kostopoulos2026themata,
title = {Themata, an Order-Invariant Typed Decision Model with Independent Candidate Attention and a Native CPU Engine},
author = {Kostopoulos, Yiorgos},
institution = {Aliac Research},
year = {2026},
month = nov,
type = {Technical report}
}
- Downloads last month
- 1
6-bit