# RAG workstream β€” post grain, advanced retrieval, evaluation πŸ“˜ Cette page est Γ©galement disponible en [franΓ§ais πŸ‡«πŸ‡·](./README.md) > **Status (17/09/2026)**: plugin + pipeline in prod on the **VPS** > (Discourse + Postgres/pgvector, 424 835 posts). Inference on the **mini > PC** (Ollama `bge-m3` + `qwen3:30b-a3b-q6k`, TEI mmarco) via Tailscale. > Member flags still **OFF**; agent limited to a demo group. Public diagram: > [`README.md`](../../README.md). Session resume (French working doc): > [`PLAN_RAG_PROD_VPS.md`](../PLAN_RAG_PROD_VPS.md). > Eval: posts+rerank, Hit@5 0.97 β€” [`EVAL.en.md`](EVAL.en.md) / > [`SAFETY.en.md`](SAFETY.en.md). ## Languages in this folder GitHub and Forgejo only auto-switch the **root** `README.md` / `README.fr.md`. Every other page is a normal file. Convention here: | Files | Language | |---|---| | `DESIGN.md`, `EVAL.md`, `SAFETY.md`, `PIPELINE.md`, `REFERENCES.md`, this folder's `README.md` | French (working language) | | `DESIGN.en.md`, `EVAL.en.md`, `SAFETY.en.md`, `PIPELINE.en.md`, `REFERENCES.en.md`, `README.en.md` | English (public vitrine, linked from root `README.md`) | | `LOCAL_DEV.md`, `prod_snapshots/`, `../PLAN_RAG_PROD_VPS.md` | French only (operator runbooks) | ## Why this workstream The RAG then in prod indexed **one vector per topic** (~22 340). On megathreads (300+ messages), a single vector = a diluted semantic centroid **plus** 4096-token input truncation β†’ precise passages on page 12 are invisible. Goal: **post-grain** retrieval with citations `/t/slug/id/post_number`, keeping the product principle β€” **the bot points to existing threads, it does not answer in members' place**. It is also a learning workstream: we test industry-standard techniques (see [`REFERENCES.en.md`](REFERENCES.en.md)), we measure on **our** corpus, we document. ## Documents | File | Content | |---|---| | [`DESIGN.en.md`](DESIGN.en.md) | Architecture, configs to test, decisions | | [`REFERENCES.en.md`](REFERENCES.en.md) | RAG literature notes β€” proven techniques + sources | | [`EVAL.en.md`](EVAL.en.md) | Eval set, metrics, protocol, retrieval + generation results | | [`SAFETY.en.md`](SAFETY.en.md) | Red-team, input gate, refusal clause, evidence injection | | [`PIPELINE.en.md`](PIPELINE.en.md) | End-to-end questionβ†’answer architecture + measured latencies | | `LOCAL_DEV.md` | Recipe: redeploy the forum locally (French) | | `prod_snapshots/` | Prod state saved before deploy (prompt, settings, rollback) | | `../PLAN_RAG_PROD_VPS.md` | **Deploy plan + session resume** (French) β€” read first to continue | ## Dev workflow ``` Dev machine (laptop / desktop) AI mini PC (prod) β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Local Discourse = exact β”‚ β”‚ k3s rag-depiedencap β”‚ β”‚ VPS replica (.tar.gz) β”‚ β”‚ Ollama :32134 β”‚ β”‚ + local pgvector │──Tailscale──►│ qwen3:30b (chat) β”‚ β”‚ + LOCAL bge-m3 (CPU) β”‚ β”‚ bge-m3 (prod β”‚ β”‚ for tests β”‚ β”‚ embeddings) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` - Dev vectors β†’ **local** pgvector (zero prod risk). - Dev chat LLM β†’ mini PC (the laptop does not carry a 30B). - Dev embeddings β†’ **local CPU** bge-m3 (do not clog the prod queue). - Once the solution is validated: the mini-PC **bge-m3** produces prod vectors (same model = compatible vectors). ## Rules - Never run retrieval/embedding tests against the prod database. - The local forum **sends no email** (`disable_emails`, see `LOCAL_DEV.md`). - Every design decision β†’ ADR in [`DESIGN.en.md`](DESIGN.en.md) Β§ Decisions. - Bench results β†’ [`EVAL.en.md`](EVAL.en.md) (numbers, not feeling).