Decidora docs
DemoGuardEnginesAbout

Technical documentation · stage18 · Guard

How it works.
What was measured.

Architecture, typed heads, training recipe and held-out experiments behind this demo. Decidora is one encoder pass with four typed heads. Guard is a separate linear model over hashed character n-grams. Neither model generates text. The public Decidora demo is read-only: 13 fixed cases, precomputed answers.

14.2M Decidora params 2.1M Guard params 0 generated tokens

English model

Stage18 at a glance

parameters14 239 236
encoder12 post-LN blocks, hidden 256, FF 1 024
attention4 heads, attention head 64, typed head 128
embedding128, WordPiece vocabulary 30 531
positions1 024, separate tables for state and question
state384 max, 383 input tokens after the marker
question192 tokens
options2-32 for choice and score
span32-token window
bundleint8 14.61 MB; fp32 source, q4 8.15 MB
runtimesPyTorch, NumPy, PHP, JavaScript; Rust noul only

Mechanics

One pass, four heads

choice

Pick one option

The answer row and each option embedding are projected and scored by a dot product. Softmax over 2-32 options produces probabilities, pick and confidence.

2-32 options softmax
noul

Score a statement

A scalar projection of the answer row, then sigmoid. The output is p: how likely the statement is true. Thresholds are applied outside the model.

scalar sigmoid
score

Rank an ordered level

The same option scoring over an ordered list. The expected value is a weighted index 0..1, so score is ordinal, not a free-form number.

ordinal expected value
span

Extract a fragment

Start keys over state tokens, a null-start option and end queries. The best start opens a 32-token window; the end token is chosen inside it. Stage18 uses batched non-joint span.

start + end 32 tokens

Input layout: one state block plus one block per question. A block mask lets each question see the state and itself only. The state is silently truncated to 383 tokens; an overlong question is rejected. Multi-question answers do not depend on question order. No autoregressive decoding is involved.

Multilingual model

Guard

parameters2 097 153, one float32 weight per bucket plus bias
featureschar 2-5 grams, words, URL/host/TLD, email domain, script, message features
hashFNV-1a 64 into 221 buckets
poolingmean of feature weights, plus scalar bias, sigmoid
window1 536 characters, chunk 1 536 / stride 768, max-pooled logits
calibrationper-language temperature and FPR-5% threshold; long-payload threshold
language22 languages, one shared model; not a language detector
normalizationNFKC, format-character removal, lowercase, whitespace collapse

Guard is not a multilingual Decidora: it returns spam/ham only, without choice, score or span. Character n-grams make it script-agnostic and cheap on CPU. English antispam goes to Decidora; non-English antispam goes to Guard.

Release

Training recipe

basestage17b_noul.pt; stage18 is release 0.8.0
datastage15 train plus rebuilt transactional rows; dedupe by state, task, text
run1 epoch, batch 32, lr 2e-5, warmup 3%, AMP bf16, RTX 4060
best step3 000
changesshuffled choice options, invalid span labels skipped, batched span
head flagsspan_joint=False, span_null=True, span_v2=True
fit policythresholds and temperatures fitted on dev only

Experiments

Stage18 variants

variant span SQuAD EM entity exact transactional CLINC / BANKING / SST-5 choice flips
stage17b joint archive 0.461 9/19 TPR 1.000, FPR 0.003 - 26.7%
stage18 batched release 0.324 10/19 acc 1.000, TPR 1.000, FPR 0.000 0.959 / 0.921 / 0.480 15.8%
stage18c span-only 0.336 10/19 acc 1.000, FPR 0.000; SMS TPR 0.949 0.960 / 0.918 / 0.469 16.7%
stage18d joint 0.483 12/19 FPR 0.138 0.944 / 0.870 / 0.429 -

Stage18d recovers span quality but regresses noul and choice, so it did not ship. Stage18 is the compromise: lower span EM, other heads in normal range. Stage17b remains archived.

Antispam

Transactional and SMS

release transactional SMS note
stage16b FPR 0.527 TPR 0.983 previous
stage17b TPR 1.000, FPR 0.003 TPR 0.949 archived
stage18 acc 1.000, TPR 1.000, FPR 0.000, n=483 acc 0.983, TPR 0.932, FPR 0.011 current

SMS threshold 0.7847 and antispam-v3 threshold 0.8995 are domain-specific. Do not move them to another domain without fitting on that domain's dev split.

Guard

Held-out numbers

slice metric
devAUROC 0.9876
long payload v2AUROC 0.9983
long payload testTPR 0.967, FPR 0.012
native Turkish SMS, n=973AUROC 0.9974
native Chinese, n=1 195AUROC 0.955
Spanish template, n=86AUROC 0.820

Runtimes

Conformance and speed

engine stage18 max gap noul int8 p50
PyTorchreference6.8 ms
NumPy7.83e-68.5 ms
PHP + C kernel1.24e-55.4 ms
PHP pure, this demo1.24e-50.44-0.76 s uncached; read-only samples 0.5 ms
JavaScript, Node2.70e-6219 ms
Rustnoul only, 1.2e-728.3 ms
Guard PHP35/35 features, max p 1.3e-56.9 ms SMS

Full engine matrix and demo measurements: engines.html. Conformance thresholds are 1e-4.

Honest limits

What the models do not do

English only

Stage18 does not support non-English choice, score or span. Non-English antispam goes to Guard.

Span is the weak head

Stage18 batched span EM 0.324 is below joint 0.461. Entity extraction is the main quality gap; p_present does not filter wrong answers.

Choice order matters

Permuting options flips 15.8% of choices. Shuffling during training helped from 26.7%, but option-order isolation is not solved.

Thresholds are domain-specific

SMS and antispam-v3 thresholds do not transfer. Fit them on the target domain's dev split and keep FPR separate for SMS, email and language.

Guard is not uniform

Weak slices: pa TPR@5% 0.746, zh 0.879, tr 0.828, es 0.917. 14 languages are translated SMS only.

Commercial demo, research weights

This is a commercial demo, not a safety filter. The underlying weights are research builds; several training corpora are GPL, CC BY-NC or unlicensed, so redistribution rights still need an audit.

Reproduce

Checks

tests.venv\Scripts\python.exe -m pytest -q
cross-enginescripts/e2e_bench.py --iters 5
Decidora PHPports/php/conformance.py
Guard JSports/js/guard_conformance.py then node ports/js/guard_conformance.mjs
Guard PHPphp ports/php/guard_example.php release/decidora-13.8m-stage18/guard "text" ru

Sources: docs/RESULTS.md, docs/STAGE18.md, docs/TRANSACTIONAL.md, docs/GUARD.md. Built by GLOBUS.studio and Leonidov Yevhen.