LocalScholar is a fully locally deployed academic paper retrieval and question-answering system; it handles the entire process from retrieval to generation without relying on any external large model APIs.
- Install PostgreSQL and Docker Desktop
- Copy and paste ./db/schema.sql into PostgreSQL or run ./db/init_db.py to create table.
- Run ./ingestion/ingestor.py to fetch and store paper information from arXiv. Option: run ./ingestion/ss_enricher.py to crawl and store each paper's citation count.
- Store paper vectors in Qdrant. See Vector database (Qdrant) below.
Qdrant runs locally in Docker. No Qdrant Cloud account is required. Paper vectors are written by ingestion/embedder.py, which reads title and abstract from PostgreSQL, encodes them with SPECTER2 (proximity adapter), and upserts them into the papers_abstract collection.
- Vector size: 768 (fixed by SPECTER2)
- Distance: cosine
- Point id: deterministic UUID from
arxiv_id(safe to re-run) - Payload:
arxiv_id,title,submitted_date,primary_category,citation_count,venue
Connection settings live in .env:
QDRANT_HOST=localhost
QDRANT_PORT=6333
Open Docker Desktop from the Start menu and wait until it is fully running (the whale icon in the taskbar stops animating). The Docker CLI cannot create containers until the Desktop daemon is up.
From the project root in PowerShell:
docker run -d --name qdrant-localscholar -p 6333:6333 -p 6334:6334 -v "${PWD}/data/qdrant_storage:/qdrant/storage" qdrant/qdrantThis pulls the qdrant/qdrant image on first use, listens on port 6333, and stores data in data/qdrant_storage so vectors survive a container restart.
If the container already exists, start it instead of creating it again:
docker start qdrant-localscholarpip install -r requirements.txtembedder.py needs qdrant-client, torch, transformers, and adapters.
PostgreSQL must already contain papers (ingestion/ingestor.py, and optionally ingestion/ss_enricher.py). Then:
python ingestion/embedder.pyThe first run downloads SPECTER2 (allenai/specter2_base plus the proximity adapter, about 440 MB) into the Hugging Face cache at C:\Users\<you>\.cache\huggingface\hub\. Later runs use that cache.
Open http://localhost:6333/dashboard.
- Collection
papers_abstractis the vector table. - The Points tab lists each paper's id and payload (title, date, category, citation count, venue).
- Graph shows the selected paper (yellow) and its nearest neighbors (green).
limitis how many neighbors to return. - Find similar runs a cosine search from that paper's vector and returns the closest papers.