Views
No views yet
sidecar/gating_cross_encoder.py — invoked
on retrieval candidates that pass an initial cosine-distance
cut. A positive score routes the query to substitute; a negative
routes to grounded-LLM.scripts/fetch_models.sh in the Engram repo
(idempotent post-clone install step).python tools/session8_5_train_eval.py
(~15 minutes on M4 Max). Inputs are data/session8_5_labeled.json
(1,560 rows; 1,248 train / 312 test deterministic split).
Deterministic seed (RANDOM_SEED=42).| Metric | This model | Baseline (1 − cosine) |
|---|---|---|
| ROC-AUC | 0.961 | 0.800 |
| Average precision | 0.931 | 0.617 |
| Best F1 (threshold = 0.8) | 0.889 | — |
| Inference latency | 6.5 ms/pair | — |
data/session8_5_eval.json at training time
(2026-04-30). Stochastic MPS ops mean re-trains land within
~±0.01 AUC, not bit-identical.cross-encoder/ms-marco-MiniLM-L-12-v2 (12-layer
cross-encoder pre-trained on MS MARCO passage ranking).tools/session8_5_train_eval.py is designed to be re-run per
customer corpus.cross-encoder/ms-marco-MiniLM-L-12-v2
(Apache 2.0). Training data: Bitext customer-support dataset
(verify upstream license at
huggingface.co/datasets/bitext/Bitext-customer-support-llm-chatbot-training-dataset
before any commercial use).1@misc{engram-xenc-v0,
2 author = {Pascaline / Engram},
3 title = {engram-xenc-v0: cross-encoder for KO substitute-hit gating},
4 year = {2026},
5 url = {https://huggingface.co/jchiang11/engram-xenc-v0}
6}