Skip to content

[PERF] Optimized Vector Search with FAISS Persistence #192

Description

@Adithyakp86

🔴 Problem
Currently,
engine/rag_engine.py
performs a manual cosine similarity search using np.dot in a loop over Python lists. This is $O(N)$ and will cause significant latency as the legal PDF library grows. Furthermore, embeddings are stored only in memory, meaning every application restart triggers a full, expensive re-indexing process.

✅ Proposed Solution
FAISS Integration: Replace manual loops with faiss-cpu to enable sub-linear search time.
Persistence Layer: Implement index.save() and index.load() logic to store embeddings in vector_store/index.faiss.
Delta Indexing: Introduce a hash-based file scanner (SHA-256) for law_pdfs/. The system should only embed new or modified documents, skipping existing ones to save CPU/RAM on startup.

Assign this issue to me under the oscg

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions