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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
tags:
|
| 6 |
+
- retrieval-augmented-generation
|
| 7 |
+
- rag
|
| 8 |
+
- causal-reasoning
|
| 9 |
+
- hallucination-reduction
|
| 10 |
+
- semantic-drift
|
| 11 |
+
- context-window-poisoning
|
| 12 |
+
- multi-hop-qa
|
| 13 |
+
- information-retrieval
|
| 14 |
+
- nlp
|
| 15 |
+
- question-answering
|
| 16 |
+
library_name: vortexrag
|
| 17 |
+
pipeline_tag: question-answering
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
+
# VORTEXRAG Framework
|
| 21 |
+
|
| 22 |
+
**Vector Orthogonal Resonance-Tuned EXtraction Retrieval-Augmented Generation**
|
| 23 |
+
|
| 24 |
+
A unified 7-layer RAG framework that simultaneously eliminates **Semantic Drift** and **Context Window Poisoning** — the two compounding failure modes that undermine factual grounding in standard RAG systems.
|
| 25 |
+
|
| 26 |
+
## Key Results
|
| 27 |
+
|
| 28 |
+
| Metric | VORTEXRAG | vs Naive RAG | vs CRAG | vs Self-RAG |
|
| 29 |
+
|--------|-----------|--------------|---------|-------------|
|
| 30 |
+
| EM | **74.8** | +13.6 | +7.9 | +6.4 |
|
| 31 |
+
| F1 | **82.6** | +14.2 | +8.3 | +6.7 |
|
| 32 |
+
| Faithfulness | **0.94** | +0.23 | +0.16 | +0.13 |
|
| 33 |
+
| Semantic Drift Reduction | **61%** | — | — | — |
|
| 34 |
+
| Context Poison Reduction | **71%** | — | — | — |
|
| 35 |
+
| Added Latency | **45ms** | — | 2.5× faster | 2.2× faster |
|
| 36 |
+
|
| 37 |
+
Evaluated on NQ + HotpotQA + MuSiQue + 2WikiMultiHopQA (31,240 total questions).
|
| 38 |
+
|
| 39 |
+
## The 7-Layer Pipeline
|
| 40 |
+
|
| 41 |
+
```
|
| 42 |
+
Query
|
| 43 |
+
│
|
| 44 |
+
▼
|
| 45 |
+
[L1: TVE] Tri-Vector Encoding
|
| 46 |
+
│ v = [α·sem(768d); β·syn(64d); γ·cau(32d)]
|
| 47 |
+
│ Encodes text as orthogonal semantic+syntactic+causal vectors
|
| 48 |
+
│
|
| 49 |
+
▼
|
| 50 |
+
[L2: VRC] Vortex Retrieval Cone
|
| 51 |
+
│ spiral_rank = TVE·e^{−λr}·cos(nθ)
|
| 52 |
+
│ Geometric suppression of causally orthogonal chunks (θ > 45°)
|
| 53 |
+
│
|
| 54 |
+
▼
|
| 55 |
+
[L3: SDC] Semantic Drift Corrector ← per-chunk causal gate
|
| 56 |
+
│ SDS = 1 − tanh(‖v_cau(q) − v_cau(c)‖ / τ) ≥ 0.72
|
| 57 |
+
│ Eliminates individual semantic drift
|
| 58 |
+
│
|
| 59 |
+
▼
|
| 60 |
+
[L4: CPG] Context Poison Guard ← window-level quality gate
|
| 61 |
+
│ ESR = Σ SDS·w / (P+ε) ≥ 3.5
|
| 62 |
+
│ Greedy-optimal purging (Theorem 5.1)
|
| 63 |
+
│
|
| 64 |
+
▼
|
| 65 |
+
[L5: RFG] Rank Fusion Gate
|
| 66 |
+
│ Φ = TVE^α × SDS^β × ESR_contrib^γ (multiplicative, no-weak-link)
|
| 67 |
+
│
|
| 68 |
+
▼
|
| 69 |
+
[L6: CCB] Causal Context Builder
|
| 70 |
+
│ pos = rank(Φ+) × causal_depth
|
| 71 |
+
│ Root-cause chunks at pos=0 (U-shaped LLM recall exploitation)
|
| 72 |
+
│
|
| 73 |
+
▼
|
| 74 |
+
[L6: LLM] Generation
|
| 75 |
+
│
|
| 76 |
+
▼
|
| 77 |
+
[L7: FV] Faithfulness Verifier ←──────────────── regeneration loop ──┐
|
| 78 |
+
│ ΔR = 1 − ROUGE-L × NLI ≤ 0.15 │
|
| 79 |
+
│ DeBERTa-v3-small CrossEncoder NLI │
|
| 80 |
+
└─── if ΔR > δ_FV: re-weight RFG → retry (max 3 iterations) ────────┘
|
| 81 |
+
│
|
| 82 |
+
▼
|
| 83 |
+
Answer* (argmin ΔR across iterations)
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
## Quick Start
|
| 87 |
+
|
| 88 |
+
```bash
|
| 89 |
+
pip install vortexrag
|
| 90 |
+
```
|
| 91 |
+
|
| 92 |
+
```python
|
| 93 |
+
from vortexrag import VortexRAG, VortexConfig
|
| 94 |
+
|
| 95 |
+
# Initialize with domain preset
|
| 96 |
+
config = VortexConfig(domain="general") # general, medical, legal, financial, code...
|
| 97 |
+
rag = VortexRAG(config)
|
| 98 |
+
|
| 99 |
+
# Index your documents
|
| 100 |
+
rag.index(["Document 1...", "Document 2...", "Document 3..."])
|
| 101 |
+
|
| 102 |
+
# Query
|
| 103 |
+
result = rag.query("Why did X cause Y rather than Z?")
|
| 104 |
+
print(result.answer)
|
| 105 |
+
print(f"Faithfulness: ΔR={result.delta_r:.3f}")
|
| 106 |
+
print(f"Context Quality: ESR={result.esr:.3f}")
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
## Domain Presets
|
| 110 |
+
|
| 111 |
+
VORTEXRAG ships with 11 pre-calibrated domain parameter vectors:
|
| 112 |
+
|
| 113 |
+
| Domain | τ | θ_CPG | γ (causal) | β (syntactic) | Use Case |
|
| 114 |
+
|--------|---|-------|-----------|--------------|----------|
|
| 115 |
+
| `general` | 0.80 | 3.5 | 0.25 | 0.25 | Default balanced |
|
| 116 |
+
| `medical` | 0.35 | 5.0 | **0.40** | 0.15 | Drug mechanisms, clinical QA |
|
| 117 |
+
| `legal` | 0.40 | 4.5 | 0.35 | **0.30** | Precedent chains, statutory analysis |
|
| 118 |
+
| `scientific` | 0.30 | 4.0 | **0.40** | 0.20 | Physics, chemistry, biology |
|
| 119 |
+
| `financial` | 0.50 | 3.5 | 0.30 | 0.25 | Market causation, risk analysis |
|
| 120 |
+
| `code` | 0.60 | 3.5 | 0.25 | **0.45** | Debugging, AST-structured retrieval |
|
| 121 |
+
| `cybersecurity` | 0.45 | 4.0 | 0.35 | 0.30 | Exploit chains, threat intel |
|
| 122 |
+
| `educational` | 0.65 | 3.0 | 0.25 | 0.20 | Concept progression, tutoring |
|
| 123 |
+
| `historical` | 0.90 | 3.0 | 0.35 | 0.20 | Event causation chains |
|
| 124 |
+
| `creative` | 1.20 | 2.5 | 0.15 | 0.20 | Thematic retrieval |
|
| 125 |
+
|
| 126 |
+
## Theoretical Contributions
|
| 127 |
+
|
| 128 |
+
- **Theorem 5.1 (CPG Greedy Optimality):** Per-step removal of argmin SDS maximizes ΔESR. Proof via monotone derivative argument.
|
| 129 |
+
- **Corollary 5.1 (Convergence):** Purge terminates in ≤|W|−3 steps with strictly monotone increasing ESR.
|
| 130 |
+
- **Proposition 10.1 (TVE Orthogonality):** Cross-arm correlation ρ < 0.08 empirically via Johnson-Lindenstrauss.
|
| 131 |
+
- **CCB Positional Optimality:** Optimal under U-shaped recall model f(pos) ≈ ½(1+cos(π·pos/L)) (Liu et al. 2023).
|
| 132 |
+
|
| 133 |
+
## Ablation Results
|
| 134 |
+
|
| 135 |
+
Every layer contributes:
|
| 136 |
+
|
| 137 |
+
| Layer Added | EM | ΔEM | Insight |
|
| 138 |
+
|-------------|----|----|---------|
|
| 139 |
+
| Baseline | 61.2 | — | Standard cosine RAG |
|
| 140 |
+
| + TVE | 65.3 | +4.1 | Causal encoding separates mechanism from consequence |
|
| 141 |
+
| + VRC | 67.8 | +2.5 | Geometric filtering of causally orthogonal docs |
|
| 142 |
+
| + SDC | 70.4 | +2.6 | Per-chunk SDS gate eliminates individual drift |
|
| 143 |
+
| + CPG | 72.1 | +1.7 | Window ESR constraint (+39pp context poisoning reduction) |
|
| 144 |
+
| + RFG | 73.4 | +1.3 | Multiplicative no-weak-link fusion |
|
| 145 |
+
| + CCB | 73.9 | +0.5 | Root-cause chunks at attention-peak position |
|
| 146 |
+
| + FV | **74.8** | +0.9 | Faithfulness gate with regeneration loop |
|
| 147 |
+
|
| 148 |
+
## Links
|
| 149 |
+
|
| 150 |
+
- 📄 **Research Paper:** https://doi.org/10.5281/zenodo.20285144
|
| 151 |
+
- 💻 **GitHub:** https://github.com/vignesh2027/VORTEXRAG
|
| 152 |
+
- 🌐 **Docs:** https://vignesh2027.github.io/VORTEXRAG
|
| 153 |
+
- 🤗 **Live Demo:** https://huggingface.co/spaces/vigneshwar234/VORTEXRAG
|
| 154 |
+
- 📊 **Benchmarks:** https://huggingface.co/datasets/vigneshwar234/VORTEXRAG-Benchmarks
|
| 155 |
+
|
| 156 |
+
## Citation
|
| 157 |
+
|
| 158 |
+
```bibtex
|
| 159 |
+
@article{vignesh2026vortexrag,
|
| 160 |
+
title = {{VORTEXRAG}: Vector Orthogonal Resonance-Tuned EXtraction
|
| 161 |
+
Retrieval-Augmented Generation},
|
| 162 |
+
author = {Vignesh L},
|
| 163 |
+
year = {2026},
|
| 164 |
+
month = {May},
|
| 165 |
+
doi = {10.5281/zenodo.20285144},
|
| 166 |
+
url = {https://github.com/vignesh2027/VORTEXRAG},
|
| 167 |
+
note = {Independent Research Preprint. v2.0. MIT License.},
|
| 168 |
+
keywords= {RAG, Semantic Drift, Context Window Poisoning, Causal NLP,
|
| 169 |
+
Multi-Hop QA, Faithfulness Verification}
|
| 170 |
+
}
|
| 171 |
+
```
|
| 172 |
+
|
| 173 |
+
**Author:** Vignesh L — Independent Researcher
|
| 174 |
+
**ORCID:** https://orcid.org/0009-0004-9777-7592
|
| 175 |
+
**License:** MIT
|
| 176 |
+
**Version:** v2.0 — May 2026
|