简体中文 | English
Neural-Symbolic Question Answering
Academic paper QA with hybrid retrieval, knowledge graph, and multi-hop reasoning
- PDF Parsing — MinerU-powered academic PDF extraction with multi-view classification (text, table, formula, image)
- Multi-View Retrieval — Per-view-type embedding and storage for precise semantic search
- Hybrid Search — Neural + lexical (BM25) + symbolic (conference/year filter) triple retrieval
- Knowledge Graph — Paper triple extraction → Neo4j graph → KG-enhanced retrieval
- Multi-Hop Reasoning — Automatic multi-hop evidence discovery and fusion across papers
- Formula & Table Support — Dedicated formula normalization, semantic anchor enhancement
- Evaluation Framework — Built-in benchmark system with rule-based + LLM-backed scoring
- Model Pool — Multi-LLM routing with round-robin / least-active strategies
┌─────────────────────────────────────────────────────────┐
│ NSQA System │
│ │
│ PDF ──► MinerU Parse ──► Multi-View Classify ──► Chunk │
│ │ │
│ ┌──────────────┘ │
│ ▼ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ Vector │ │ BM25 │ │ Symbolic │ ◄─ Hybrid │
│ │ (Milvus) │ │ (MySQL) │ │ Filter │ Search │
│ └────┬─────┘ └────┬─────┘ └────┬─────┘ │
│ └──────────┬───┘──────────┬──┘ │
│ ▼ ▼ │
│ ┌──────────────┐ ┌───────────┐ │
│ │ Answer Gen │ │ KG (Neo4j)│ │
│ │ + Judge │ │ Multi-Hop │ │
│ └──────────────┘ └───────────┘ │
│ │ │
│ ▼ │
│ Evaluation Report │
└─────────────────────────────────────────────────────────┘
- Python 3.11+
- MySQL 8.0+
- Milvus 2.x
- Neo4j 5.x (optional, for KG retrieval)
- MinerU API token (mineru.net)
git clone https://github.com/ArtLjn/NSQA.git
cd NSQA
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtcp src/config/config.example.ini src/config/config.ini| Section | What to configure |
|---|---|
[mineru] |
api_token — your MinerU API token |
[mysql] |
host, user, password — MySQL connection |
[milvus] |
host, port — Milvus vector DB |
[neo4j] |
uri, user, password — Neo4j graph DB |
[embedding] |
provider — google / openai / local / ollama |
[llm_evaluation] |
api_key, base_url, model — LLM backend |
mysql -u root -p < sql/airqa_neusym.sql# Development
./start_api.sh
# Production (Linux)
./deploy/scripts/bootstrap_linux.sh # first time setup
./deploy/scripts/start_airqa.sh # start service- API: http://localhost:8081
- Docs: http://localhost:8081/docs
- Frontend: http://localhost:8081/static/index.html
cd deploy
cp config/config.example.ini src/config/config.ini # edit credentials
docker compose up --buildNSQA/
├── src/
│ ├── api/ # FastAPI routes & schemas
│ ├── chunking/ # PDF parsing, multi-view classification, embedding
│ ├── retrieval/ # Hybrid retriever, KG, multi-hop, context enhancer
│ ├── evaluation/ # Benchmark, scoring, answer generation
│ ├── services/ # Task management, sync coordination
│ ├── config/ # Configuration & model pool
│ └── db/ # MySQL connection pool
├── scripts/ # Utility & maintenance scripts
├── frontend/ # Web UI (vanilla HTML/JS)
├── deploy/ # Docker, systemd, bootstrap scripts
├── tests/ # pytest test suite
├── docs/ # Documentation
├── sql/ # Database schema
└── data/ # Runtime data (gitignored)
NSQA includes a built-in evaluation framework that compares retrieval backends:
POST /api/evaluation/batch-evaluate
{
"backend": "both", # airqa / kg / both
"sample_source": "all",
"max_workers": 2
}Results are rendered as interactive frontend reports with per-sample analysis.
| Component | Technology |
|---|---|
| API Framework | FastAPI + Uvicorn |
| PDF Parsing | MinerU (VLM) |
| Vector DB | Milvus |
| Graph DB | Neo4j |
| Relational DB | MySQL 8.0 |
| Embedding | Google Gemini / OpenAI / Ollama |
| LLM | ModelScope / OpenAI-compatible APIs |
| Frontend | Vanilla HTML/CSS/JS |