Skip to content

armgit / xerj

Public Imported from GitHub
0

AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory and RAG. Elasticsearch-compatible API; Corpus Hub serves hundreds of reference memory corpora.

9.5 KB
Raw Blame
{
  "id": "blog-jev-vs-a-bm25-vote",
  "title": "A BM25 vote ties Jev on spam and beats it on intent",
  "description": "500 decisions each on SMS Spam and Banking77: a tie on spam (McNemar p=0.75), a 9-point retrieval win on 77-way intent at zero cost, and one dataset Jev wins.",
  "published": "2026-09-22",
  "url": "https://xerj.org/blog/jev-vs-a-bm25-vote",
  "body": "← ALL POSTS · /BLOG \nBENCHMARKS · DECISIONS · SMS SPAM + BANKING77 · RUNS 2026-09-21 # A BM25 VOTE TIES JEV ON SPAM # AND BEATS IT ON INTENT \nXERJ ENGINEERING · PUBLISHED 2026-09-22 · UPDATED 2026-09-27 \nWe gave TypeSafe's Jev five hundred support messages to classify, then answered the same set from a XERJ index with no model at all. On spam the two tied. On fine-grained intent, looking the answer up in our own labelled history won by nine points. \n01 · THE SETUP ## What we compared \nJev is a decision model. You send it a question and a payload, and it returns a typed answer instead of prose, which is a genuinely useful shape for anything that has to branch on the result. \nIt also raises an uncomfortable question about our own product. If you already hold a pile of labelled history, do you need a model to classify the next item, or can you simply look it up? \nSo we built the dumbest competitor we could think of: retrieve the ten nearest labelled examples from an index, let them vote, and return the winning label. No training, no fine-tuning, no inference. We then ran it against Jev on two public datasets with five hundred held-out items each, scoring every arm with exact McNemar tests and bootstrap confidence intervals so that a difference of a point or two could not be mistaken for a result. \nDataset \nQuestion type \nClasses \nIndexed \nTested \n\nSMS Spam Collection (UCI) \nbinary noul \n2 \n4,000 \n500 \n\nBanking77 (PolyAI) \nmany-way choice \n77 \n10,003 \n500 \n\nOne thing to be precise about, because our own rules require it: rows labelled semantic or hybrid ran --embed-mode neural with all-MiniLM-L6-v2 in-process on CPU. XERJ's default embedder is lexical feature hashing, and the BM25 rows used no model whatsoever. Everything local still costs zero API tokens either way. \n02 · THE TIE ## On spam, nobody wins \nBoth systems get essentially every message right, and the difference between them is noise. \nSMS Spam, n=500 \nAccuracy \n95% CI \np50 \n$/1k \n\nmajority floor \n0.8440 \n.812–.876 \n— \n0 \n\nBM25 vote, no model \n0.9800 \n.968–.992 \n7.8 ms \n0 \n\nhybrid vote \n0.9840 \n.972–.994 \n26.5 ms \n0 \n\nJev, rich criteria \n0.9880 \n.978–.996 \n922 ms \n$0.0145 \n\nPaired on the same items, hybrid and Jev disagree on ten of them and split those six to four, which an exact McNemar test scores at p = 0.75 . There is no detectable difference in accuracy between a hosted frontier decision model and simply counting which labels turn up near your query. The gap that does exist sits in the other two columns, where the local arm is roughly thirty-five times faster and the bill is zero. \n03 · THE WIN ## On 77 classes, retrieval wins outright \nWe expected the fine-grained task to be where a hosted model pulled ahead. It went the other way, and not by a little. \nJev, hosted XERJ, local, no tokens 0.8240 0.8300 0.9140 0.9180 Jev choice, 77 options BM25 vote as shipped hybrid MiniLM, local semantic + RR best arm Banking77 accuracy, 500 held-out utterances — run 2026-09-21 Paired, the two disagree on eighty-five items and Jev loses sixty-five of them, which is decisive at p < 0.0001 . The best local arm also calibrates better by a factor of three on expected calibration error, so unlike the hosted arm its confidence is worth thresholding on rather than merely sorting by. \nWhy would a vote beat a model here? Because seventy-seven intents in a banking app are not a general reasoning problem, they are a vocabulary problem, and that vocabulary is already sitting in the index. A model that has never seen this bank's phrasing has to infer the whole taxonomy from a list of option strings, while the index holds ten thousand examples of how real customers actually word each one. \n04 · THE CROSSOVER ## How much history you need before this works \nThis is the number we would most want if we were reading someone else's post, so here it is. \nBanking77 history indexed \nPer class \nAccuracy \nvs Jev 0.8240 \n\n385 \n5 \n0.5740 \nfar behind \n\n770 \n10 \n0.7420 \nbehind \n\n1,925 \n25 \n0.8360 \npasses Jev \n\n3,850 \n50 \n0.9120 \nclear \n\n10,003 \n130 \n0.9140 \nflat after here \n\nTwenty-five labelled examples per class. Below that line it is worth paying for the model, and above it you are paying a vendor to do worse than your own archive. Most support teams crossed that threshold years ago without noticing, which is the part of this result that seems genuinely interesting. \n05 · THE LOSS ## Where Jev beat us, and why \nOn DBpedia, Jev wins 0.9800 to our 0.9125. Fourteen ontology classes, encyclopaedic text, and a taxonomy whose boundaries are semantic rather than lexical. Our embedder puts Artist and Athlete near each other because the sentences look alike. Jev knows they are different kinds of thing. We nearly published a much better-looking number here. Our first DBpedia run dumped the class labels as bare integers, so Jev was scoring at chance and the result looked like a rout — until we read our own harness and found the bug. With real class names the comparison flipped completely, and the honest version is the one above. \nThere is a second loss worth naming, and it is structural rather than incidental. Ask a question whose answer is not in the label vocabulary at all and retrieval scores zero, because a vote can only ever return a label it has already seen; Jev answers the same question zero-shot with the best calibration we measured anywhere. A vote is not a reasoner, and we should stop pretending that the two substitute cleanly for one another. \n06 · THE BUGS ## The comparison found two defects in our own code \nRunning a competitor properly is the cheapest code review available, and two of ours failed under it. The first is an instruction bug, which showed up when we tested a four-step ladder running from \"Is this spam?\" up to a multi-clause policy and the two systems moved in opposite directions. \nInstruction \nJev \nOurs \n\nL1 · \"Is this spam?\" \n0.9633 \n0.9900 \n\nL2 · one clarifying clause \n0.9833 \n0.9667 \n\nL3 · explicit criteria \n0.9867 \n0.8100 \n\nL4 · multi-clause policy \n0.9900 \n0.6400 \n\nThe cause is that our implementation concatenates the instruction into the retrieval query. A longer instruction is better guidance for a model and steadily worse query text for an index, because the instruction is a question rather than something to search for, which is filed as #1000 . \nThe second defect is quieter and worse: a structured state payload was being silently discarded, so the endpoint returned confident answers computed from an empty context and nothing ever errored. That one is #1001 . \n07 · LIMITS ## What we are not claiming \nBoth datasets are public and may sit in Jev's training data. That biases the comparison in Jev's favour, which makes the Banking77 result conservative rather than inflated, but it is still a real limit on what two datasets can tell you. \nThe runs used one vendor model version over a single week, sampled once per item, on a shared machine whose load average wandered between eight and twenty-two. Local latencies are therefore lower bounds, and Jev's include a network path nobody outside TypeSafe can see. \nEvery item was a short English text with a single label, in one language. Nothing here shows that the result transfers to long documents or multilingual corpora, and that claim stays unmade until somebody measures it. \n08 · THE TAKEAWAY ## Count your labels before you pay for a model \nRead together, the three datasets answer the question this post opened with. If the task is a closed vocabulary you already hold thousands of examples of, looking the answer up is not the budget option: on Banking77 it was the more accurate one, and it costs zero API tokens. If the task is binary spam, there is no detectable difference, and the tie is the finding. If the taxonomy is semantic rather than lexical, as on DBpedia, the model is the one to reach for. \nThe operational form of all of it is the crossover: twenty-five labelled examples per class on Banking77, the only dataset we measured it on. Below that line it is worth paying for the model; above it you are, on this evidence, paying a vendor to do worse than your own archive. \nA vote is not a reasoner. A vote can only return a label it has already seen; Jev answers zero-shot, with the best calibration we measured on any zero-shot arm. The rule this post earns is compositional, not a substitution: on a labelled workload, try the lookup you already own first, and keep the model for what the archive cannot see. Every number above traces to the runs in sections 02–06 — the spam tie at p = 0.75, the Banking77 win at p < 0.0001, the DBpedia loss, and the two defects now filed as #1000 and #1001 . The full write-up, every arm and the per-item predictions live in the study; the endpoints are /v1/systemone and /_decide , both documented in the docs ; the retrieval side of the story continues in our earlier post on reranking and on the benchmarks page . \nIf you would rather check the claim than read about it, the shortest path is the quickstart , an index recipe , and your own labelled archive: index the history, hold five hundred items back, ask /_decide , and score the disagreements the way we did. Your archive is the benchmark that matters."
}