feat(benchmark): GH-24 système de benchmarking des modèles LLM par agent (Lot A — moteur backend)#25
Open
simodev25 wants to merge 5 commits into
Open
feat(benchmark): GH-24 système de benchmarking des modèles LLM par agent (Lot A — moteur backend)#25simodev25 wants to merge 5 commits into
simodev25 wants to merge 5 commits into
Conversation
Phase 1 for GH-24: add backend scaffolding including Alembic migration, ORM models, API route skeletons and unit tests to start the agent-benchmark system. Verification: unit tests added for models; alembic revision included; basic routing and services scaffolded for further implementation. Refs: GH-24
…p backend version Reconciliation of plan vs implementation (execution log added), update development documentation to include the new benchmark subsystem, and bump backend app version to 0.2.0 (minor) to reflect delivered Lot A changes. Verification: updated plan shows PASS/PARTIAL criteria and targeted unit tests for benchmark features reported as passing.
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Résumé
ALL_AGENT_FACTORIES,build_toolkit(),build_model()) pour garantir la fidélité au comportement production/api/v1/benchmark/(CRUD fixtures + lancement/requête de runs) + tâche Celery asynchroneContexte (pourquoi)
Problème : Kairos Mesh ne dispose d'aucun mécanisme objectif pour évaluer et comparer les performances des modèles LLM par agent. La sélection des modèles repose exclusivement sur l'intuition du développeur, sans données de comparaison reproductibles. Il est impossible de justifier un changement de modèle ou de détecter une régression de performance.
Solution (Lot A — backend uniquement) : Un sous-système de benchmarking dédié composé de :
Non-objectifs explicites (lots futurs) :
Changements
Base de données (migration Alembic)
0013_gh24_benchmark_tables.py: 4 nouvelles tablesbenchmark_fixture: fixtures versionnées avec hash d'intégritébenchmark_run: métadata de run + configuration modèlebenchmark_case: cas individuel d'un run (agent + fixture + scénario)benchmark_attempt: tentative unique avec output, scores et latenceanalysis_run(optionnelle, pour contexte de run réel)Modèles SQLAlchemy
BenchmarkFixture: gestion des fixtures versionnéesBenchmarkRun: métadata + provider/modèle/températureBenchmarkCase: liaison fixture ↔ run ↔ agentBenchmarkAttempt: outputs + scores individuels + latenceSchémas Pydantic
BenchmarkFixtureCreate,BenchmarkFixtureUpdate,BenchmarkFixtureResponseBenchmarkRunCreate,BenchmarkRunResponse,BenchmarkRunDetailResponseBenchmarkAttemptResponse,BenchmarkCaseResponseBenchmarkLaunchRequest(lancement run depuis fixtures)Services
fixtures_service.py: CRUD fixtures avec calcul hash d'intégritéruns_service.py: CRUD runs, requête de résultats avec filtresengine.py: orchestration exécution benchmarkALL_AGENT_FACTORIES,build_toolkit(),build_model(),build_formatter()llm_call_logscenarios.py: 3 types de scénariossingle-agent: un agent seuldebate-bundle: bullish + bearish + trader (modérateur)full-pipeline: pipeline complet 4 phases (8 agents)scoring_v1.py: 5 métriques objectivesschema_validity: sortie conforme au schéma Pydantic attenducompleteness: présence des champs obligatoirestool_policy_compliance: respect des contraintespreset_kwargs/force_kwargsreference_consistency: cohérence des références (ex.tickerdans les outputs multi-agents)stability: répétabilité (outputs identiques avec mêmes inputs/température=0)agent_output_registry.py: mapping agent → schéma Pydantic attenduAPI REST (
/api/v1/benchmark/)POST /benchmark/fixtures/: créer fixtureGET /benchmark/fixtures/: lister fixtures (filtres : agent, version)GET /benchmark/fixtures/{id}: détail fixturePUT /benchmark/fixtures/{id}: mettre à jour fixtureDELETE /benchmark/fixtures/{id}: supprimer fixturePOST /benchmark/runs/launch: lancer run (synchrone ou async via Celery)GET /benchmark/runs/: lister runs (filtres : agent, modèle, provider, état)GET /benchmark/runs/{id}: détail run avec tentatives et scoresTâche Celery
benchmark_task.py:run_benchmark_task(run_id)pour exécution asynchrone longue duréepending→running→completed/failedInfrastructure
BENCHMARK_MAX_ATTEMPTS_PER_CASEdans configcall_contextdansbase_llm_helpers.pypour traçage des appels LLMTests
test_benchmark_models_phase1.py)test_benchmark_schema_phase2.py)test_benchmark_engine_scenarios_unit.py)test_benchmark_scoring_v1_unit.py)test_benchmark_traceability_phase4.py)test_benchmark_api_and_services_phase5.py)test_benchmark_task_phase6.py)Documentation
docs/development-guide.mdmis à jour avec section benchmark.samourai/docai/changes/2026-05/2026-05-11--GH-24--agent-benchmark-system-lot-a/chg-GH-24-spec.md)chg-GH-24-plan.md)chg-GH-24-test-plan.md)Issue liée
Closes #24
Tests exécutés
Résultat : ✅ 652 tests passent (632 existants + 20 nouveaux), 0 échec, 0 régression
Risques
Risque moyen : Nouveau sous-système touchant le cœur partagé du pipeline
ALL_AGENT_FACTORIES,build_toolkit(),build_model()sans modification des factories de productionbackend/app/services/benchmark/etbackend/app/api/routes/benchmark.pyCoût LLM : Pas de limite automatique
max_attempts_per_casepour contrôler le volume d'appelsllm_call_logaveccontext_type=benchmarkCompatibilité backward : Aucun breaking change
/api/v1/)Checklist
docs/development-guide.md)