Logo di Rrf Hybrid Retrieval

Rrf Hybrid Retrieval

Community
AnthonyAlcaraz
rrf-hybrid-retrieval

Reciprocal Rank Fusion (RRF) hybrid retrieval across 4 parallel channels — semantic / keyword / graph-traversal / temporal — followed by cross-encoder rerank and token-budget filter (HINDSIGHT, Latimer et al. 2025, cited in Ch4). Rank-based fusion means scores don't need calibration across channels; absent items contribute nothing; items high in multiple lists surface naturally. Use when memory must answer queries that mix conceptual / exact-id / connected-entity / recent-event facets. NOT for single-channel retrieval (just use that channel), NOT for systems where one channel dominates (the fusion is overhead).

Panoramica

Pubblicato daAnthonyAlcaraz
Repositoryagentic-graph-rag-skills
Nome della skillrrf-hybrid-retrieval
Stelle
29
Fork
9
File inclusi
2
LicenzaMIT
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • File inclusi: 2

    Script, template e riferimenti che il modello può leggere mentre lavora. I file sono di sola lettura e non vengono mai eseguiti.

  • Open source

    Pubblicata da AnthonyAlcaraz su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Rrf Hybrid Retrieval in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/AnthonyAlcaraz/agentic-graph-rag-skills/tree/main/skills/memory/rrf-hybrid-retrieval
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Aggiungi skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella della skill nella directory delle skill di quell'agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/AnthonyAlcaraz/agentic-graph-rag-skills.git /tmp/agentic-graph-rag-skills
mkdir -p .claude/skills
cp -r /tmp/agentic-graph-rag-skills/skills/memory/rrf-hybrid-retrieval .claude/skills/rrf-hybrid-retrieval
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Rrf Hybrid Retrieval in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Rrf Hybrid Retrieval non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Rrf Hybrid Retrieval non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

RRF Hybrid Retrieval

Overview

A DevOps incident query like "latency spike in checkout related to recent deploy" needs four kinds of retrieval:

  • Semantic: conceptually similar past incidents (vector similarity)
  • Keyword: exact identifiers (checkout-api, deploy-v3.5.0)
  • Graph traversal: connected entities (services that depend on checkout-api; deploys that touched it)
  • Temporal: recent events (last 24h, by deploy timestamp)

Any single channel misses; semantic loses exact identifiers, keyword misses synonyms, graph misses isolated nodes, temporal misses the "happened before 24h ago but matters" cases. The fusion is the point.

Reciprocal Rank Fusion (Cormack et al. 2009):

RRF(item) = sum over channels c of: 1 / (k + rank_c(item))

Where k=60 is the standard. Rank-based — no score calibration needed. Items missing from a channel contribute zero from that channel. Items ranked high across multiple channels naturally rise to the top.

After fusion, run a cross-encoder reranker over the top-N for precision, then apply a token-budget filter so the result fits the downstream LLM's context window. Per HINDSIGHT (Latimer et al. 2025, cited in Ch4): "After RRF, a neural cross-encoder reranker refines precision on top candidates, then token budget filtering ensures results fit the downstream LLM's context window."

When to Use

  • Memory queries that span multiple retrieval-channel "shapes" (conceptual
    • exact + connected + recent)
  • Production DevOps incident-investigation, customer-support resolution, research-synthesis agents
  • When you need to combine heterogeneous retrieval methods and don't want to calibrate scores across them

Phrases: "hybrid retrieval", "RRF", "reciprocal rank fusion", "multi- channel search", "combine semantic and keyword", "cross-encoder rerank".

When NOT to Use

  • Single-channel retrieval is sufficient (e.g. keyword-only ID lookup)
  • One channel dominates and the others contribute noise
  • Real-time hot path where the cross-encoder rerank exceeds latency budget (~50-200ms typical) — fall back to RRF without rerank

Process

StepInputActionOutputVerification
1query + 4 channel rankings (each a list of doc_ids in rank order)lib.rrf_fuse(channels, k=60)List of (doc_id, fusion_score) sorted descendingdoc_ids in multiple channels rank higher than doc_ids in one
2top-N from fusion + querylib.cross_encoder_rerank(top_n, query)Reranked top-Nreranker can re-order but does not introduce or drop items
3reranked list + token-count fn + budgetlib.token_budget_filter(items, get_tokens, budget)Filtered list fitting under budgetsum(tokens) <= budget
4full pipelinelib.hybrid_retrieve(query, channel_callables, ...)Final result listeach item has fusion_score + rerank_score + token_count

