* 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.4 KiB
type, purpose, answers, cites
| type | purpose | answers | cites | |||
|---|---|---|---|---|---|---|
| Learnings | Keep debunked beliefs about evaluating askme with local RAGAS judges. |
|
|
askme — learnings: evaluation
-
Believed: every generator answers from the same retrieved context. True: LightRAG builds prompts up to 30000 tokens; Ollama (
OLLAMA_CONTEXT_LENGTH=16384) silently truncated them and the router (32k) rejected some with HTTP 400. Eval queries now cap the prompt at 12000 tokens. Source: pilot log 2026-11-03,src/askme/evaluation/compare.py:_PROMPT_TOKEN_CAP. -
Believed: capping
max_total_tokensalone shrinks the prompt evenly. True: LightRAG gives chunks only what entities (default 6000), relations (8000) and the system prompt leave over; a 12000 cap left 0 chunks in 37 of 39 answers. Entity/relation budgets must shrink with it (now 2000/3000 → 4 chunks per answer). Source: pilot log 2026-11-03,lightrag/operate.pyavailable_chunk_tokens. -
Believed: RAGAS works with a 7B local model. True: the LangchainLLMWrapper + TestsetGenerator path aborted or hung three ways on qwen2.5:7b. The instructor judge (
llm_factorywith an OpenAI-compatible client, metrics'.ascore()called directly) works. Source:src/askme/evaluation/local_eval.py, RAGAS issue #1214. -
Believed: the answering model drives the scores. True: the judge dominates. Same qwen2.5:7b answers, N=10: faithfulness 0.913 (gemma3:4b), 0.967 (gemma2:9b), 0.634 (qwen2.5:7b); context_precision 1.0 vs 0.5 by judge alone. Use local-judge scores relatively, with a fixed judge. Source:
data/local_eval_*.json, 2026-06-18. -
Believed: bigger judges are stricter. True: gemma2:9b was more lenient than gemma3:4b; leniency tracked the gemma family, not size. Source: same runs.
-
Believed: a reasoning model (qwen3.5:9b) makes a better judge. True: unbounded
<think>output blew every token/time budget (two N=50 crashes), and Ollama's/v1ignored both ways to disable thinking. Source:data/local_eval_q35.log, 2026-06-20. -
Believed: the first N chars of LightRAG's context dump are a fair judge context. True: the ~27k-token dump starts with entity triples; truncating kept no source chunks and zeroed context_precision. Use the retrieved chunks. Source: commit
fix(eval/local): trim to the document-chunks section. -
Believed: interleaving answer and judge calls is fine. True: the two models thrashed the 8 GB GPU and wedged runs; generate everything first, then judge, one model resident at a time. Source: commit
fix(eval/local): two-phase scoring. -
Believed: retrieval matches meaning. True: it is vocabulary-sensitive — a question phrased without the corpus's own term missed the right entities. Source: commit
fix(eval): reword Hotspot retrieval question, 2026-06-18. -
Believed: gemma-4-12b is too slow to judge on 8 GB (~80 s/call). True: unverified — that run may have been on CPU (see the CDI entry); re-measure on the router. Source: 2026-11-03 pilot pending.
-
Believed: a test asserting the prompt cap is passed proves the fix. True: it passed while 37 of 39 answers had no source chunks; the effect was only visible in the live log. Before a multi-hour run, run 2 questions live and check chunk counts per answer. Source: 2026-11-03 pilot.
-
Believed: swapping LightRAG's LLM per query needs a second LightRAG instance. True:
QueryParam.model_funcoverrides both keyword extraction and answer synthesis for one query; presethl_keywords/ll_keywordsskip extraction (pinned mode). Source:lightrag/operate.pyget_keywords_from_query, 2026-11-02. -
Believed: gemma-4-12b-qat is a plain instruct model. True: the router returns
reasoning_contentbefore the answer — it thinks, like the qwen3.5 judge that failed above. Answering takes ~1–2 min/question on the router with a 12000-token prompt (qwen2.5:7b on Ollama GPU: ~15 s). Source: 2026-11-03 smoke run and pilot log. -
Believed: turning a reasoning model's thinking off is optional for judging. True: gemma-4-12b-qat reasoned inside the faithfulness structured output until
max_tokens(10000) and the exception ended the whole pilot. Fixed twice:reasoning = offin its router preset, and judge failures now leave one metricNone(counted as "failed" in comparison.md) instead of ending the run. Source: pilot crash 2026-11-03,src/askme/evaluation/compare.py:judge_samples. -
Believed: LightRAG's graph modes (hybrid) retrieve better than plain vector search. True: on this graph,
naivebeathybridon every metric — context_precision 0.454 vs 0.268, faithfulness 0.830 vs 0.668 (qwen2.5:7b judge, n=20; run-to-run noise ~±0.06). A low-quality graph is worse than no graph. Source:just eval-compare 20 pinned … --mode naive|hybrid, 2026-11-03. -
Believed: judges agree roughly on the same answers. True: in the 2×2 pilot, gemma-4 gave qwen's answers faithfulness 0.495 where qwen gave 0.729, and context_precision ranged 0.29–0.67 by judge; self-judging was not consistently lenient (gemma scored itself 0.64, qwen scored gemma 0.82). Only answer_relevancy was stable (~0.77–0.83). Source: pilot-2x2-n20 comparison, 2026-11-03.