# Local typed-decision models Use this reference for a local encoder that returns typed decisions (class, probability, score) rather than generated text — the "cheap pre-filter" role in front of a cloud model. It covers schema discovery, measurement, and evaluation. It is not about chat LLMs. ## Identify the kind of model first Run the binary's `--help` and its model-metadata command before writing any integration. Signals that you have a typed-decision encoder, not a chat model: - output reports `output_tokens: 0` with a populated answers object - the CLI exposes `decide` / presets / question-type vocabulary instead of `generate` or `chat` - the runtime is a purpose-built engine, not the usual GGUF chat loader — a shared model directory does NOT mean a shared runtime Such a model cannot summarize, answer open questions, or extract fields from text. It can only score questions you define. Extraction and classification are different jobs: routing OCR text into categories is in scope, pulling names and phone numbers out of it is not. ## Discover the question schema from the validator, not by guessing The CLI path may accept a wrong schema silently: exit 0, answer object present, `choice: ""` and `probabilities: {}`. Never read that as "the model was unsure." Procedure: 1. Start the tool's server mode pointed at the model directory. 2. POST a minimal request and read the error body. A validating API names the offending parameter (`questions..`), which is the fastest ground truth for field names. 3. Only after a field combination returns real probabilities, move it back into the CLI or script. 4. Stop the server when finished; do not leave it running as a side effect of a test. Pitfall: option lists are often keyed by a word other than `options` — probe the validator rather than iterating guesses like `options`/`labels`/`choices`, which all fail identically and silently on the CLI path. Pitfall: a parameter that is ignored rather than rejected (for example a family/language selector that silently does nothing while a model selector works) must be confirmed by reading the route/model field in the response, not assumed from the request. ## Measure honestly - Always pass the device explicitly in a benchmark and print it with the number. - Separate first-call latency (includes model load) from steady-state latency; report both. - Record file sizes in bytes from the filesystem, not from a download page. - A model's own log lines about the accelerator are evidence; a prior session's note is not. ## Evaluate with calibration, degraded input, and a stable script Build the evaluation as a re-runnable script that writes a JSON result file, so a later session can re-measure after a schema change instead of re-deriving the test. The result table needs one row per case with: input label, chosen class, its probability, the runner-up, and the other answers. Then judge: - **Calibration over accuracy.** Correct answers clustering high while errors cluster low means a confidence threshold routes the errors to human review or a cloud model. Report the threshold that separates them. - **Runner-up gap.** A near-tie is a weak answer even when it is correct; it belongs in the escalation band. - **Degraded input row.** Include one case with realistic upstream corruption (OCR character substitution, truncation). It shows which answers survive bad input and which collapse, and it prevents crediting the model for an input-quality failure. - **Per-question quality, not just per-case.** A single weak question can be wrong in both directions across cases; rewrite that question (often a boolean is better expressed as an explicit choice over labelled options) instead of discarding the model. - **Criteria text quality.** A class that loses to an unrelated class usually has thin criteria text. Enrich the description before concluding the model cannot separate those classes. ## Language routing A language-detection subcommand that routes away from a monolingual model is a routing decision, not an inference result. Verify the target-language model actually answers before claiming support. Keep both models in the same directory so the tool's own router can select between them, and confirm the served route in the response payload. Monolingual encoders can fail abruptly outside their language rather than degrading gradually, so an accidental correct answer in the wrong language is not evidence of support.