SIA (Self-Improving AI) Framework
repository·main·Indexed 24 days ago
https://github.com/hexo-ai/siaSIA is a framework that autonomously improves AI models and task harnesses on specific benchmarks using a multi-agent loop consisting of Meta, Target, and Feedback agents. It supports multiple LLM providers via the sia-agent package (including Claude and OpenHands implementations) and includes a built-in web dashboard for visualizing execution trajectories, evaluation scores, and agent code across generations.
What's inside SIA
- This task involves predicting criminal charges (罪名) from Chinese court case descriptions (事实). The goal is to maximize accuracy by correctly identifying the conviction charge from a fixed set of 191 valid classes based on the provided case text.
Understand the Chess Hard Task benchmark
mainThe Chess Hard Task is an LLM evaluation benchmark consisting of 50 challenging chess problems. It tests a model's ability to perform strategic analysis and mathematical calculation within a chess context.
There are two primary problem types:
- Best 3 Moves: Given a FEN (Forsyth-Edwards Notation) position, the model must identify the three best subsequent moves using Standard Algebraic Notation (SAN).
- Knight Path: Given a 100x100 board and target squares, the model must calculate the minimum number of moves required for a knight to visit all target squares.
Note that the provided
chess_hard.jsondataset contains the prompts but does not contain the ground truth answers.Spaceship Titanic Task Overview
mainThe Spaceship Titanic task is a binary classification problem where the goal is to predict whether a passenger was transported to an alternate dimension during a spacetime anomaly. Using personal records recovered from the ship's computer, you must predict theTransportedstatus for passengers in the test set.Spaceship Titanic Evaluation Metric
mainSubmissions are evaluated using classification accuracy, which is the percentage of predicted labels that are correct.Understand the GPQA-style benchmark requirements
mainThe GPQA-style benchmark evaluates an agent's ability to answer graduate-level multiple-choice questions in domains like biology, chemistry, and physics.
Key Data Characteristics:
- Dataset File:
diamond_questions.json. - Question Structure: Each record contains an
id,domain,subdomain,Question(stem), andoptions(a dictionary with keysA,B,C, andD). - Deterministic Shuffling: Options are pre-shuffled based on the question text. You must output the specific letter (
A,B,C, orD) that corresponds to the correct option.
Success Metric:
- The primary goal is to maximize accuracy (correct answers / attempted questions).
- Dataset File:
Understand the GPQA task format
mainTasks in the GPQA (Graduate-level Google-Proof Q&A) benchmark follow a specific structure designed for high-difficulty STEM reasoning. When authoring or parsing these tasks, ensure they adhere to these requirements:
- Difficulty: Graduate-level across STEM domains.
- Structure: Multiple-choice with exactly 4 options (labeled A, B, C, D).
- Answer Type: A single correct answer.
- Reasoning Requirements: Tasks often require deep domain knowledge, complex calculations, conceptual synthesis, or multi-step reasoning.
An agent interacting with these tasks must be able to:
- Parse the question text and all four options.
- Reason through the problem using domain-specific knowledge.
- Return a single letter answer (
A,B,C, orD) in the specified format. - Operate across various STEM domains (e.g., Physics, Chemistry, Biology).
Understand the SIA directory layout
mainSIA organizes its source code, task data, and execution outputs into a specific structure. Understanding this layout is essential for locating task descriptions, inspecting agent code, or reviewing run results.
Key Directories
sia/tasks/{task-id}/data/public/: Contains the task description (task.md) and public data files (*.csv).sia/agent_impls/: Contains the runner backends (e.g.,claude,openhands,pydantic-ai).runs/run_{id}/: The root directory for a specific execution run.venv/: An isolated Python environment created specifically for that run.gen_{n}/: Artifacts for a specific generation (includestarget_agent.py,agent_execution.json, andimprovement.md).
sia/ ├── sia/ │ ├── orchestrator.py │ ├── context_manager.py │ ├── prompts.py │ ├── agent_impls/ │ ├── prepare_mlebench_dataset.py │ └── tasks/ │ └── {task-id}/ │ └── data/ │ └── public/ │ ├── task.md │ └── *.csv └── runs/ └── run_{id}/ ├── venv/ └── gen_{n}/ ├── target_agent.py ├── agent_execution.json └── improvement.mdHow the SIA agent loop works
mainSIA (Self-Improving AI) operates using a continuous loop involving three specialized agents. In each generation, the system inspects the previous attempt, rewrites the agent, and executes it again. This cycle continues until the
--max_genlimit is reached.The Three Agents
- Meta-Agent: Reads the task description and generates the initial
target_agent.pytailored to the specific task. - Target Agent: The agent responsible for attempting the task. It records its actions and results in
agent_execution.json. - Feedback / Improvement Agent: Reviews the execution logs from the Target Agent, identifies areas for improvement, and rewrites the Target Agent for the subsequent generation.
The Execution Lifecycle
- Generation 1: The Meta-agent creates the first
target_agent.py. The Target agent executes the task and logs toagent_execution.json. The Feedback agent then analyzes this run to prepare the next version. - Generation 2 through N: The current generation's Target agent executes the task, and the Feedback agent produces the next generation based on those results.
Output Artifacts
All artifacts are saved under
runs/run_{run_id}/gen_{n}/. Each generation directory contains:target_agent.py: The agent code for that generation.agent_execution.json: The logs of the agent's actions and results.improvement.md: Improvement notes (available from Generation 2 onwards).
- Meta-Agent: Reads the task description and generates the initial
How profile and provider resolution works
mainSIA resolves profiles and providers using a specific hierarchy. If a value contains a
/or ends in.json, it is treated as an explicit file path.If a bare name is provided, SIA resolves it in this order:
- The user directory defined by
$SIA_PROFILES_DIRor$SIA_PROVIDERS_DIR(or./profiles/./providerslocally). - The bundled defaults shipped with the package.
Usage Example:
# Use a bundled profile name sia run --task gpqa --target-agent-profile kimi-nebius-target # Use an explicit path to a profile sia run --task gpqa --target-agent-profile ./profiles/mine.jsonsia run --task gpqa --target-agent-profile ./profiles/mine.json- The user directory defined by
How SIA (Self-Improving AI) works
mainSIA is a framework that autonomously improves the performance of an AI system (Model or Agent) on a specific benchmark task through an iterative loop. The system coordinates three distinct agent roles:
- Meta-Agent: Analyzes the task description and generates the initial Target Agent tailored for that task.
- Target / Task Specific Agent: The agent attempting to solve the task, recording its actions and results.
- Feedback/Improvement Agent: Reviews the Target Agent's performance logs, identifies weaknesses, and generates updates to improve the Target Agent.
This loop allows the system to refine both the task harness and the agent's weights/logic over successive generations.
Constraints for GPQA benchmark agents
mainWhen implementing an agent for the GPQA benchmark, adhere to these constraints:
- Option Integrity: Answer only using the four provided option strings; do not invent new options.
- Format Adherence: Follow the required output format exactly to allow automated mapping to shuffled options.
- Independence: Treat all questions as independent. Do not attempt to solve all questions within a single loop or share context between questions.
Test your evaluation script manually
mainBefore running the full SIA orchestrator, you should verify that your evaluation script correctly identifies the submission file and generates the
results.jsonfile. Run the script manually using the--gen-dirflag pointing to a directory containing a valid submission.python tasks/<task_name>/data/public/evaluate.py --gen-dir runs/run_1/gen_1