I. INFERENCE COMPATIBILITY
& ENFORCEMENT
ICE / LAB 01
CHECKING ENGINE
LOCAL INFERENCE / STRUCTURAL CONTROL

Constrain
the tokens.
Control the
output.

ICE is an offline-first constrained-decoding layer for local small language models. It uses grammar-state compatibility to restrict token selection while generation is in progress.

✓ Grammar-state tracing · JSON syntax checks · Schema validation
DECODING TRACE ILLUSTRATIVE VIEW
GRAMMAR-GUIDED GENERATION
Valid structure.
At every step.
JSON OBJECT / TOKEN FLOW
{ "id" : "A-42" , "paid" : true }
✓ GRAMMAR-COMPATIBLE TOKENS ALLOW
× INCOMPATIBLE TOKENS MASK
01 / TOKEN COMPATIBILITY 02 / LOGITS MASKING 03 / OUTPUT VALIDATION OFFLINE-FIRST DESIGN
THE MECHANISM / 01

Structural control
during generation.

Instead of relying only on instructions or retrying invalid output, constrained decoding limits the token choices available at each generation step according to the supported grammar state.

THE CORE IDEA
Restrict token selection before the next token is chosen.

01
⌘

TRACK GRAMMAR STATE

Maintain parser state as generated text advances through the supported structured-output grammar.

02
⌁

FILTER TOKEN CHOICES

Use token-prefix compatibility to identify which vocabulary tokens remain legal from the current state.

03
◈

MASK MODEL LOGITS

Apply the compatibility mask before token selection, then validate the completed output.

LOGITS TRANSFORMATION z′ = z + M(S, V) 0 = ALLOW   /   −∞ = MASK
LIVE EXPERIMENT / 02

Constrained vs.
unconstrained.

Run both generation paths against the same prompt and schema. Inspect generated text, token telemetry, and final validation.

GRAMMAR WORKBENCH CONFIGURATION LOCAL REQUEST
SUPPORTED SUBSET ONLY — unsupported schemas may be rejected by the backend grammar implementation.
This candidate is user-supplied input, not model-generated output.
i This lightweight mode analyzes a user-supplied JSON candidate. It does not run an LLM or baseline generation.
GRAMMAR ANALYSIS MONITOR IDLE
DUAL-PATH EXECUTION 0 steps Waiting for run…
ICE ENGINE STATUS
IDLE
BASELINE STATUS
IDLE
PATH A / CONSTRAINED

ICE constrained

ICE
GRAMMAR TRACE ANALYSIS OUTPUT
Waiting for the first token…
GRAMMAR STATE —
PATH B / UNCONSTRAINED

Baseline

BASELINE
UNCONSTRAINED DECODING ANALYSIS OUTPUT
Waiting for the first token…
JSON STATUS NOT CHECKED
INFERENCE TELEMETRY NOT AVAILABLE IN DEMO MODE LATEST RECEIVED ICE STEP
VOCABULARY — Total token IDs
ALLOWED — Compatible tokens
MASKED — Excluded tokens
MASK RATIO — Masked / vocabulary
STEP LATENCY — Reported ms per token
0% MASKED MASKING RATIO 100% MASKED
SAMPLE ALLOWED TOKENS / FROM BACKEND EVENT
Waiting for compatible token sample…
LATEST GENERATION EVENT

Metrics update when telemetry is received from the backend.

SYSTEM DESIGN / 04

From schema
to token selection.

ICE sits in the decoding path. It does not replace the language model: it constrains which tokens can be selected at each step according to the supported grammar.

CORE DECODING LOOP

Compatibility becomes a logits mask.

Let the model produce logits z. ICE constructs a mask from the current grammar state: compatible tokens receive zero, while incompatible tokens receive negative infinity.

MASKED LOGITS z′ = z + M(S, V) ALLOW / SUPPRESS
IMPLEMENTATION SCOPE MATTERS Guarantees depend on the implemented grammar and tokenizer compatibility assumptions. Final validation remains important.