Skip to content

feat: per-persona model support for swarm deliberation#1

Open
NOVA-Openclaw wants to merge 1 commit into
jangles-byte:mainfrom
NOVA-Openclaw:feature/per-persona-models
Open

feat: per-persona model support for swarm deliberation#1
NOVA-Openclaw wants to merge 1 commit into
jangles-byte:mainfrom
NOVA-Openclaw:feature/per-persona-models

Conversation

@NOVA-Openclaw

Copy link
Copy Markdown

Summary

Allow each swarm persona (Strategist, Economist, Naturalist, Skeptic) to use a different Ollama model during forecast deliberation, configured via environment variables.

Motivation

Each persona judges predictions through a fundamentally different lens. Different model architectures have different strengths that align naturally with these roles:

  • A reasoning model (e.g. deepseek-r1) excels at the Skeptic's job — stress-testing assumptions, checking base rates, and playing devil's advocate via chain-of-thought reasoning
  • A larger general model (e.g. qwen2.5:32b) brings deeper analytical capacity to the Strategist and Economist's geopolitical and macro-economic analysis
  • A solid mid-range model (e.g. gemma3:12b) handles the Naturalist's disaster/weather/health pattern matching efficiently

Running all four on the same model means you're either over-provisioning for simple personas or under-provisioning for complex ones.

Configuration

New optional environment variables in .env:

SWARM_MODEL_STRATEGIST=qwen2.5:32b
SWARM_MODEL_ECONOMIST=qwen2.5:32b
SWARM_MODEL_NATURALIST=gemma3:12b
SWARM_MODEL_SKEPTIC=deepseek-r1:14b

When unset, each persona falls back to the main LLM_MODEL, preserving existing behavior. Zero breaking changes.

Changes

  • engine/config.py — Add swarm_persona_models dict built from SWARM_MODEL_* env vars
  • engine/oracle.py — Add optional model parameter to _complete() (2-line change)
  • engine/swarm.py — Look up per-persona model and pass it through to _complete()
  • .env.example — Document new env vars with suggested model mappings

Design Notes

  • Personas already run concurrently via asyncio.gather, so different-sized models just finish at different speeds — no architectural changes needed
  • All models share the same Ollama endpoint (base URL, API key, timeout) — only the model name varies
  • The dict comprehension in config filters out empty strings, so unset vars produce a clean empty dict and the fallback path is just model or self.model

Allow each swarm persona (Strategist, Economist, Naturalist, Skeptic)
to use a different Ollama model during forecast deliberation, configured
via environment variables:

  SWARM_MODEL_STRATEGIST=qwen2.5:32b
  SWARM_MODEL_ECONOMIST=qwen2.5:32b
  SWARM_MODEL_NATURALIST=gemma3:12b
  SWARM_MODEL_SKEPTIC=deepseek-r1:14b

When unset, each persona falls back to the main LLM_MODEL, preserving
existing behavior. This enables matching model strengths to persona
roles — e.g. a chain-of-thought reasoning model for the Skeptic's
base-rate analysis, or a larger model for the Strategist's geopolitical
reasoning.

Changes:
- config.py: add swarm_persona_models dict from SWARM_MODEL_* env vars
- oracle.py: add optional model parameter to _complete()
- swarm.py: look up per-persona model and pass it through
- .env.example: document new env vars with examples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant