mivia-small-json router

An 11-class schema router for coding-workflow signals: unstructured text in, a strictly valid JSON record out. Fine-tuned and int8-quantized from microsoft/Multilingual-MiniLM-L12-H384 (MIT); runs CPU-only under 2 GB RAM at p50 ~8-16 ms on short text.

Classes - the 10 workflow classes issue, commit, log_event, pull_request, tool_call, tool_clarification, diagnostic, diff, review_comment, agent_step, plus plain text for non-workflow input. There is no rejection outcome: non-workflow text is a first-class result.

Intended use

Route and structure developer-workflow text - issues, commit messages, log lines and streams, PR descriptions, AI-agent tool calls, compiler and linter output, git diffs, code-review comments, agent trajectory steps. Bare user requests ("calculate the sum of 15 and 30") classify as text; whether a tool should run is a relation between a request and a tool catalogue - that is the companion mivia-small-json-tool-match guard's job.

Out of scope: not a chat model, not a general text classifier outside the developer-workflow domain, and it does not execute anything.

Usage

The full serving surface (extraction, multi-line stream parsing, repair to strict JSON, REST + MCP) lives in the GitHub repo. Direct ONNX inference:

import json
from pathlib import Path

import onnxruntime
from huggingface_hub import hf_hub_download
from tokenizers import Tokenizer

repo = "mivialabs/mivia-small-json-router"
onnx_path = hf_hub_download(repo, "router-encoder-int8.onnx")
tokenizer = Tokenizer.from_file(
    hf_hub_download(repo, "router-tokenizer.json"))
classes = json.loads(
    Path(hf_hub_download(repo, "router-encoder-classes.json")).read_text())

session = onnxruntime.InferenceSession(onnx_path)
enc = tokenizer.encode("ERROR [auth]: token expired")
logits = session.run(None, {
    "input_ids": [enc.ids],
    "attention_mask": [enc.attention_mask],
})[0][0]
best = max(range(len(logits)), key=lambda i: logits[i])
print(classes[best])  # -> "log_event"

Schema registration, field extraction, validation, and the never-raise repair ladder are part of the Python package, not the raw encoder.

Training data

No third-party dataset is redistributed; the per-source inventory (upstream, license, builder recipe) is docs/DATA.md in the GitHub repo. Fine-tuned from Microsoft's MiniLM checkpoint (MIT); changes: task fine-tuning and int8 quantization.

Evaluation

All numbers measured on frozen sets disjoint from training data; the full state lives in the repo's docs/MODEL-STATE.md.

Surface Result
Frozen held-out 99.71% routed-and-valid (valid 100%, p95 11.7 ms)
LogHub 32k, 16 systems routed 100.0% / valid 100% / component 99.99% / level 99.98%
SWE-bench problems 97/100 (a ±6pp run-variance band exists on this surface)
Tool catalogues (BFCL calls set) 89.07% routed-to-expected through the served path
Non-workflow one-shot rejection 92.23%, free-chat 98.63%, retention min 0.99
Router calibration ECE 0.0017 (n=2,800)

Limitations

Measured gaps are published in the repo's docs/LIMITATIONS.md: long problem-statement titles, ambiguous middle severity tiers, and zero-shot transfer to arbitrary label taxonomies are the known weak surfaces. Long-input latency is load-dependent, not a model property.

License

Apache-2.0. The base checkpoint remains MIT; attribution is carried in the repo's NOTICE.md.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for mivialabs/mivia-small-json-router

Finetuned
(40)
this model