BifrostRAG: Dual-Graph RAG System
- BifrostRAG is a retrieval-augmented generation system that integrates dual knowledge graphs to analyze complex regulatory texts.
- Its architecture employs an Entity Network Graph for semantic relationships and a Document Navigator Graph to capture hierarchical document structure.
- BifrostRAG uses a hybrid retrieval algorithm and privacy-preserving federated extension to enhance multi-hop QA accuracy in sectors like construction, healthcare, and finance.
BifrostRAG is a retrieval-augmented generation (RAG) system designed to address complex question answering (QA) and information retrieval tasks in domains with highly structured and semantically rich document collections. Its architecture incorporates dual knowledge graphs—one encoding semantic relationships among entities and one capturing fine-grained document structure—along with hybrid retrieval mechanisms and privacy-preserving federated deployment options. BifrostRAG was originally developed to support automated compliance checking and multi-hop QA in construction safety regulations, but variants and adaptations now target regulated and distributed domains such as healthcare and finance (Zhang et al., 18 Jul 2025, Stripelis et al., 26 Mar 2026).
1. Dual-Graph Architecture
BifrostRAG employs two complementary knowledge graphs:
- Entity Network Graph (ENG): This graph encodes semantic relationships among words and phrases (entities) from regulatory texts. Each node represents an entity mention, such as “guardrail system” or “scaffold”; edges denote semantic relations (e.g.,
subject_to,requires). Entity and triple embeddings are stored in a vector database to support dense semantic retrieval. - Document Navigator Graph (DNG): The DNG models explicit document structure. Nodes are section identifiers (e.g., “§1926.501(b)(2)(i)”), and edges are of two distinct types:
hasedges model parent–child relationships following hierarchical regulatory numbering.refers_toedges encode explicit cross-references between sections, typically extracted via citation pattern matching.
Hybrid retrieval combines the strengths of both graphs: user queries are parsed into entities and relation triples. These are semantically matched (via cosine similarity of their embeddings) against the ENG to produce a set of candidate “seed” sections. The DNG is then traversed structurally from these seed sections to enumerate relevant linked sections (parents, children, and cross-references). The LLM answer is grounded in the union of semantic and structurally related passages (Zhang et al., 18 Jul 2025).
2. Knowledge Graph and Data Pipeline Construction
Construction of the dual-graph infrastructure involves several discrete steps:
- Document Scraping: Source texts are obtained using HTML (BeautifulSoup) and PDF (PyMuPDF) scrapers. Results are cleaned using margin-trimming, noise removal, and serial concatenation, then serialized as JSON records ({section_id, text, metadata}). Discrepancies between formats are resolved with differencing tools (difflib).
- ENG Generation:
- Content pruning (LLM-prompted) simplifies sentences but preserves all section references.
- Entity extraction (LLM-prompted) identifies noun-phrase entities and their referenced sections.
- Post-extraction validation compares outputs to the source, removing hallucinated or missing entities.
- Relationship extraction (LLM-prompted) operates on entity pairs in a sentence to propose semantic links.
- Validation steps ensure head/tail alignment and label correction.
- The resulting graph (nodes and edges with provenance metadata) is loaded into Neo4j.
- Entity Refinement: Singularization, normalization (CamelCase→lowercase, proper-noun preservation), schema matching, and vector-based duplicate resolution via (using entity embeddings and a similarity threshold).
- DNG Construction: DNG nodes are section identifiers; edges follow the formal (numbered) document hierarchy and extracted cross-references. The graph is stored in Neo4j for efficient Cypher traversal (Zhang et al., 18 Jul 2025).
3. Hybrid Retrieval Algorithm
The two-stage hybrid retrieval algorithm proceeds as follows:
- Query Decomposition: The user’s question is decomposed into an entity list and a triple list via LLM-based extraction.
- Semantic Retrieval (ENG): For each query entity and triple (and their swaps), top-k closest matches are found in the ENG using cosine similarity. Sections associated with matched entities/triples above their respective similarity thresholds are collected.
- Structural Expansion (DNG): The intersection of entity- and triple-matched seed sections is used as the set of starting nodes for DNG traversal. Breadth-first or cost-aware traversal expands these to include structurally adjacent sections through “has” and “refers_to” links.
- Section Ranking: Each section is scored according to a weighted sum:
where and are mean entity and triple similarities, is the hop count or path weight from a seed section, and are hyperparameters. Top-ranked sections are provided to the answer generator (Zhang et al., 18 Jul 2025).
Pseudocode for this algorithm appears in Section 3 of (Zhang et al., 18 Jul 2025), formalizing the sequence of query expansion, retrieval, and ranking steps.
4. Privacy-Preserving Federated Extension
Modern extensions to BifrostRAG operate in federated settings for domains where data reside in isolated silos (e.g., hospitals, research institutes):
- Each silo holds its private corpus in a local FAISS index. On query, it computes top-k matches and scores using a ranking function such as Reciprocal Rank Fusion:
These results are encrypted with the public key of a remote trusted execution environment (TEE; e.g., Intel SGX enclave).
- A Flower server (federated learning/orchestration framework) coordinates secure attestation, encrypted result aggregation, and re-ranking. The TEE merges all silos’ retrieval results:
and constructs the context for LLM inference.
- Cascading inference can incorporate output from a non-confidential external LLM (e.g., AWS Nova): auxiliary answers are merged inside the enclave as “soft hints” but original documents never leave secure memory. Final answer synthesis happens under full end-to-end confidentiality. All communications are protected by mutually authenticated TLS; encryption and integrity use AES-GCM and RSA-2048/EC-256. Attestation is performed via Intel IAS (Stripelis et al., 26 Mar 2026).
5. Multi-Hop QA Pipeline and User Workflow
The end-to-end pipeline for multi-hop question answering operates as follows:
- The user submits a question to the system’s front end.
- The QA agent invokes the hybrid retrieval mechanism, returning a ranked set of sections and their texts.
- Retrieved passages and citations are provided to a summarization LLM agent, which condenses, filters, and synthesizes the final answer, attaching provenance (section IDs).
- The web UI presents the answer and original source passages, with hyperlinks to the authoritative regulatory documents (Zhang et al., 18 Jul 2025).
In federated/confidential deployments, user queries are broadcast to silos, aggregated securely, then processed as above by in-enclave or CRC-proxied LLMs (Stripelis et al., 26 Mar 2026).
6. Empirical Results and Evaluation
Evaluation of BifrostRAG on multi-hop QA over construction safety regulations (OSHA 1926 subparts) utilized 93 expert-crafted questions. Baselines included: GPT-4o (no RAG), vector-based RAG, and graph-based RAG. Metrics comprised precision, recall, and F1, each computed over referenced regulatory sections:
- 0
| System | Precision | Recall | F1 |
|---|---|---|---|
| BifrostRAG | 92.8% | 85.5% | 87.3% |
| Vector-RAG | 91.1% | 69.5% | 75.0% |
| Graph-RAG | 71.4% | 50.8% | 56.5% |
| No RAG | 25.8% | 40.7% | 29.1% |
Statistical tests (Friedman test 1; Bonferroni-corrected pairwise) confirm BifrostRAG’s superiority, especially in recall (2 vs. vector-RAG) (Zhang et al., 18 Jul 2025).
For federated settings (PubMedQA, BioASQ, MedQA), accuracy and latency were benchmarked under standalone, cascading, and confidential (CRC) modes, showing up to 46% relative accuracy improvement with negligible privacy overhead (<5% latency increase) (Stripelis et al., 26 Mar 2026).
7. Failure Modes and Error Analysis
Detailed error analysis identified characteristic strengths and limitations:
- Short, ambiguous queries (Cluster 1): All dual-graph systems (including BifrostRAG) may yield overly broad retrievals due to high-frequency terms; vector-RAG can filter such noise more robustly via semantic weighting.
- Complex, context-dependent phrasing (Cluster 2): Graph-only systems are brittle due to reliance on exact string matches; the hybrid entity/triple matching in BifrostRAG improves recall for domain-specialized language.
- Deep multi-hop chains (Cluster 3): Vector-only systems often lose connectivity (context is broken across chunks); graph-only systems do not recognize implicit cross-references. The hybrid mechanism in BifrostRAG most successfully unifies explicit and latent connection paths, achieving the highest recall rates (Zhang et al., 18 Jul 2025).
8. Implementation and Deployment Considerations
- Backend: Neo4j is used for both ENG and DNG storage. Hybrid retrieval relies on vector similarity (e.g., cosine, as 3), Cypher graph traversal, and fast embedding-based search.
- Front end: The web interface provides interactive access, answer highlighting, and direct links to underlying documents.
- Federated deployment: Flower orchestration, attestation-driven trusted execution (SGX), and optional auxiliary LLM hints enable secure, high-accuracy RAG workflows across distributed, privacy-sensitive environments. Flower codebase encompasses server/client scripts, enclave logic (Rust on SGX), and Kubernetes deployment (Stripelis et al., 26 Mar 2026).
BifrostRAG thus advances the state of the art in retrieval-augmented QA by tightly integrating semantic and structural graph modeling, hybrid retrieval, and secure, federated inference, enabling robust, multi-hop reasoning over complex and regulated document collections.