The master's programme in AI and Data Science at HHU Düsseldorf has an FAQ page with sixty entries. Like every FAQ page, it fails when you phrase your question differently from the person who wrote the answer, because Ctrl-F finds the word you typed and not the thing you meant.

hAInrich sits on that page as an iframe and ranks the entries by meaning instead. You type a question, it shows the three closest entries and, inside each, the one sentence of the answer that is nearest to what you asked. The code is on the university's GitLab, at gitlab.cs.uni-duesseldorf.de/voelkel/hainrich.

Where it came from

The idea and the first working version are Maximilian Overfeld's bachelor's thesis, "Local semantic search on the web using Transformers.js" (2025). I have carried it on since: the second corpus, the build pipeline, the evaluation and the deployment are mine, the construction they sit on is his.

No backend, on purpose

Everything runs in the visitor's browser. A Web Worker loads Xenova/all-MiniLM-L6-v2 as int8 ONNX through a vendored copy of transformers.js, with the ONNX Runtime WASM build served from the same origin, so the page fetches nothing from a third party. There is no server to ask, so there is no query log to keep and no data-protection question to answer. That is a decision, not a side effect.

The embeddings are precomputed at build time. A saved copy of the FAQ page becomes faq.json, where each entry keeps the TYPO3 content-element id of its answer, so an entry survives edits to the page. A second tool turns that into one vector per question, one per answer and one per answer sentence, keyed by a content hash of the embedded text. Edit an entry and it simply gets new keys; the stale ones are pruned when the page loads. Anything without a precomputed vector the worker embeds on the fly, so a missing file costs time, not correctness.

The ranking itself is simple. On every pause in typing the worker embeds the query and scores each entry by the better of two cosine similarities, query against question and query against answer, then picks the closest sentence of the top three answers.

The hAInrich FAQ search: the question 'what grade do I need to get in?' brings up the entry 'Last year, what was the lowest grade still sufficient to get admitted?', with the sentence closest to the question highlighted inside its answer.
The FAQ corpus, sixty entries. The question shares not one word with the entry it finds.

What it costs, and what it is worth

The visitor downloads about 23 MB of model, 14 MB of WASM runtime, 1.3 MB of library and 0.9 MB of vectors. That is a lot for a search box, and it is the price of having no server. It is cached afterwards, and if anything fails to start within ninety seconds the input is replaced by a note linking the plain FAQ page.

Against 45 queries over the 60 entries, that two-similarity rule gets the right entry first 91 % of the time and into the top three 98 %, with an MRR of 0.946. Using the question alone gives 82 % and 98 %; the answer alone collapses to 62 % and 73 %. A second corpus has 405 entries generated from the examination regulations, the module handbook and the programme pages, each reviewed by a person before publication. On its 40 queries the two-similarity rule drops to 80 % and 93 %. One vector of question and answer reaches 85 % and 95 % there, and mixing in a lexical score lifts the first figure to 90 %, which the smaller corpus does not benefit from. All figures come from the project's own evaluation tool, run on 2 October 2026.

Strategy

FAQ recall@1

FAQ recall@3

Regulations recall@1

Regulations recall@3

question only

82 %

98 %

75 %

98 %

answer only

62 %

73 %

60 %

75 %

better of the two

91 %

98 %

80 %

93 %

mean of the two

80 %

96 %

73 %

95 %

one vector of question and answer

78 %

93 %

85 %

95 %

question and answer plus lexical score

80 %

93 %

90 %

95 %

What 2.0 needs, and why it is not here

Evaluating the regulations widget by hand last September turned up a class of question it cannot answer at all:

Can I take module X in the third semester? Can I transfer the credits of module Y from my previous programme to module Z?

The eval set does not see this, because its 40 queries were written from the corpus, so they ask what the documents answer. On those, ranking is fine. The gap is in the corpus.

The reason is structural. The generator produces candidate entries one unit at a time, one Article or one module sheet, and verifies every answer against the evidence in that unit. An entry can therefore only ever state what a single document says. The two questions above need two documents put side by side, and nothing in the pipeline is allowed to do that.

So the next milestone is not a better model but a write-back channel: record the questions nobody could answer, let a curator draft an answer from the corpus, publish it as a new entry, and let the corpus grow along the questions people actually ask rather than along the structure of the documents. That is one POST, and it turns the data-protection decision above into an open question again, which is why it is still on the backlog and not in the page.

Until then - client-side semantic search is still a nice thing to have, essentially for free now. I bet we’re going to see this more often whenever a full Chatbot is not a suitable choice.

The same search over the examination regulations: 'I failed an exam twice, what now?' brings up 'When should I schedule a repeat examination for a failed module?'; the answer highlights the nearest sentence and links to Article 14 of the regulations.
The second corpus, 405 entries from the regulations, the module handbook and the programme pages. Every answer links to the article it came from.

Isn’t this RAG?

No, and to some extent yes. RAG means retrieval-augmented generation, and in a sense we do that; the generation consists of reproducing the entire retrieved text, so the generation is very cheap. It is more honest to call this just R(etrieval) or, by the technical term, semantic search. The only funny thing is the dressing up as a chatbot - I guess people are more likely to enter their question in a chat window (these days) than entering search keywords in a search bar.

If we let the corpus of known answers grow with new questions, it’s a little bit closer to the classical RAG concept, but more like a RAG with very aggressive caching :-)