Rationalizations

Agent rationalizationDocumented rebuttal
"I'll just use vector search and call it a day."Vector search misses exact identifiers ("incident INC-1043" — the embedding for "INC-1043" is noise). Exact identifiers are graph-traversal + keyword's job. The 4-channel composition exists because no single channel is sufficient.
"I'll combine scores from each channel — RRF is overkill."Score scales differ across channels (cosine 0-1, BM25 0-100+, graph hop-count 1-10). Combining requires calibration. RRF sidesteps this by using ranks. The Ch4 anchor names this exact advantage.
"Cross-encoder rerank is slow — skip it."Skip it when latency budget is tight, document the choice. The rerank produces measurable precision lift on the top-5; without it, top-5 is fusion-only and can include "popular but wrong" items.
"Token budget filter loses information."Yes — that's the point. The downstream LLM's context is bounded. Either you filter, or the LLM truncates blindly. Filtering with intent (drop the lowest-rerank-score) beats truncation by accident.

Red Flags

  • RRF score distribution is flat (top-10 all very close). Channels are redundant — they're returning the same items. The fusion is buying nothing; either trim channels or check that each channel is exercising a different shape.
  • Cross-encoder rerank changes top-10 by > 80%. Either the fusion is bad or the cross-encoder is mis-tuned for this domain.
  • Token budget filter drops > 50% of reranked items. Budget is too small for the query complexity — either widen the budget or write multiple narrower queries.

Non-Negotiable Verification

  1. Run the benchmark battery. python cli.py benchmark must report:
    • RRF formula matches Cormack et al. 2009 reference
    • items in multiple channels rank above items in one
    • token-budget filter respects the budget bound
    • full pipeline produces results with all four score fields
  2. Verify CLI help. Exits 0 and prints SKILL.md description.

Security Posture

  • Prompt injection. Retrieved items are untrusted content headed straight for an LLM context - fusion and rerank order them, they do not sanitize them. An adversarial document that ranks in multiple channels gets RRF-amplified into the budget-filtered prompt; run an injection filter between retrieval and prompt assembly.
  • Data exfiltration. Fusion aggregates across four channels with no ACL of its own - a broad query can pull sensitive items from any channel into one context. Enforce access control per channel BEFORE fusion; the skill itself makes no network calls and writes no files.
  • Privilege escalation. No shell invocation, no eval. The influence vector is rank manipulation: content stuffed with exact identifiers plus synonyms to score across channels and dominate the token budget. Cross-encoder rerank helps but is not a security control.

Source Attribution

Distilled from Agentic GraphRAG (O'Reilly, by Anthony Alcaraz and Sam Julien) Ch4 — Retrieval section. RRF formula: Cormack et al. 2009 (Reciprocal Rank Fusion outperforms Condorcet and individual rank learning methods). HINDSIGHT 4-channel application: Latimer et al. 2025.

File inclusi

Il modello legge questi file quando servono, mentre la skill è caricata. Sono accessibili in sola lettura e non vengono mai eseguiti.

Domande frequenti

Cosa fa la skill IA Rrf Hybrid Retrieval?

Reciprocal Rank Fusion (RRF) hybrid retrieval across 4 parallel channels — semantic / keyword / graph-traversal / temporal — followed by cross-encoder rerank and token-budget filter (HINDSIGHT, Latimer et al. 2025, cited in Ch4). Rank-based fusion means scores don't need calibration across channels; absent items contribute nothing; items high in multiple lists surface naturally. Use when memory must answer queries that mix conceptual / exact-id / connected-entity / recent-event facets. NOT for single-channel retrieval (just use that channel), NOT for systems where one channel dominates (the...

Perché usare Rrf Hybrid Retrieval su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Rrf Hybrid Retrieval è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che la skill smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Rrf Hybrid Retrieval in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/AnthonyAlcaraz/agentic-graph-rag-skills/tree/main/skills/memory/rrf-hybrid-retrieval. TypingMind legge il file SKILL.md, include i file associati e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Rrf Hybrid Retrieval?

Qualsiasi modello che colleghi a TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Rrf Hybrid Retrieval?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Rrf Hybrid Retrieval: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Rrf Hybrid Retrieval è gratuita?

Sì. È pubblicata su GitHub da AnthonyAlcaraz con licenza MIT. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, template o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Elenco completo

Crea subito il tuo spazio di lavoro AI

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