Selection Mechanism
DualMind maintains a registry of active AI models in the database. Selection strategies determine which model(s) execute for each request.Active Model Registry
Theai_models table contains:
- Model name (unique identifier)
- Display name (human-readable label)
- Provider (Groq, Bytez)
- Status (
activeorinactive)
active models are eligible for random selection.
Inactive models can still be explicitly requested by name but won’t appear in random selection pool.
Single Chat Selection
Explicit Selection
Client specifies exact model name:Random Selection
Client requests automatic model choice:ModelSelector.GetRandomModelAsync().
Why random selection exists:
- Simplifies client integration (no model knowledge required)
- Distributes usage across model pool
- Enables experimentation without hardcoding models
- Useful for testing robustness across different models
Dual Chat Selection
Dual chat requires selecting two different models. Three strategies available:Random Mode
- Get all active models
- Randomly select first model
- Randomly select second model (excluding first)
- Return model pair
- Unbiased model comparisons
- Every model pair has equal probability
- Discovers unexpected quality differences
- Builds diverse comparison dataset
- General-purpose arena
- Exploratory quality assessment
- Collecting broad preference data
Topper Mode
- Query
model_statsview for model with highest win rate - Randomly select second model (excluding topper)
- Return model pair with topper as agent1
- Benchmarks new models against current leader
- Provides consistent baseline for comparisons
- Helps stabilize model rankings faster
- Identifies models capable of beating champion
- Leaderboard-focused arenas
- Quality assurance (new models must beat leader)
- Tournament-style comparisons
Manual Mode
- Both models must be specified
- Both models must exist and be active
- Models must be different
- Controlled A/B testing (always same pair)
- Reproducing specific comparisons
- Custom tournament brackets
- Comparing specific model families
- Research requiring consistent model pairs
- Head-to-head matchups
- Regression testing (did quality change?)
Selection Strategy Comparison
| Strategy | Model 1 | Model 2 | Consistency | Bias |
|---|---|---|---|---|
| Random | Random | Random (≠ M1) | Low | None |
| Topper | Top model | Random | Medium | Toward leader |
| Manual | Specified | Specified | High | User-defined |
Model Metadata
Each selected model includes:name: API identifier for requestsdisplayName: User-friendly label for UIprovider: Backend routing information
Provider Routing
After model selection, backend routes to provider:| Model Name Pattern | Provider |
|---|---|
llama-*, mixtral-* | Groq |
| Others | Bytez |
Provider routing is transparent to client. Selection strategy only chooses models, not providers.
Fallback Behavior
Single Chat Fallback
If selected model fails:- Retry with
llama-3.3-70b-versatilevia Groq - If retry fails, route to Bytez provider
- If Bytez fails, return error
Dual Chat Fallback
Each model has independent fallback chain. Possible outcomes:- ✅ Both models succeed
- ⚠️ One model succeeds, one fails (partial result)
- ❌ Both models fail (error response)
Model Statistics
Selection strategies use aggregated statistics from themodel_votes table:
(wins / total_appearances) * 100
“Topper” mode queries this data to find highest win rate. Statistics update in real-time as votes are submitted.
Adding New Models
Models are added to registry via admin endpoints or direct database insertion. Required fields:model_name: Unique identifierdisplay_name: Human-readable labelprovider_name:"groq"or"bytez"status:"active"or"inactive"
status='active', model immediately enters random selection pool.
Model Lifecycle
Selection Fairness
Random Selection Fairness
All active models have equal probability in pure random mode. No weighting based on:- Past performance
- Provider
- Inference cost
- Model size
- Simpler implementation
- Unbiased data collection
- Fair exposure for new models
Topper Bias
Topper mode intentionally biases toward top model:- Top model appears in 100% of comparisons
- Other models share remaining 50% of slots
Next Steps
Chat Modes
Single vs dual chat explained
Voting System
How votes affect statistics
System Overview
Architecture and design decisions