askme-public/OKF/learnings/operations.md
Lukasz Boryn 0e0bae4b9b feat: initial public release of askme
* 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
2026-11-03 17:50:52 +01:00

74 lines
4.3 KiB
Markdown

---
type: Learnings
purpose: Keep debunked beliefs about running askme's stack, GPU and LightRAG runtime.
answers:
- "Which beliefs about operating askme's stack were debunked, and what replaced them?"
cites:
- docker-compose.yml
- src/askme/rag.py
---
# askme — learnings: operations
- **Believed:** `just down` is safe any time. **True:** stopping mid-ingest
corrupts LightRAG's JSON KV files (`JSONDecodeError` on next boot). Wait
for ingest or drain with `just process-pending` first; recovery is
`just clean-stores` + re-ingest. **Source:** 2026-06 ingest.
- **Believed:** `docker compose restart` picks up env changes. **True:** it
does not — use `just down && just up`. **Source:** 2026-06 ingest tuning.
- **Believed:** `nvidia-smi` working in a container means CUDA works there.
**True:** with the legacy `driver: nvidia` hook on driver 610, `cuInit`
failed with 999 while `nvidia-smi` worked; Ollama silently ran on CPU.
CDI (`nvidia-ctk cdi generate`) fixed it. **Source:** commit
`fix(ollama): pass the GPU via CDI`, 2026-11-03.
- **Believed:** `OLLAMA_KEEP_ALIVE=-1` is needed to keep ingest fast.
**True:** it pins the model on the GPU forever and blocks other GPU
servers; `5m` stays warm across ingest calls. **Source:** commit
`feat(ollama): release the GPU when idle`, 2026-11-02.
- **Believed:** LightRAG's caches are safe when comparing models.
**True:** cache keys ignore the model, so a second generator would get
the first one's cached answers and keywords. `create_rag(cache=False)`
for comparisons. **Source:** `lightrag/operate.py` `compute_args_hash`.
- **Believed:** `settings.chunk_overlap` was applied. **True:** it was dead
config until passed to LightRAG; the 4000-char embed cap also dropped
chunk tails silently (now logged). **Source:** 2026-06-17 review.
- **Believed:** LightRAG takes storage URLs from askme's settings.
**True:** its Neo4j/Qdrant backends read `QDRANT_URL`, `NEO4J_URI` etc.
straight from `os.environ` and refuse to start without them; a host
process (outside compose) must export them — `just eval-compare` does.
**Source:** `lightrag/utils.py` `check_storage_env_vars`, 2026-11-03.
- **Believed:** the askme container can reach a llama.cpp router on the
host. **True:** the router binds `127.0.0.1:8080`, which the container's
localhost does not reach; eval-compare therefore runs on the host, where
Ollama, Neo4j, Qdrant and the router are all on localhost. **Source:**
`templates/llama-router.service` in llm-config, 2026-11-02.
- **Believed:** host processes can write to `data/`. **True:** the
container runs as root, so everything it writes under the bind-mounted
`data/` is root-owned; `sudo chown -R $USER: data/rag_storage` after an
in-container ingest. **Source:** `askme_meta.json` write, 2026-11-02.
- **Believed:** `pkill -f askme-eval-compare` stops only the eval.
**True:** the pattern also matches the shell running pkill and kills it;
match the interpreter: `pkill -f "python.*askme-eval-compare"`.
**Source:** 2026-11-03 session.
- **Believed:** `just eval-compare n=20` sets `n`. **True:** just recipe
arguments are positional; `n=20` became the first parameter's value.
Pass values in order (`just eval-compare 20`). **Source:** `just
--dry-run`, 2026-11-02.
- **Believed:** normal queries (`just query`, the API) answer from the
whole retrieved context. **True:** `rag.py` set Ollama's `num_ctx` to
4096 while LightRAG builds prompts up to 30000 tokens; Ollama cut the
rest silently. Now every query path caps the prompt at 12000 tokens
(entities 2000, relations 3000, rest for chunks) and `num_ctx` is 16384.
Query-time only — the stores were not re-ingested. The 2026-06 eval-local
numbers came through the old path. **Source:** `src/askme/rag.py`
`make_query_param`, 2026-11-03. Open: whether ingest-time entity
extraction was truncated too (its log is gone).
- **Believed:** the ingested graph holds domain knowledge (genes, cell
types, methods). **True:** 33% of 22,144 entities are `UNKNOWN`, genes are
1.2%, the best-connected nodes are `adata` and plotting calls, and some
entities are copied from LightRAG's extraction examples
(`Tokyo2023World…`) — signs of lost instructions (truncated prompt) or a
too-small model. Code-heavy notebooks also yield variable names as
entities. **Source:** Cypher entity-type count and random sample,
2026-11-03.