Skip to content

Experimental semantic search backend based on Deferred Re-computation Search (DRS), inspired by the LEANN architecture.

License

Notifications You must be signed in to change notification settings

devicemxl/drs-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

drs-backend

High-Efficiency Vector Retrieval via Directed Recomputational Search (DRS)

drs-backend is an experimental semantic search engine based on the Directed Recomputational Search (DRS) framework. Heavily inspired by the LEANN architecture, this Go implementation explores the radical tradeoff of exchanging storage for computation.

🎯 The Core Philosophy: Ontological Frugality

In traditional vector databases, the architecture acts as a "cartographer," attempting to store massive, dense mathematical representations of every data fragment. drs-backend follows the DRS paradigm: true intelligence resides not in storing the object, but in the mastery of reconstructing it exactly when needed.

Key Principles:

  1. Ontological Separation: Strict distinction between Persistent Structural State () and Derivable Exact State ().
  2. Minimal Persistence: Zero storage of dense embeddings. We only persist the structural DNA (graph topology + quantization codes) needed to guide the search.
  3. Total Derivability: All exact signals are recomputed on-the-fly from raw data and the query, ensuring absolute semantic fidelity.

✨ Main Features

  • Strict DRS Implementation: Not a "pure approximation" system; the final decision is always governed by exact signals.
  • Off-Heap Memory Management: Optimized for Go using Argo, bypassing Garbage Collector (GC) overhead for massive structural indices.
  • Recomputation as a Service: Explicit control over the recomputation budget to manage hardware utilization (GPU/Inference) vs. latency.
  • Semantic Correction Proofs: Comprehensive test suites (including the "Approx Lies" test) ensuring that DRS corrects approximation noise.

🔍 How it Works: The Two-Level Search Algorithm

  1. Query Encoding: The incoming query is encoded into an exact embedding (not persisted).
  2. Graph Navigation (Level 1): The space is explored using cheap, approximate signals (e.g., PQ codes) stored off-heap.
  3. Directed Recomputation (Level 2): Promising candidates identified during exploration are sent to the EmbeddingServerManager for exact reconstruction.
  4. Final Decision: The top-k ranking is based exclusively on exact recomputed distances.

🗂️ Repository Structure

drs-backend/
├── internal/
│   ├── searcher/      # Online DRS Algorithm & Two-level logic
│   │   ├── algorithm.go
│   │   ├── queues.go  # Exploration vs. Decision structures
│   │   └── *_test.go
│   ├── graph/         # CSR Graph structures (Argo-managed off-heap)
│   ├── embedding/     # Recomputation clients (Real Inference + Mocks)
│   └── types/         # Shared architectural contracts
├── docs/              # Deep dives into the DRS Ontology
├── go.mod
└── README.md


⚖️ Licensing & Contributions

Important

Licensing Information: This project is Source-Available. It is free for personal, academic, and research use. Commercial use (SaaS, internal production, or redistribution) requires a separate license. See ⚖️ Licensing for details.

Commercial Use

This software and the specific implementation of the DRS paradigm herein are the proprietary technology of [Your Name/Company].

  • Personal/Research Use: Free and encouraged.
  • Commercial Use: Prohibited without a Commercial License Agreement. This includes SaaS deployments, internal production tools, or inclusion in proprietary products.

For commercial inquiries, please contact: [Your Email/Contact]

🤝 Contributing (CLA)

We welcome contributions to optimize this engine! Please note that by submitting a Pull Request, you agree to our Contributor License Agreement (CLA). By contributing, you grant the author the irrevocable right to use, modify, and re-license your contributions as part of both commercial and non-commercial versions of this project.

See CONTRIBUTING.md for the full CLA text.


🚧 Roadmap (v0)

  • Correct and stable DRS search loop.
  • Basic recomputation batching.
  • Off-heap memory integration via Argo.
  • Global batching & Inference caching.
  • Graph pruning & HNSW/DiskANN backend integration.
  • Real-time Product Quantization (PQ) scoring.
  • High-performance Go SIMD distance kernels.

🧭 Project Philosophy

  1. Correctness First: Ensure the algorithm obeys the 14 DRS Invariants.
  2. Understanding over "Black Magic": Explicit logic over opaque optimizations.
  3. Performance Second: Optimization follows algorithmic verification.

If you understand this code, you understand the future of efficient RAG and high-scale vector retrieval.

About

Experimental semantic search backend based on Deferred Re-computation Search (DRS), inspired by the LEANN architecture.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages