* local question answering over analysis notebooks with LightRAG, Neo4j, Qdrant and Ollama * RAGAS evaluation with a generator x judge comparison matrix, fully local * docs in README and OKF
5.8 KiB
askme
Local question answering over your own analysis notebooks (.ipynb, .Rmd,
.py, .R). askme builds a LightRAG
knowledge graph from the notebooks and answers questions grounded in them —
fully local: models run in Ollama, nothing leaves the machine.
Built for bioinformatics notebooks (scanpy, scRNA-seq, spatial transcriptomics), but nothing in the pipeline is domain-specific.
Stack
| Service | Role |
|---|---|
| Ollama | LLM (default qwen2.5:7b) and embeddings (nomic-embed-text) |
| Neo4j | knowledge graph |
| Qdrant | vectors for chunks, entities, relations |
| askme | ingestion, query CLI, FastAPI server, evaluation |
Requirements
-
Docker with Docker Compose, and
just -
uvon the host (tests andjust eval-comparerun there) -
NVIDIA GPU (developed on 8 GB) with the NVIDIA Container Toolkit, GPU passed to containers via CDI. Generate the spec once, and again after every driver update — otherwise Ollama silently falls back to CPU:
sudo nvidia-ctk cdi generate --output=/etc/cdi/nvidia.yaml -
Disk: ~5 GB of models, plus the stores (grow with your notebook collection)
Docker access: either your user is in the docker group (root-equivalent),
you prefix docker commands with sudo, or you run rootless Docker.
Quick start
just up # Neo4j, Qdrant, Ollama, askme; pulls models
mkdir -p data/notebook_archive # put your notebooks here
just ingest # build the graph (slow: hours for hundreds of files)
just query "How are low-quality cells filtered?"
data/ is gitignored — your notebooks, stores and testsets stay local.
Full command reference: OKF/guides/usage.md, or just --list.
Configuration
Model choices are justfile variables, overridable via environment or .env:
| Variable | Default | Notes |
|---|---|---|
LLM_MODEL |
qwen2.5:7b |
builds the graph and answers queries |
EMBEDDING_MODEL |
nomic-embed-text |
fixed once data is ingested |
EMBEDDING_DIM |
768 |
must match the embedding model |
OLLAMA_KEEP_ALIVE |
5m |
how long an idle model stays on the GPU |
EVAL_MODELS |
qwen2.5:7b gemma3:4b gemma2:9b llamacpp:gemma-4-12b-qat |
models compared by just eval-compare |
LLAMACPP_URL |
http://localhost:8080 |
optional llama.cpp router for llamacpp:<id> models |
The embedding model and dimension are recorded in
data/rag_storage/askme_meta.json on first use; askme refuses to run against
stores built with a different embedding. To switch: just clean-stores, then
re-ingest.
One GPU, one model. Stop other GPU model servers (e.g. a llama.cpp router) before ingesting — a second resident model makes loads fail or spill to CPU.
Evaluation
Evaluation needs a testset of questions about your notebooks. Write your own
in data/ (gitignored), following the examples:
data/testset.json—{question, reference}pairs for RAGAS; format ineval/testset.example.jsondata/retrieval_testset.json—{question, expected}term pairs for the retrieval eval; format ineval/retrieval_testset.example.json
| Command | Measures |
|---|---|
just eval-retrieval |
retrieval term recall, no LLM judge |
just eval-local <judge> --n N |
RAGAS faithfulness / answer relevancy / context precision with a local judge |
just eval-compare [n] [keywords] [generators] [judges] |
full generator × judge RAGAS matrix |
eval-compare has every generator answer the testset through the same
knowledge graph, then every judge score every generator. It runs on the host,
keeps one model on the GPU at a time, writes results as they finish (rerun
with --out <dir> to resume), and renders comparison.md with one matrix per
metric. Self-judged cells are flagged — local judges are noticeably lenient
on their own answers, and judge choice moves absolute scores more than
generator choice, so read the matrix comparatively.
just eval-compare 20 # 20 questions, every EVAL_MODELS model in both roles
just eval-compare 20 pinned # retrieval keywords extracted once by LLM_MODEL,
# so only answer synthesis differs
Models are Ollama tags, or llamacpp:<model-id> for a model served by a
llama.cpp router (OpenAI-compatible).
What shapes the scores
Code-level knobs (embedding, chunking, judges, generators, memory, context
budget, query mode, retrieval depth, rerank, keyword mode, temperature) are
marked in the source: grep -rn "#ADJUST" justfile docker-compose.yml src.
Two more choices live outside the code:
- Testset and n. Scores are means over your questions, so they inherit the testset's coverage: questions on topics the notebooks barely cover pull faithfulness down, and questions phrased in the notebooks' own vocabulary retrieve better than paraphrases. Small n is noisy — with n=20 one question moves a mean by 0.05. Compare runs only on the same questions and n.
- Metrics. Faithfulness — are the answer's claims supported by the retrieved text (catches invention). Answer relevancy — does the answer address the question (catches evasive or noncommittal answers; uses the embedding model). Context precision — are the retrieved chunks that support the reference answer ranked high (judges retrieval, not the answer). A model can be faithful yet unhelpful, or relevant yet invented — read the three together.
Development
just test # unit tests, host, no containers
Agent and contributor conventions: AGENTS.md.
License
Apache 2.0 — see LICENSE.