Requirement: local-only, English + Arabic + mixed + technical terminology, lightweight, Open WebUI-compatible.
| Candidate | Size | Multilingual | Verdict |
|---|---|---|---|
| bge-m3 (Ollama) | ~1.2 GB, 1024-dim, 8K input | Excellent, 100+ languages incl. Arabic | Selected |
| paraphrase-multilingual (MiniLM) | ~120 MB | Decent, weaker on technical text | Fallback if RAM-starved |
| snowflake-arctic-embed2 | ~1.2 GB | Strong but Arabic coverage weaker than bge-m3 | Not selected |
| nomic-embed-text | ~270 MB | English-focused | Rejected (Arabic requirement) |
| Cloud APIs (OpenAI etc.) | — | — | Rejected — violates local-only principle |
Install only the selected model:
ollama pull bge-m3
Open WebUI: Admin Panel → Settings → Documents:
Vector store: Open WebUI’s built-in ChromaDB inside DATA_DIR\vector_db.
No separate database server — do not over-engineer.
| Setting | Start | Tuning notes |
|---|---|---|
| Chunk size | 800 tokens | 500–1000 band. Smaller = precision, larger = context continuity. Standards/clauses → smaller (500–600); textbooks → larger (~1000) |
| Chunk overlap | 100 | Keep ~10–15% of chunk size |
| Top K | 5 | Raise to 8–10 for multi-section questions if context budget (8K) allows |
| Hybrid search (BM25 + vector) | On | Materially helps exact technical terms, clause numbers, acronyms (CBTC, ATC, EN 50126) |
| Reranker | Off initially | CPU cost; add only if Gate 6 precision is inadequate |
| Full-context mode | Off | Defeats retrieval; 16 GB cannot afford whole-document stuffing |
Change one parameter at a time and re-run the Gate 6 test set — defaults are not assumed optimal, and neither is any single tweak.
Supported via Open WebUI’s extraction pipeline: PDF, DOCX, PPTX, XLSX, CSV, TXT,
Markdown. Scanned PDFs: extraction yields nothing without OCR. OCR is optional
and deliberate (resource-heavy): pre-process scanned files externally (e.g.,
ocrmypdf --language ara+eng in.pdf out.pdf) and upload the OCR’d copy. Never
bulk-OCR by default.
Never assume a successfully uploaded file was correctly parsed.
After each upload:
Common Arabic-PDF failure: text extracts as isolated/reversed glyphs (legacy encodings, missing ToUnicode maps). Fix at source; re-exporting to DOCX or printing to a fresh PDF usually repairs it.
Do not upload hundreds of PDFs blindly.
docs/05-knowledge-libraries.md).