Armenian AI Company

Tune Search: retrieval that critiques itself

A query goes in — “everything is falling apart” — and the machinery answers in the open: hybrid retrieval over a vector space, a self-critique loop that re-searches when it is unsure, and a council of independent voices whose nominations a judge adjudicates.

AAIC built the search engine; the demonstrator is deployed in a production application we are not at liberty to name. The interface in these recordings is a technical demonstrator of the engine internals, not a production UI.

Fig. 1The engine at work. A confident query lands in the vector space, is interpreted into search intents, and resolves in a single hop — the pipeline runs left to right, each stage reporting its own measured timing, and the passages stream back with the signal that surfaced them.

The problem with straight-line retrieval

Retrieval-augmented search is usually a straight line: embed the query, take the nearest passages, hand them to a language model, return prose. It works until the query is not a keyword but a state of mind. Nobody types “Psalm 91”; they type that they cannot sleep, or that a diagnosis came back. The nearest vectors to those words are not always the passages that answer them, and a single pass has no way to notice when it has come back thin. Tune Search treats the query as a problem to be worked, not a lookup to be served.

Hybrid retrieval

The corpus carries roughly two hundred passages, each embedded into a 96-dimensional vector and projected into a plane. Retrieval is hybrid: a keyword rank (BM25 over an inverted index) and a semantic rank (cosine over the embeddings) are combined by reciprocal-rank fusion, then constrained for diversity so a single source cannot crowd the result. A curated pastoral index — a hand-mapped set of life-situations — is injected at the top of the candidate pool so the right passage is available even when it is not the closest vector. Every timing shown is measured in the browser with performance.now(), not illustrated.

The self-critique loop

After each retrieval a Critic scores how well the candidate set covers the query — combining situation coverage, the margin of confidence in the top result, and diversity of the set. If the score clears the threshold, the Critic accepts and the pipeline continues. If it does not, and the engine has hops remaining, it reformulates: broadens the query with related themes, lowers the semantic cutoff to cast a wider net, and retrieves again. The query re-embeds and moves in the vector space; coverage is re-measured on the new set. A confident query resolves in one hop; a vague one loops and self-corrects. The branch is taken on a measured number, not scripted.

Fig. 2The loop. A vague query returns under threshold; the Critic broadens it and re-retrieves, the query point re-embeds and shifts across the space, and the coverage meter climbs hop by hop.

The council and the judge

Where a plain pipeline returns one ranked list, Tune Search convenes a council. Each voice in the corpus is an independent agent that nominates the single passage from its own writings that best fits the query, scored on semantic similarity and situation overlap. A Judge adjudicates: it vetoes nominations that are off-tone or of low textual quality, and keeps a diverse quorum — one theme apiece. Every nomination and every verdict is stated, so the reasoning behind the final set can be read rather than inferred.

Fig. 3Deliberation. Fifteen voices nominate in parallel; the Judge keeps three and vetoes the rest with a stated reason. A provenance graph traces the whole decision — query to intents, voices to judge, outward to each returned passage, with rejected voices struck through.

The marked-up corpus

None of this works without the annotation that happens before a query is typed. At index time every passage is marked up: garbled scans are cleaned, the text is tagged against a vocabulary of 49 themes by keyword match, and a quality score is computed as the ratio of clean words to total. Those themes are what the pastoral index and the council reason over; the quality score is what lets the Judge veto an unreadable passage. Tune Search makes that layer inspectable: any point in the vector space, or any returned passage, opens to its annotation — the words that fired each theme highlighted in place, the tags they produced, the quality bar, and where a passage was recovered from a bad scan, the raw text beside its cleaned form.

Fig. 4The markup, opened. A passage runs through the annotator — OCR repaired, theme keywords lighting up as they match, quality scored — and a returned passage is inspected in place, its theme words highlighted and metadata shown.

The embeddings, hybrid ranking, coverage metric, council votes and vetoes, theme tagging, and quality scores are all computed live over the corpus; every timing is measured. The natural-language prose — interpreted intents, voice arguments, judge verdicts, polished excerpts — stands in for a language model and is marked as such in the interface. The structure is the argument; the wording is the illustration.