Instructions to use AleksanderObuchowski/Tectal with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AleksanderObuchowski/Tectal with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("AleksanderObuchowski/Tectal", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
You need to agree to share your Hugging Face information to access this model
This repository is publicly accessible, but you have to accept the conditions to access its files and content.
Research preview. Access is granted by hand. Please say in one sentence what you want to use the model for.
Log in or Sign Up to review the conditions and access this model content.
Tectal
Tectal is a decision model for Polish and English. You give it a question and 2 to 8 options, with an optional context, and it returns a probability for each option in one forward pass, without generating text. It is built for the decision points of pipelines and agents: routing, rule and deadline checks, abstention, grading.
It takes 13.7 GiB and runs on a CPU with 16 GB of RAM. On decision tasks it is more accurate than decision models up to four times its size.
Use
pip install transformers torch llama-cpp-python
hf auth login # the repository is gated, request access on this page first
from transformers import AutoModel
model = AutoModel.from_pretrained("AleksanderObuchowski/Tectal", trust_remote_code=True)
model.decide(
"Kiedy mija termin płatności?",
["14 marca", "17 marca", "3 kwietnia", "16 marca"],
context="Faktura wpłynęła 3 marca. Termin płatności wynosi 14 dni od dnia wpływu.",
)
# [0.004, 0.986, 0.003, 0.007]
model.choose(
"Which tool should handle the request?",
["calendar", "email", "web search", "none of them"],
context="User: move my dentist appointment to Friday afternoon.",
lang="en",
)
# ('calendar', 0.975)
decide returns the probabilities in the order of the options. choose returns the most probable option with its probability. The first call downloads the weights. Nothing else has to be installed or started: the model runs inside your Python process through llama.cpp.
Argument of from_pretrained |
Meaning |
|---|---|
n_gpu_layers=-1 |
put the model on a GPU (needs llama-cpp-python built with CUDA or Metal). The default is the CPU. |
n_threads=8 |
CPU threads. The default is half of the logical cores, at most 16. |
n_ctx=8192 |
the longest prompt in tokens |
trust_remote_code=True is needed because the repository carries its own small loader (modeling_tectal.py). It builds the prompt, reads the probabilities of the option letters and applies the calibration.
Other languages, or your own llama.cpp server
A decision is a completion of one token whose probabilities you read, so any llama.cpp client works.
hf download AleksanderObuchowski/Tectal --include "*.gguf" --local-dir tectal
llama-server -m tectal/tectal-base-IQ3_M.gguf --lora tectal/tectal-adapter.gguf -c 8192 --port 8080
curl -s http://127.0.0.1:8080/completion -d '{
"n_predict": 1, "n_probs": 10, "temperature": 0,
"prompt": "<|turn>user\nPrzeczytaj poniższe informacje i wybierz jedną poprawną odpowiedź.\n\nFaktura wpłynęła 3 marca. Termin płatności wynosi 14 dni od dnia wpływu.\n\nPytanie: Kiedy mija termin płatności?\n\nA. 14 marca\nB. 17 marca\nC. 3 kwietnia\nD. 16 marca\n\nOdpowiedz tylko jedną literą.<turn|>\n<|turn>model\n<|channel>thought\n<channel|>"
}'
The answer is in completion_probabilities[0].top_logprobs. Keep the entries whose token is an option letter and renormalise them. For English the three fixed lines are Read the information below and choose the one correct answer., Question: and Answer with a single letter only. The file modeling_tectal.py is the reference for the prompt and for the calibration (a temperature of 1.56 on the probabilities, and the mean over the given and the reversed order of the options).
Results
Accuracy in percent on our development sets. Every model answered the same questions with the same options, in the given and in the reversed order, and the two probability vectors were averaged. Tectal was run through llama.cpp with the files of this repository. Basal and Bielik One were called through their own decision APIs.
| Tectal | basal-omni-1.0-ultra | basal-omni-1.0-max | Bielik-One-11B-v3.1 | basal-omni-1.0-ultra at IQ3_M ‡ | |
|---|---|---|---|---|---|
| Weights on disk | 13.7 GiB | 59 GiB | 23 GiB | 21 GiB | 13.4 GiB |
| Decision tasks: rules, deadlines, dates, routing, abstention, scoring, tool calls (12 tasks, 2,463 items) | 90.7 | 85.7 | 82.7 | 78.7 | 84.7 |
| Language understanding and reading in Polish and English (8 tasks, 2,834 items) | 92.0 | 84.8 | 86.6 | 83.7 | 84.2 |
| The same without CDSC-E (7 tasks) | 91.5 | 91.8 | 88.4 | 84.2 | 91.3 |
| Adversarial sets (5 rounds, 3,000 items) | 76.1 | 76.5 | not run | not run | 74.5 |
| Polish vocational and state exam questions (LLMzSzŁ sample, 2,000 items) | 77.5 | 79.3 | 68.8 † | 69.1 † | 78.4 |
| MMLU sample (2,000 items) | 85.5 | 87.5 | 80.4 † | 69.1 † | 86.5 |
† measured on the smaller knowledge subsets of the language set (385 and 414 items), where Tectal scores 77.7 and 86.0 and basal-omni-1.0-ultra 78.7 and 87.0. On the decision tasks Bielik One refused 10 items, which are left out of its score.
‡ basal-omni-1.0-ultra quantised by us to the format and size of Tectal (IQ3_M with an importance matrix) and run through Basal's own engine in its llama.cpp mode. This is not an official port. Basal's documentation recommends Q8_0 or Q6_K for its GGUF ports.
How to read the table:
- Against basal-omni-1.0-max and Bielik-One-11B-v3.1, Tectal is ahead on every row at 60 to 65 percent of their size.
- Against basal-omni-1.0-ultra, which is 4.3 times larger, Tectal is ahead by 5 points on decision tasks. On language understanding the two are level once CDSC-E is set aside, a task on which the ultra model scores 36.3. On exam knowledge Tectal is about 2 points behind.
- The adversarial sets were written in five rounds by a stronger model that saw our results and was asked for tasks on which Tectal loses to basal-omni-1.0-ultra. Tectal won rounds 1 to 3 (95.0 to 92.2, 89.7 to 89.0, 75.2 to 72.5) and lost rounds 4 and 5 (70.7 to 71.8, 50.0 to 57.2). Rounds 2 and 4 are ties within sampling noise. Round 5 is a clear loss. It asks for the same simple step applied two or three times in one pass (items moving around a ring, repeated swaps of neighbours) and for the magnitude of a falling quantity. Both models are weak on these tasks and Tectal is the weaker one. Over the five rounds the two models are level.
- At equal size (last column) Tectal is 6 points ahead of the quantised basal-omni-1.0-ultra on decision tasks and 1.6 points ahead on the adversarial sets, and about 1 point behind on exam knowledge.
- Most of the decision tasks come from the same generators as a part of Tectal's training data, with different items, which favours Tectal on that row. The adversarial sets share nothing with the training data.
- These are development sets. They were also used to choose the model, and the held-out test halves have not been scored yet.
With the shipped temperature the expected calibration error of Tectal is 1.5 on the language set, 2.4 on the decision tasks and 2.2 on the knowledge questions (15 bins, percent).
Speed
One pass over a prompt of about 100 tokens takes about 2.4 s on a CPU with 16 threads and 4.4 s with 8 threads. On a GPU through llama.cpp it takes about 0.6 s with 8 requests in parallel. decide reads the options in the given and in the reversed order. The second reading reuses the computation of the shared part of the prompt (instruction, context and question), and so does a further question about the same context. On prompts of about 200 tokens a decision therefore takes about 1.2 passes, 40 percent less time than two full passes. Pass both_orders=False for a single reading at a small cost in accuracy. Tectal is small and portable. On a large GPU the full-precision models above answer faster.
Limits
- The base is stored at about 3.7 bits per weight. Against the full-precision Gemma 4 31B this costs about 1 point on knowledge questions. The adapter recovers the loss on computed and rule-based tasks, not the loss of knowledge.
- On tasks that need many exact steps in one pass (repeated state transitions, joins with duplicates, long chains of signed adjustments) accuracy can fall below 50 percent, and to chance level on the hardest of them. Such decisions are better served by a model that reasons step by step.
- The model answers only in the multiple-choice format above. It was not trained to generate text.
- Inputs longer than about 1,500 tokens were rare in training.
How it was built
The base is Gemma 4 31B (instruction-tuned) quantised to IQ3_M with an importance matrix (tectal-base-IQ3_M.gguf). A LoRA adapter of rank 16 was then trained on top of the quantised weights, so that it also repairs the errors of quantisation, and llama.cpp applies it at run time (tectal-adapter.gguf). The folder peft/ holds the same adapter in PEFT format for further training. The adapter belongs to the quantised base and was not measured on the full-precision weights.
The adapter was trained on about 56 thousand multiple-choice items: public Polish and English task data converted to decisions, generated tasks whose label is computed by code (deadlines, dates, rules, routing, SQL and Python executed in a sandbox), tasks written by open models and kept only when an independent reasoning pass confirmed the key, and exam-style questions with the answer distribution of a higher-precision Gemma 4 31B teacher as a soft target. Training items were deduplicated against the evaluation sets by normalised text.
Licence
The quantised base weights are a derivative of Gemma 4, released by Google under Apache 2.0. The adapter is a research preview. Its final licence will be set after the review of the licences of the public datasets used in training. Until then it is shared for evaluation and research.
- Downloads last month
- -
3-bit