Skip to main content

typed-encoders

Training recipes for small encoders that answer typed questions about a text: decisions (pick among options, with a probability for each) and extraction (the spans that answer a field, or nothing). Each recipe reproduces a released model.

Model Task Recipe
tasksource/tasksource-decider-nano (v5, 150M) typed decisions (Decision Index, LocalLLaMA/typed-decisions) recipes/decider
tasksource/UltraBERT-150M-clairic-extraction typed extraction (LocalLLaMA/typed-extraction) recipes/extraction
tasksource/UltraBERT-150M-nli NLI / zero-shot classification recipes/nli

The data is tasksource/tasksource-jev-typed-decisions (its default config for decisions, its extraction config for extraction), plus the sources listed in each recipe. Extraction and NLI train with tasknet.

pip install typed-encoders                     # the models; for the recipes: pip install -e ".[decider,extraction,nli]"
pip install git+https://github.com/apolinario/decision-index   # decider recipe only (not on PyPI)
bash recipes/decider/decider_nano_v5.sh          # needs a Decision Index kit checkout, see the script
bash recipes/extraction/clairic_extraction.sh
bash recipes/nli/ultrabert_nli.sh

Decider

from typed_encoders.decider import Decider
d = Decider.from_pretrained("tasksource/tasksource-decider-nano")      # a released checkpoint, or a training run's dir
d.score_many([("The battery died after a week.", "What is the sentiment?", ["negative", "positive"])])
# -> [array([ 0.39, -4.19])]  one logit per option, softmax over a question's options

A joint cross-encoder (typed_encoders/decider.py): every option of a question gets a scalar, softmaxed over the question's options. A request's state is encoded once and shared by all its questions and options (tree attention: an option sees the state, its question and itself), so a request with many questions costs little more than one. Trained with soft cross-entropy against target distributions on a 480k-request mix:

Part Share Builder
jev-typed-decisions, firewalled, ≤ 600 questions per task 42% build_jev.py, firewall.py, shape.py
Decision Index source train splits, rendered like the suite 30% build_index_train.py
Tool selection and retrieval (glaive, hermes, xlam, ToolACE, ToolRet, Home-Assistant) 12% build_tool_train.py
LLM routing (xRouteBench, LLMRouterBench train data) 8% build_router_train.py
tasksource/synthetic-typed-decisions 8% build_synth.py
LocalLLaMA/typed-decisions train 0.5% build_typed_decisions.py

Every part is firewalled against the Decision Index 0.3 suite (exact matches and word 6-gram overlap of the content), and benchmarks without a train split are never used. All sources are pinned (download.py), and the manifests rebuild byte-identical to the ones v5 was trained on.

Extraction

A query-conditioned span tagger: the input is field instruction [SEP] text, and one O/B/I head tags the text, so one model handles single values, lists and absent fields, for fields it has never seen. train_packed.py is the one-pass variant: every field of a document in one forward pass (GLiNER-style marker tokens and a field × token head). Evaluations: the extraction test split (eval_jev.py), out-of-domain MRQA and FinEntity (eval_ood.py), and LocalLLaMA/typed-extraction (eval_typed.py, zero-shot).

NLI

Multi-task training on every tasksource NLI-style task with tasknet (shared encoder, one head per label set).

Metadata

Release files for typed-encoders 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for typed-encoders 0.1.2
File Size Uploaded Provenance Actions
typed_encoders-0.1.2.tar.gz 13.0 kB Without provenance Details for typed_encoders-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for typed-encoders 0.1.2
File Interpreter ABI Platform Actions
typed_encoders-0.1.2-py3-none-any.whl Python 3 none any Details for typed_encoders-0.1.2-py3-none-any.whl

Total release size: 25.3 kB

Release files / typed_encoders-0.1.2.tar.gz

Download URL typed_encoders-0.1.2.tar.gz
Size 13.0 kB
Tags Source
SHA-256 checksum
How to use checksums
dbd430d685f00f069d01eefa18f43826ba9b092f15b464cc4abd3c552801a76d
BLAKE2b-256 checksum
How to use checksums
8a2b0e012642e88dbaeb57bae92fc7435788396be23d7cb3d5baeb3d185c96fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / typed_encoders-0.1.2-py3-none-any.whl

Download URL typed_encoders-0.1.2-py3-none-any.whl
Size 12.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
773a695fced5504b821e64d3f7310eb3d60af9cfc7a10b0e1d8401fb9f8ff465
BLAKE2b-256 checksum
How to use checksums
08744ad5b42291ae35bfb7cb0445d9a3cca3cfc08cbd0e9d1b8297dece376e16
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Security for typed-encoders 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page