learning_orchestrator
diapason.learning.learning_orchestrator
¶
LearningOrchestrator — coordinate the full trace->learn->eval loop.
Pulls traces from a :class:TraceStore, mines training data via
:class:TrainingDataMiner, evolves agent configs via
:class:AgentConfigEvolver, optionally runs LoRA fine-tuning, and
gates acceptance on an evaluation function.
LearningOrchestrator
¶
Orchestrate a single trace->learn->eval cycle.
Parameters¶
trace_store:
Object with list_traces(limit=...) returning List[Trace]
(typically a :class:TraceStore).
config_dir:
Directory where agent TOML configs are written / evolved.
eval_fn:
Optional callable returning a float score (higher = better).
Called before and after learning to gate acceptance.
min_improvement:
Minimum improvement in eval score required to accept the update.
min_sft_pairs:
Minimum number of SFT pairs required to trigger LoRA training.
min_quality:
Minimum feedback quality threshold for :class:TrainingDataMiner.
lora_config:
Optional :class:LoRATrainingConfig. When provided (and enough
SFT pairs exist and torch is available), LoRA training runs.
model_name:
Model name for LoRA training (passed to :class:LoRATrainer).
run(*, agent_id=None)
¶
Execute one learning cycle.
Parameters¶
agent_id: When provided, only traces from this agent are considered.
Returns¶
Dict[str, Any]
A result with at least timestamp and status keys.
Steps¶
- Mine traces: extract sft_pairs, routing_pairs, agent_pairs
- If no data: return skipped
- Run baseline eval (if eval_fn provided)
- Update routing recommendations
- Evolve agent configs
- Run LoRA training (if lora_config provided AND enough pairs AND torch available)
- Run post-learning eval (if eval_fn provided)
- Accept/reject based on improvement threshold