Reference · every runtime · one bundle format
One model.
Seven runtimes.
Different trade-offs.
The same stage18 int8 bundle is read by PyTorch, NumPy, PHP in three modes, JavaScript and Rust. The heads agree; the latency does not. This page collects the published numbers and the local demo measurement in one place.
Matrix
Runtimes
| engine | path | heads | needs | noul int8 p50 |
|---|---|---|---|---|
| PyTorch | src/decidora/inference.py |
all 4 | torch | 6.8 ms |
| NumPy | src/decidora/numpy_runtime.py |
all 4 on stage18 | numpy | 8.5 ms |
| PHP + C kernel | ports/php/Decidora.php + Kernel.php |
all 4 | PHP 8.1+, mbstring, ext-ffi, OpenBLAS | 5.4 ms |
| PHP + OpenBLAS | ports/php/Decidora.php + Blas.php |
all 4 | PHP 8.1+, mbstring, ext-ffi, OpenBLAS | 0.2-0.31 s |
| PHP pure - this demo | ports/php/Decidora.php |
all 4 | PHP 8.1+, mbstring | 0.5-0.9 s |
| JavaScript | ports/js/decidora.mjs |
all 4 | Node or a browser | 219 ms, Node |
| Rust | ports/rust/ |
noul only |
int8 bundle, GNU/MinGW on Windows | 28.3 ms |
| Guard separate model | src/decidora/guard.py, ports/js/guard.mjs, api/lib/Guard.php |
noul spam/ham |
Python, browser JS or PHP 8.1+ with intl |
~7 ms PHP, ~0.4 ms Python SMS |
Published p50 rows use the stage17b int8 bundle and noul, one question,
from docs/RESULTS.md. PHP ranges come from docs/SPEC.md and
ports/php/README.md. Guard is a 2.1M linear model, not a Decidora head;
its numbers are SMS and a 4,000-character email. The Rust port is int8-only and
does not implement choice, score or span.
PHP port
Three modes, one source file
| mode | what runs in C | one question | four questions, one pass | bundle load |
|---|---|---|---|---|
| C kernel + OpenBLAS | whole encoder, matmul in OpenBLAS | 5-11 ms | ~15-20 ms | ~28 ms |
| PHP + OpenBLAS | matmul only | 0.2-0.31 s | - | ~28 ms |
| C kernel without BLAS | encoder, scalar matmul | 0.18-0.34 s | - | ~28 ms |
| Pure PHP - this demo | nothing | 0.44-0.76 s | 1.21 s | ~10 ms |
Mode selection is automatic: Decidora::load finds OpenBLAS and a compiled
kernel when they exist. This deployment forces the last row with
DECIDORA_BLAS=none and DECIDORA_KERNEL=none.
span_joint always takes the pure-PHP path in the PHP port.
Measured here
This demo's backend
| workload | p50 | min | max |
|---|---|---|---|
choice, 8 options | 764 ms | 764 ms | 806 ms |
noul | 516 ms | 515 ms | 525 ms |
score, 4 levels | 626 ms | 625 ms | 636 ms |
span, 32-token window | 440 ms | 435 ms | 448 ms |
| all four questions, one state, one pass | 1 215 ms | 1 201 ms | 1 229 ms |
| Guard, Russian spam, 89 chars | 6.9 ms | - | - |
| Guard, long payload, 4 842 chars / 6 windows | 16.9 ms | - | - |
| demo sample, precomputed cache | 0.4-0.6 ms | - | - |
| bundle load | 10.3 ms | - | - |
AMD Ryzen 5 7500F, Windows, PHP 8.5.4, JIT 1255, 512 MB memory limit,
stage18 int8, no C kernel, no BLAS. Three runs per workload, median. Excludes the
HTTP round trip; the demo shows server inference time and browser round trip
separately. Guard rows are one warm call each, same machine and PHP build.
The live VDS has OPcache JIT disabled, so demo samples are served from
public/api/precomputed.json; custom text still pays the full first run.
Correctness
Conformance against PyTorch
| engine | stage18 max gap | stage17b max gap | coverage |
|---|---|---|---|
| NumPy | 7.83e-6 | 3.3e-6 | all 4 heads |
| PHP | 1.24e-5 | 1.5e-5 | all 4 heads, 87 examples |
| JavaScript | 2.70e-6 | 3.0e-6 | all 4 heads, 87 examples |
| Rust | - | 1.2e-7 | noul only |
| Guard JS | 35/35 decisions | - | noul spam/ham |
| Guard PHP | max p 1.3e-5 | - | 35/35 feature lists, 0 decision flips |
Ports are independent reimplementations; numpy_runtime.py is their
reference. Thresholds are 1e-4. Re-run conformance after changing forward
math or the bundle format: scripts/conformance_numpy.py,
ports/php/conformance.py, ports/js/conformance.mjs.
Guard PHP was checked against the Python golden on 35 multilingual, long and
obfuscated texts.
Deployment
Why this demo pays for pure PHP
Weights stay on the server
The browser never fetches model.bin. It sends a message and receives
a typed answer. A client-side demo cannot do that: the weights must be downloaded.
No native build
Pure PHP needs only PHP 8.1+ and mbstring. No zig, no
kernel.dll, no OpenBLAS, no platform-specific binary.
Trade-off is latency
The C kernel is roughly 100× faster. For a public demo with a rate limit, half a second per answer is acceptable; for production traffic, move to the kernel or a Python service.