Skip to content

About

BUPT-SE 2024 Fall 大数据实践项目

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

ArxivRAG

Search and chat over arXiv papers, built for the BUPT big-data practicum (fall 2024).

Two retrievers look at the corpus differently. A FAISS index of bge-m3 embeddings over computer-science papers finds passages that mean what the question means. Elasticsearch over the full arXiv metadata snapshot finds the paper when you remember a title, an author or an ID. Results from both are merged and reordered by a cross-encoder reranker. In chat mode, an LLM first rewrites the question into a search phrase, then answers from the retrieved passages and cites them.

flowchart LR
    U([Next.js client]) -->|GET /search| S[SearchService]
    U -->|POST /chat| C[ChatService]
    S --> V[(FAISS<br/>bge-m3)]
    S --> E[(Elasticsearch<br/>arXiv metadata)]
    V & E --> R[bge-reranker-large] --> S
    C --> Q[LLM query rewrite] --> V
    V --> A[LLM answer with sources] --> C
Loading

Features

  • Search mode. Top results with title, authors, abstract, a relevance score and a link to the PDF.
  • Chat mode. Conversational answers in Markdown with code highlighting, grounded in retrieved passages.
  • One process, shared models. Embedding model, vector store, reranker, LLM client and Elasticsearch connection are loaded once and shared across requests.
  • Bulk indexing. api/services/es_op/ creates the arxiv index and bulk-loads the metadata snapshot line by line.

Run it

Backend (Python 3.10, a CUDA GPU, Elasticsearch on localhost:9200, an OpenAI-compatible API key):

cd api
pip install -r requirements.txt
python services/es_op/create_index.py
python services/es_op/insert_doc.py  # path to arxiv-metadata-oai-snapshot.json
python main.py                       # FastAPI on :9090

Frontend:

npm install
npm run dev                          # http://localhost:3000

Model paths, the FAISS index location and the LLM endpoint are configured in api/services/shared_resources.py. Read the API key from an environment variable rather than writing it into the file. The FAISS index is built offline from converted paper text and loaded from disk at startup.

Project notes

  • Course project, built in December 2024 and not maintained.

Stack

Python, FastAPI, LangChain, FAISS, sentence-transformers (bge-m3), FlagEmbedding / Transformers (bge-reranker-large), Elasticsearch, TypeScript, Next.js 15, React 19, Tailwind CSS.

About

BUPT-SE 2024 Fall 大数据实践项目

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages