-
Notifications
You must be signed in to change notification settings - Fork 0
Local Model Cutover
Lucius Morningstar edited this page Aug 8, 2026
·
2 revisions
Mailroom is provider-agnostic. Switching from OpenRouter to local models (Ollama/vLLM) is a configuration change, not a code rewrite.
config/taxonomy.yaml (per-agent provider + model)
--> llm/client.py (resolve)
--> llm/providers.py (provider config)
--> openai.OpenAI(base_url=..., api_key=...)
Strong structured JSON output (critical for extraction schemas), good legal text understanding.
| Model | Sizes | Best For |
|---|---|---|
| Qwen 3 | 7b, 14b | Structured output, legal text |
| Qwen 2.5 | 14b, 32b | Multilingual |
| Llama 3.1 | 8b, 70b | General-purpose |
| Llama 3.2 | 3b | Fast classification |
| Mistral | 7b | Fast instructions |
| Mistral Nemo | 12b | Speed/quality balance |
| Mixtral | 8x7b | Extraction (MoE) |
| DeepSeek-R1 | 8b, 14b | Legal reasoning |
| Phi-4 | 14b | Document understanding |
| Gemma 2 | 9b, 27b | Instructions |
| Command R | 35b, 104b | RAG, extraction |
export DEFAULT_PROVIDER=ollamaAll agents use Ollama with their configured model.
Use the cutover utility:
python cutover.py --list # See current assignments
python cutover.py --agent sorter --provider ollama --model qwen3:7b
python cutover.py --validate --agent sorter # Run tests
python cutover.py --recommend # View cutover orderOr edit config/taxonomy.yaml directly:
agents:
sorter:
provider: ollama
model: qwen3:7b- Sorter (lowest risk — classification)
- Compliance Specialist (structured forms)
- Correspondence Specialist (narrative text)
- Corporate Records Specialist (hierarchical data)
- Contracts Specialist (complex extraction)
- Due Diligence Specialist (risk detection nuance)
- Reporter (summarization)
- Boss (adjudication)
Run a mix of local and cloud models:
agents:
sorter:
provider: ollama
model: qwen3:7b
due_diligence_specialist:
provider: openrouter
model: openai/gpt-4o| Model Size | Min RAM | Recommended | Min VRAM |
|---|---|---|---|
| 7B/8B | 8 GB | 16 GB | 6 GB |
| 12B-14B | 16 GB | 32 GB | 10 GB |
| 32B-35B | 32 GB | 64 GB | 24 GB |
| 70B+ | 64 GB | 128 GB | 48 GB |
| Issue | Fix |
|---|---|
| Model not found | docker exec mailroom-ollama ollama pull qwen3:7b |
| JSON parse errors | Try larger model or fall back to OpenRouter for that agent |
| Slow inference | Use quantized models, enable GPU, reduce context window |
Mailroom — Multi-Agent Legal Document Processing Pipeline. Built with LangGraph and OpenRouter; SQLite by default, Postgres optional.
- Repo docs/ — canonical docs (architecture, agents, configuration, API, deployment, local models)
- Sister Repositories — the llm-mailroom umbrella map