Quantum Insights, a RAG Pipeline over ArXiv Papers
A RAG research assistant that makes quantum physics literature accessible at every level: ArXiv search, LLM-powered synthesis and simplification, code extraction, with an explanation level adjustable from beginner to expert. A complete pipeline, from embeddings to generation, deployed on AWS.
mriusero/gen-ai-quantum-insightQuantum Insights is an AI-driven tool designed to make quantum physics research accessible to everyone. It offers easy-to-understand summaries, concept explanations, and code insights from quantum publications, bridging the gap between advanced research and the wider community.The subject
Quantum physics research moves fast and stays hermetic: jargon, mathematical formalism, publication volume. Quantum Insights lowers that barrier by turning ArXiv papers into explanations tailored to the reader’s level, from newcomer to researcher.
Features
- Research summaries: search and extraction of key information from the latest ArXiv papers.
- Concept explanation: complex topics broken down into simple, progressive notions.
- Code explanation: code snippets illustrating the concepts, identified and explained in context.
- Adjustable level: the same scientific source explained for a beginner, intermediate, advanced or expert audience.
The RAG architecture
A retrieval-augmented generation pipeline assembled end to end, indexing 300 ArXiv papers into roughly 8,700 vector chunks.
- Ingestion: incremental sync with the ArXiv API into SQLite, insert or update on revision, so a re-run only embeds what actually changed. 225 PDFs loaded in parallel batches.
- Chunking: structure-aware rather than fixed-width. SpaCy segments sentences, paragraphs are packed up to 512 tokens measured with the model’s own tokenizer, with 206 tokens of overlap so equations stay attached to the text that explains them.
- Indexing: embeddings with sentence-transformers (all-MiniLM-L6-v2), persistent vector storage in ChromaDB.
- Retrieval and generation: the top 5 passages are retrieved from ChromaDB, then LLaMA 2 (7B chat) generates the answer at the requested level through the Hugging Face Inference endpoint.
- Hardware: ingestion, embeddings and retrieval run entirely on CPU, with no GPU anywhere in the pipeline. Only the 7B generation is delegated to a remote endpoint.
- Context budget: the 4,096-token window is the binding constraint. Prompt and history are counted with the LLaMA 2 tokenizer, surfaced live in the interface, and the conversation history is truncated to keep the answer inside the window.
- Industrialization: Streamlit interface, Docker image, GitHub Actions pipeline (lint, health check, image build) and deployment to AWS ECS.
The 2024 constraint
Built on LLaMA 2 7B chat, called through a raw text-generation endpoint: no chat template, no tool calling, no structured output. In practice the model behaved closer to a completion engine than to today’s instruction-following LLMs. Everything current frameworks hand you had to be written by hand: chunking, embeddings and persistence, retrieval, prompt assembly, conversational memory, and a generation loop that re-queries the model until the answer stabilizes, to compensate for truncated outputs.
Limits
No reranking stage, no automated evaluation of answer quality, a single generation model. On a 2024 open-source 7B, the context budget was the binding constraint on every answer. A systematic evaluation harness is what I would add first today.
Overview

What the project demonstrates
The entire RAG stack built by hand, before frameworks made it a default: structure-aware chunking, retrieval, conversational memory and token-budget management written from scratch under a 4,096-token window. Owning those internals is exactly what it takes today to debug retrieval quality, contain context costs and design the evaluation harness this pipeline still lacks.