Skip to content

feat: calibrate abstention per index, compare with other stacks, and rebuild the landing drawer - #217

Merged
jb-thery merged 5 commits into
developfrom
feature/abstention-calibration-and-landing-links
Nov 1, 2026
Merged

jb-thery merged 5 commits into
developfrom
feature/abstention-calibration-and-landing-links

Conversation

@jb-thery

@jb-thery jb-thery commented Nov 1, 2026

Copy link
Copy Markdown
Member

Problem

Using Ragmir on eleven real local bases showed that it rarely says "I found nothing":

  • an index built with an uncalibrated model (multilingual-e5-base) or with e5-small on another corpus
    returned passages for nearly every off-topic question (0 of 30 refused on a monorepo);
  • near-domain questions about features a project does not have were never refused (1 of 90);
  • on a TypeScript repository, a third of the correct answers were flagged weakEvidence;
  • every search printed a LanceDB _score deprecation warning, configs with retired fields failed with
    an INTERNAL error, and indexes left in hundreds of small fragments searched five times slower
    without any advice.

The benchmarks also never compared Ragmir with other retrieval stacks, and the landing had no direct
path to GitHub or npm in the hero and a drawer that missed several links.

Changes

  • Core: each Transformers index measures its noise floor at ingest from 24 off-topic probe
    questions (older indexes measure it once per process). Only passages nearer than that floor count as
    strong vector matches, and a semantic search whose first five results are all weak answers nothing.
    mxbai flags weak evidence below 30% of the question's words instead of 50%. Term statistics select
    _score, retired configs throw CONFIG_MIGRATION_REQUIRED, and rgr doctor asks for
    rgr storage optimize on fragmented indexes and for rgr ingest when no floor is stored.
  • Cleanup with Knip: Knip runs in pnpm validate. Eight copies of percentile, two JSON Lines
    readers, a duplicated run-state validator, and the 404/500 pages now share one implementation; dead
    code is gone and internal symbols are no longer exported.
  • Benchmarks: pnpm bench:competitors compares Ragmir with LangChain.js, Orama, and MiniSearch on
    this repository with the same files, questions, model, and vectors.
  • Landing: View on GitHub and View on npm buttons in the hero, a mobile drawer rebuilt as cards
    with Documentation and Project sections, and one shared module for every project link.
  • Docs: configuration, migration, API, CLI, agent integration, troubleshooting, the agent skill,
    llms.txt, contributor guides, and both READMEs.

Measured results

Ragmir 6.3.1 against this branch, same indexes, warm searches on an Apple M3 Max:

Base Answer in top 10 Off-topic refused Near-domain refused Correct flagged weak Median
Monorepo, e5-base, 101 questions 93% → 93% 0 → 16 of 30 1 → 11 of 30 11 → 8 39 → 39 ms
Product docs, mxbai, 60 questions 100% → 100% 16 → 17 of 30 0 → 6 of 30 0 → 0 28 → 28 ms
This repository, mxbai, 99 questions 97% → 97% 25 → 25 of 30 0 → 7 of 30 32 → 6 22 → 22 ms

No false refusal on 260 answerable questions. On this repository, the answering file reaches the top 3
for 76% of questions with Ragmir, 56% with LangChain.js, and 70% with MiniSearch.

Validation

  • pnpm validate: Biome, Knip, audit, type checks, 556 Core tests and 27 landing tests with coverage
    gates, builds, API check, CLI/MCP/public-surface smoke, publint, release smoke and artifacts
  • the landing checked in a browser at 375 px and 1440 px in English and French (drawer, hero links,
    Escape and focus return, Team row, footer links)
  • a Transformers ingest stores the floor in the manifest and search reads it back

Limitations

  • Indexes built before this release pay a one-time measurement of 0.1 to 0.3 s on their first search
    in each process until the next rgr ingest.
  • Off-topic refusals barely change on e5-small bases whose off-topic questions still share real words
    with the corpus.

…x health

- measure each Transformers index's noise floor at ingest from 24 off-topic probe questions,
  store it in the manifest, and measure it once per process for older indexes
- treat a passage as a strong vector match only when it beats the noise floor, and answer
  nothing when the first five semantic results are all weak
- flag mxbai-embed-xsmall passages as weak below 30% of the question's words instead of 50%,
  which flagged a third of the correct answers on a code repository
- select `_score` in term-frequency queries so LanceDB stops printing a deprecation warning on
  every search
- throw CONFIG_MIGRATION_REQUIRED instead of an internal error for configs with retired fields
- have doctor ask for `rgr storage optimize` on fragmented indexes and for `rgr ingest` when a
  semantic index has no stored noise floor
- document the noise floor, weak answers, the migration notes, and the new error code
- share one nearest-rank percentile in Core and one in the benchmark library instead of eight
  copies
- read JSON Lines files through one helper for the ingestion snapshot and the fingerprint cache,
  and document why the append-only journal tolerates a torn last line
- validate the ingestion run state through the run metadata check instead of a copy of it
- delete the unused staged-manifest writer and fallback gitignore entry, unexport internal
  constants and helpers, and mark the deprecated command aliases
- render the 404 and 500 pages from one error-page component that reuses the logo component
…and gate on Knip

- add `pnpm bench:competitors`: the same tracked files, questions, embedding model, and vectors
  for every stack, with off-topic and near-domain refusals and latency
- add the public question fixture: 99 developer questions with every answering file, 30
  off-topic and 30 near-domain questions
- add Knip to `pnpm validate` with entries for benchmark workers and release scripts, declare
  TypeScript at the root for the API check, and document the rule for contributors
… drawer

- add View on GitHub and View on npm buttons under the hero calls to action
- rebuild the mobile drawer as cards of icon rows with chevrons, Documentation and Project
  sections, language pills, the version, and pinned GitHub and npm buttons
- list every project link from one module shared by the hero, drawer, footer, and structured
  data, adding the FAQ, benchmarks, and AGPL license links that some surfaces missed
- show the measured 39 ms median on the 29,778-chunk monorepo in the hero proof
- lead both READMEs with the current measured recall and latency of the monorepo index
- show Ragmir 6.4 against 6.3.1 on three real bases: same answers, more refusals of off-topic
  and near-domain questions, fewer correct answers flagged as weak
- add the comparison with LangChain.js, Orama, and MiniSearch on this repository
@jb-thery
jb-thery merged commit da5275e into develop Nov 1, 2026
12 checks passed
@jb-thery
jb-thery deleted the feature/abstention-calibration-and-landing-links branch November 1, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant