How jubayeronrob/vinci-monsoon works
1. Purpose and deployment shape
- This repo is a containerized “hybrid router” for a benchmark harness.
- Its only contract is to read /input/tasks.json, process each task, and write /output/results.json, then exit 0.
2. Top-level execution path
- entrypoint.py is the runtime entry.
- It likely orchestrates the full pipeline: load tasks, classify each task, decide whether to answer locally or escalate, then serialize final results.
3. Stage 1: local task classification
- src/router/classifier.py performs the first pass entirely on-device.
- The README says this stage uses a local llama.cpp-backed model with grammar-constrained JSON output.
- The classifier predicts three fields: intent, difficulty (shallow or deep), and confidence (high or low).
4. Stage 2: routing and escalation policy
- src/router/dispatch.py applies the policy after classification.
- The central routing rules live in config/routing_map.yaml.
- The key architectural split is:
- trusted + shallow tasks go to the local model for a zero-token answer.
- everything else is escalated to Fireworks through the remote judging proxy.
5. Intent-to-role mapping boundary
- The routing map groups work into categories such as reasoning, code, and general.
- Those categories map to roles like math, logic, debugging, generation, factual, sentiment, summarize, and NER.
- This mapping is a policy layer, not hardcoded model selection; it is intended to be editable at launch time.
6. Remote LLM access
- src/api_clients/fireworks.py is the only external API client.
- It uses FIREWORKS_API_KEY and FIREWORKS_BASE_URL, so all remote model calls are forced through the provided proxy.
- The README notes per-request retry logic and a 25-second timeout, which is a key operational boundary for the architecture.
7. Local model subsystem
- src/local_models/loader.py owns CPU-only GGUF loading and local inference setup.
- The local model path comes from LOCAL_MODEL_PATH, defaulting to /models/model.gguf.
- If no real model is present, the loader falls back to a heuristic backend so the pipeline can still run offline for development and tests.
8. Model selection is environment-driven
- The repo does not hardcode remote model IDs.
- Instead, roles are resolved at runtime by case-insensitive substring matching against ALLOWED_MODELS, with fallback to the first allowed entry.
- This makes model choice an external deployment concern rather than a code dependency.
9. Failure handling and answer completeness
- The architecture is intentionally fail-soft.
- If a remote call fails, the system falls back to the local path rather than returning an empty result.
- That “never empty answer” behavior is a core reliability boundary in the design.
10. Configuration and prompts
- The config/ directory holds non-code control planes: routing policy, prompt templates, and any classifier instructions.
- config/prompts.py and config/routing_map.yaml separate prompt/routing behavior from execution logic, which makes tuning easier without changing the core router.
11. Testing and offline evaluation
- tests/mock_tasks.json provides representative inputs.
- tests/run_eval.py appears to support offline evaluation, likely with Fireworks mocked.
- tests/test_schema.py enforces output shape/validity, which is important because the harness only accepts correctly structured results.
12. Packaging and runtime constraints
- The repo is designed for a Linux amd64 Docker image with CPU-only execution.
- The README emphasizes a small memory footprint and no GPU dependency, which explains the choice of compact GGUF local models and aggressive escalation to remote models only when needed.
13. End-to-end data flow
- Input tasks arrive from the harness.
- Stage 1 classifies each task locally.
- Stage 2 decides local answer vs. remote escalation based on config/routing_map.yaml and ALLOWED_MODELS.
- The final answers are collected and written to /output/results.json.
14. Main architectural boundary
- The biggest design boundary is between local inference and remote inference.
- Everything before routing is optimized for zero-token, low-latency local handling; everything after routing is a controlled, env-driven Fireworks escalation path.
Main entry points: dispatch.py Dispatcher · entrypoint.py Entrypoint · fireworks.py Fireworks client · classifier.py Classifier
Components 15
Runtime flow
Container entrypoint and end-to-end task processing path.
- Entrypoint · Container entry that reads tasks, runs the router, and writes results.
entrypoint.py - Task input · Benchmark harness input file at /input/tasks.json.
- Results output · Final answer file written at /output/results.json.
Routing policy
Classification, dispatch, and editable control-plane configuration.
- Classifier · Local first-pass task classifier producing intent, difficulty, and confidence.
src/router/classifier.py - Dispatcher · Applies routing policy and chooses local answer or escalation.
src/router/dispatch.py - Routing map · Editable intent-to-role mapping and escalation policy.
config/routing_map.yaml - Prompts · Prompt templates and classifier instructions.
config/prompts.py
Model backends
Local inference and remote escalation paths.
- Local loader · Loads CPU-only GGUF models and sets up local inference.
src/local_models/loader.py - Heuristic fallback · Offline fallback when no real local model is available.
src/local_models/loader.py - Fireworks client · Single remote client for proxy-mediated model calls with retries and timeout.
src/api_clients/fireworks.py - Model selector · Resolves allowed remote model choice from environment via substring matching.
- Allowed models · Deployment-provided set of permitted remote model names.
Validation
Offline evaluation and schema checks.
- Schema tests · Checks output shape and validity for harness compatibility.
tests/test_schema.py - Offline eval · Local evaluation harness for representative mock tasks.
tests/run_eval.py - Mock tasks · Representative input tasks used for offline evaluation.
tests/mock_tasks.json
Connections 16
- Task input → Entrypoint: read · Harness input is consumed by the runtime entry.
- Entrypoint → Classifier: classify · Each task is first classified locally.
- Classifier → Prompts: uses · Classifier behavior is driven by prompt instructions.
- Classifier → Dispatcher: task metadata · Classification output feeds routing decisions.
- Dispatcher → Routing map: consults · Dispatcher applies the editable policy map.
- Dispatcher → Local loader: local path · Trusted shallow tasks are answered locally.
- Local loader → Heuristic fallback: fallback · If no real model exists, inference degrades to heuristics.
- Dispatcher → Model selector: selects · Escalated work chooses a remote model at runtime.
- Model selector → Allowed models: matches against · Model selection is constrained by deployment allowlist.
- Dispatcher → Fireworks client: escalate · Non-local tasks are sent to the remote judging proxy.
- Fireworks client → Entrypoint: remote result · Remote responses return to the orchestrator for assembly.
- Fireworks client → Local loader: fail-soft fallback · Remote failure falls back to local handling instead of empty output.
- Entrypoint → Results output: write · Final results are serialized for the harness.
- Schema tests → Results output: validate · Tests enforce the required output structure.
- Offline eval → Mock tasks: loads · Offline evaluation runs against representative tasks.
- Offline eval → Fireworks client: mocks · Evaluation can simulate the remote path.