Skip to content

VectorJet/drag

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DRAG: Domain-Routed Adaptive Decay for Temporally Heterogeneous Retrieval

Standard retrieval treats all documents as equally persistent. DRAG applies domain-aware decay so volatile facts expire while persistent knowledge survives.

Any uniform temporal decay forces a strict Pareto trade-off: decay aggressively enough to suppress stale stock prices and you also bury valid corporate profiles; decay gently enough to preserve reference material and outdated news contaminates results. DRAG breaks this frontier by applying distinct half-lives per document domain — a simple multiplicative weight on standard ANN cosine similarity scores.

Key Results

Method Overall MRR Reference MRR News MRR
HNSW raw 0.709 0.966 0.452
Best uniform decay (h=5.0) 0.914 0.946 0.882
DRAG (domain-aware) 0.958 0.966 0.950

On a synthetic financial corpus with genuine temporal invalidity, DRAG simultaneously maximizes retrieval of persistent reference material and volatile news — something no single decay rate can achieve.

Full Results Summary

Experiment Question Result
1. Semantic Separability Does the 64D projection preserve retrieval structure? ✅ 1.40 separation ratio vs 1.14 baseline; 98.3% triplet accuracy
2. Retrieval Quality Does Lightcone geometry beat HNSW? ❌ NDCG@10 = 0.008 vs HNSW+TW = 0.642
2b. Compression Ablation Is the failure caused by 64D compression? ❌ 384D Lightcone NDCG@10 = 0.011 — cone geometry itself fails
2c. Per-Query c Does per-query calibration rescue the geometry? ❌ NDCG@10 = 0.019 — still 33× worse than HNSW+TW
2d. Minkowski Reranking Does τ work as a reranker on HNSW candidates? ❌ Every reranker degrades HNSW quality
2e. Dense Timestamps Does temporal density help the geometry? ❌ Converges to parity — reduces to cosine ranking
2f. DRAG (geometric) Does domain routing with Minkowski scoring help? ❌ Best variant is the one with no temporal scoring
2g. Heterogeneous Corpus Does domain-aware decay beat uniform decay? ✅ +0.118 NDCG over time filter
2h. Independent GT Does decay help on timeless factual QA? ❌ Decay hurts — answers don't expire
2i. Time-Varying Corpus Does DRAG break the Pareto frontier? MRR = 0.958 vs 0.914 best uniform
2j. Learned Profiles Can decay profiles be learned without labels? ⚠️ Learns direction but not persistence scale
2k–2m. StackOverflow Does the result replicate on real-world data? ✅ Persistent domain validated; volatile limited by frozen GT
3. Concentration of Measure Does the cone filter discriminate at 64D? ✅ Tunable, but temporally — not semantically

How It Works

Ingestion:
  chunk → encoder → embedding → ANN index
        → domain classifier → decay profile (half_life, floor)
        → timestamp

Query:
  query → encoder → ANN top-K → reweight by cos_sim × decay_weight → top-k
score(q, d) = cos_sim(q, d) × max(exp(-0.693 × Δt / half_life), floor)

Two parameters per domain: a half-life (how fast relevance decays) and an importance floor (minimum weight regardless of age).

Repository Structure

├── paper/
│   ├── drag.md                   # Standalone DRAG paper
│   ├── iteration-7.md            # Full empirical paper (LRAG + DRAG)
│   ├── iteration-6.md            # Earlier empirical paper
│   ├── iteration-5.md            # Pre-experiment theoretical paper
│   ├── lightcone_paper-iter-5-1.md
│   └── citations_search.json     # arXiv citation search results
├── experiments/
│   ├── local/                    # Standalone Python scripts (run anywhere)
│   │   ├── experiment_1.py       # Semantic separability
│   │   ├── experiment_2.py       # Retrieval quality vs HNSW
│   │   ├── experiment_2b.py      # 384D compression ablation
│   │   ├── experiment_2c.py      # Per-query c calibration
│   │   ├── experiment_2d.py      # Minkowski reranking
│   │   ├── experiment_2e.py      # Dense timestamp configs
│   │   ├── experiment_2f.py      # Domain-routed adaptive geometry
│   │   ├── experiment_2g.py      # Heterogeneous corpus decay
│   │   ├── experiment_2h.py      # Independent ground truth
│   │   └── experiment_3.py       # Concentration of measure
│   └── modal/                    # Modal cloud versions (GPU)
│       ├── experiment_1.py
│       ├── experiment_2.py – experiment_2m.py
│       └── experiment_3.py
├── results/                      # Raw JSON results from all experiments
│   ├── experiment_1_results.json
│   ├── experiment_2_results.json – experiment_2m_results.json
│   └── experiment_3_results.json
└── findings/                     # Per-experiment analysis writeups
    ├── experiment_1.md
    ├── experiment_2.md – experiment_2j.md
    └── experiment_3.md

Running the Experiments

Local (CPU or GPU)

pip install torch numpy scikit-learn sentence-transformers datasets hnswlib

# Experiment 1: Semantic separability (~2 min on GPU, ~10 min on CPU)
python experiments/local/experiment_1.py --device cuda

# Experiment 2: Retrieval quality vs HNSW (~5 min on GPU)
python experiments/local/experiment_2.py --device cuda

# Experiment 2b–2h: Repair strategies and decay experiments
python experiments/local/experiment_2b.py --device cuda
python experiments/local/experiment_2c.py --device cuda
python experiments/local/experiment_2d.py --device cuda
python experiments/local/experiment_2e.py --device cuda
python experiments/local/experiment_2f.py --device cuda
python experiments/local/experiment_2g.py --device cuda
python experiments/local/experiment_2h.py --device cuda

# Experiment 3: Concentration of measure (~3 min on GPU)
python experiments/local/experiment_3.py --device cuda

Modal (cloud GPU)

pip install modal
modal setup

modal run experiments/modal/experiment_1.py
modal run experiments/modal/experiment_2.py
# ... through experiment_2m.py
modal run experiments/modal/experiment_3.py

Results are saved to results/ (local) or the Modal volume (cloud).

Background

This repository began as an investigation into Lightcone Retrieval — modeling documents as events in a Lorentzian manifold with the Minkowski interval as a retrieval metric. That geometric approach failed decisively (see experiments 2–2f). However, the differential decay model proposed alongside the geometry — the idea that different document types should persist at different rates — proved empirically sound. DRAG extracts and validates that positive result as a standalone contribution.

Citation

@software{drag_2026,
  author       = {VectorJet},
  title        = {DRAG: Domain-Routed Adaptive Decay for Temporally Heterogeneous Retrieval},
  year         = {2026},
  url          = {https://github.com/VectorJet/drag},
  note         = {Domain-aware decay breaks the uniform-decay Pareto frontier on temporally heterogeneous corpora}
}

License

MIT

About

Domain-routed adaptive decay experiments for temporally heterogeneous retrieval.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages