Problem & hardware constraints
Dense vector intent classification combining MiniLM-L6-v2 embeddings with an L2 logistic regression head, giving sub-15ms CPU latency with exact token-level explainability.
System architecture & pipeline
The runtime is structured into decoupled execution layers to avoid latency jitter and unpredictable heap fragmentation:
Cleans noisy input text, strips unicode artifacts, and tokenizes in single-pass CPython routines.
Generates 384-dimensional dense vectors using a pruned MiniLM encoder tuned for sentence-level semantic intent.
Computes classification probabilities via optimized matrix multiplications with calibrated threshold cutoffs.
Runs selective word masking to surface exact token contributions without the overhead of heavy SHAP approximations.
Engineering trade-offs & alternatives rejected
Logistic regression head over end-to-end transformer fine-tuning
Fine-tuning the whole transformer made inference 6x slower and required GPU hardware. Keeping the transformer frozen and training a logistic regression head on cached embeddings yielded 94% accuracy with 15ms CPU latency.
Field notes & edge cases
- 01Token explainability does not need 1,000 Monte Carlo samples. Occluding the top 5 noun and verb tokens gives 95% of the same insight with 1% of the compute.
— / deploy
Explore source & live runtime
Source code, static headers, and benchmarks are open for review on GitHub.

