### Setup Python Environment and Install Dependencies Source: https://github.com/poetiq-ai/poetiq-arc-agi-solver/blob/main/README.md This snippet outlines the necessary steps to set up a Python virtual environment and install project dependencies using pip. It ensures a clean and isolated environment for running the ARC-AGI solver. ```bash python -m venv .venv source .venv/bin/activate pip install -r requirements.txt ``` -------------------------------- ### Configure API Keys for AI Models Source: https://github.com/poetiq-ai/poetiq-arc-agi-solver/blob/main/README.md This example demonstrates how to configure API keys for various AI models, such as Gemini and OpenAI, by creating a .env file. This is crucial for authenticating with the respective model services used by the solver. ```dotenv GEMINI_API_KEY=... OPENAI_API_KEY=... ``` -------------------------------- ### Single Expert Coding Solver API Source: https://context7.com/poetiq-ai/poetiq-arc-agi-solver/llms.txt Iteratively generate and refine Python transformation code using LLM calls and feedback from execution results on training examples. ```APIDOC ## Single Expert Coding Solver API ### Description Iterative code generation with feedback. Generate and refine Python transformation code through iterative LLM calls with feedback from execution results on training examples. ### Method Asynchronous function call (e.g., Python `async def`) ### Endpoint `solve_coding` (conceptual function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **train_in** (list[list[list[int]]]) - Required - Training input grids. * **train_out** (list[list[list[int]]]) - Required - Training output grids. * **test_in** (list[list[list[int]]]) - Required - Test input grids. * **config** (dict) - Required - Configuration for the solver. * **solver_prompt** (str) - Required - Prompt for the solver LLM. * **feedback_prompt** (str) - Required - Prompt for generating feedback. * **llm_id** (str) - Required - Identifier for the LLM to use. * **max_iterations** (int) - Optional - Maximum number of iterations. * **solver_temperature** (float) - Optional - Temperature for LLM sampling. * **max_solutions** (int) - Optional - Maximum number of solutions to keep. * **selection_probability** (float) - Optional - Probability of selecting previous solutions. * **seed** (int) - Optional - Random seed for reproducibility. * **shuffle_examples** (bool) - Optional - Whether to shuffle training examples. * **improving_order** (bool) - Optional - Whether to prioritize improving solutions. * **return_best_result** (bool) - Optional - Whether to return only the best result. * **request_timeout** (int) - Optional - Timeout for each LLM request in seconds. * **max_total_timeouts** (int) - Optional - Maximum total timeouts allowed. * **max_total_time** (float) - Optional - Maximum total execution time in seconds. * **per_iteration_retries** (int) - Optional - Number of retries per iteration. * **problem_id** (str) - Optional - Identifier for the problem. ### Request Example ```python from arc_agi.solve_coding import solve_coding # Assuming SOLVER_PROMPT_3 and FEEDBACK_PROMPT are defined elsewhere config = { 'solver_prompt': SOLVER_PROMPT_3, 'feedback_prompt': FEEDBACK_PROMPT, 'llm_id': 'gemini/gemini-3-pro-preview', 'max_iterations': 10, 'solver_temperature': 1.0, 'max_solutions': 5, 'selection_probability': 1.0, 'seed': 42, 'shuffle_examples': True, 'improving_order': True, 'return_best_result': True, 'request_timeout': 3600, 'max_total_timeouts': 15, 'max_total_time': None, 'per_iteration_retries': 2, } result = await solve_coding( train_in=[[[0, 0], [0, 0]]], train_out=[[[1, 1], [1, 1]]], test_in=[[[0, 0], [0, 0]]], config=config, problem_id="coding_example" ) ``` ### Response #### Success Response (200) * **result** (dict or list) - The best solution found, or a list of solutions depending on `return_best_result` configuration. Contains the generated code and its performance metrics. #### Response Example ```json { "solution_code": "import numpy as np\ndef transform(grid: np.ndarray) -> np.ndarray:\n return np.where(grid == 0, 1, grid)", "passed_training": true, "score": 1.0, "iterations": 3 } ``` ``` -------------------------------- ### Single Expert Iterative Coding Solver Source: https://context7.com/poetiq-ai/poetiq-arc-agi-solver/llms.txt Generates and refines Python transformation code through iterative LLM calls. It uses feedback from execution results on training examples to improve solutions. Configuration options control the LLM's behavior and the iteration process. ```python from arc_agi.solve_coding import solve_coding config = { 'solver_prompt': SOLVER_PROMPT_3, 'feedback_prompt': FEEDBACK_PROMPT, 'llm_id': 'gemini/gemini-3-pro-preview', 'max_iterations': 10, 'solver_temperature': 1.0, 'max_solutions': 5, 'selection_probability': 1.0, 'seed': 42, 'shuffle_examples': True, 'improving_order': True, 'return_best_result': True, 'request_timeout': 3600, 'max_total_timeouts': 15, 'max_total_time': None, 'per_iteration_retries': 2, } result = await solve_coding( train_in=[[[0, 0], [0, 0]]], train_out=[[[1, 1], [1, 1]]], test_in=[[[0, 0], [0, 0]]], config=config, problem_id="coding_example" ) # Process: # 1. Format problem with training examples # 2. Call LLM with solver prompt # 3. Parse generated Python code # 4. Execute in sandbox on training examples # 5. If all pass, return; else generate feedback # 6. Select previous solutions probabilistically # 7. Call LLM with feedback from past attempts # 8. Repeat until success or max iterations ``` -------------------------------- ### Solve Single ARC Problem - Python Source: https://context7.com/poetiq-ai/poetiq-arc-agi-solver/llms.txt Core function for processing individual ARC-AGI tasks. It takes training examples (input/output grids) and test inputs, dispatches them to a parallel coding solver with configured experts, and returns a list of ranked solution attempts. ```Python from arc_agi.solve import solve from arc_agi.config import CONFIG_LIST # Define training examples (input/output grids) train_in = [ [[0, 0, 1], [0, 1, 0], [1, 0, 0]], [[1, 1, 0], [1, 0, 1], [0, 1, 1]] ] train_out = [ [[1, 1, 1], [1, 1, 1], [1, 1, 1]], [[0, 0, 1], [0, 1, 0], [1, 0, 0]] ] test_in = [ [[0, 1, 0], [1, 0, 1], [0, 1, 0]] ] # Solve the problem results = await solve( train_in=train_in, train_out=train_out, test_in=test_in, problem_id="example_001" ) # Results structure: # [ # { # 'train_results': [{'success': True, 'output': '[[1,1,1],[1,1,1],[1,1,1]]', ...}], # 'results': [{'success': False, 'output': '[[1,1,1],[1,1,1],[1,1,1]]', ...}], # 'iteration': 3, # 'prompt_tokens': 15234, # 'completion_tokens': 876 # }, # # Additional ranked solutions... # ] ``` -------------------------------- ### Run ARC-AGI Solver on Dataset - Python Source: https://context7.com/poetiq-ai/poetiq-arc-agi-solver/llms.txt Main entry point for solving ARC-AGI problems on a dataset. Configurable parameters include challenge/solution file paths, output directory, and the number of problems to solve. It handles loading data, concurrent processing, scoring, and writing submission files. ```Python import asyncio from dotenv import load_dotenv load_dotenv() # Configure the solver DATA_CHALLENGES = "data/arc-prize-2024/arc-agi_evaluation_challenges.json" DATA_SOLUTIONS = "data/arc-prize-2024/arc-agi_evaluation_solutions.json" OUTPUT_DIR = "output" NUM_PROBLEMS = 5 # Solve first 5 problems, or None for all SELECTED_PROBLEMS = [] # Or specify IDs like ['b7999b51'] # main.py handles the complete pipeline: # 1. Load challenges and solutions # 2. Process problems concurrently # 3. Score results against ground truth # 4. Write submission files and token usage stats # Run with: python main.py asyncio.run(main()) # Example output: # ✓ b7999b51 (45s) [1/5] # ✗ 3c9b0459 (67s) [1/5] # ✓ 6150a2bd (52s) [2/5] # # === Summary === # Problems: 5 # Correct: 3 # Accuracy: 60.000 # Total time: 312s # Wrote Kaggle submission to: output/submission_2025-12-04_18-33-21.json ``` -------------------------------- ### Configure Expert Solvers for Parallel Solving - Python Source: https://context7.com/poetiq-ai/poetiq-arc-agi-solver/llms.txt Configuration for expert solvers used in parallel solving. This allows defining behavior such as prompt templates, LLM selection, iteration limits, temperature settings, voting strategies, and resource constraints. It supports multiple experts for enhanced performance. ```Python from arc_agi.config import CONFIG_LIST, NUM_EXPERTS from arc_agi.prompts import SOLVER_PROMPT_3, FEEDBACK_PROMPT # Single expert configuration CONFIG_LIST = [{ # Prompt templates 'solver_prompt': SOLVER_PROMPT_3, 'feedback_prompt': FEEDBACK_PROMPT, # LLM parameters 'llm_id': 'gemini/gemini-3-pro-preview', 'solver_temperature': 1.0, 'request_timeout': 3600, # 1 hour 'max_total_timeouts': 15, 'max_total_time': None, 'per_iteration_retries': 2, # Solver parameters 'num_experts': 1, 'max_iterations': 10, 'max_solutions': 5, 'selection_probability': 1.0, 'seed': 0, 'shuffle_examples': True, 'improving_order': True, 'return_best_result': True, # Voting parameters 'use_new_voting': True, 'count_failed_matches': True, 'iters_tiebreak': False, 'low_to_high_iters': False, }] * NUM_EXPERTS # For Poetiq(Gemini-3-a): NUM_EXPERTS = 1 # For Poetiq(Gemini-3-b): NUM_EXPERTS = 2 # For Poetiq(Gemini-3-c): NUM_EXPERTS = 8 ``` -------------------------------- ### Run the ARC-AGI Solver Source: https://github.com/poetiq-ai/poetiq-arc-agi-solver/blob/main/README.md This command executes the main Python script for the ARC-AGI solver. Users can modify constants in main.py to configure the problem set, number of problems, and other parameters before running. ```bash python main.py ``` -------------------------------- ### Build Kaggle Submissions with Python Source: https://context7.com/poetiq-ai/poetiq-arc-agi-solver/llms.txt Formats solver results into Kaggle's required two-attempt format. This function handles missing or failed predictions, coerces numpy arrays to lists, parses JSON strings, and pads with empty arrays if fewer than two attempts are available, ensuring proper ordering of test inputs. ```python from arc_agi.io import build_kaggle_two_attempts results = [ { 'results': [ {'output': '[[1, 0], [0, 1]]'}, {'output': '[[2, 2], [2, 2]]'} ] }, { 'results': [ {'output': '[[0, 1], [1, 0]]'}, {'output': '[[3, 3], [3, 3]]'} ] } ] test_in = [ [[0, 0], [0, 0]], [[1, 1], [1, 1]] ] kaggle_format = build_kaggle_two_attempts(results, test_in) # Output: # [ # {"attempt_1": [[1, 0], [0, 1]], "attempt_2": [[0, 1], [1, 0]]}, # {"attempt_1": [[2, 2], [2, 2]], "attempt_2": [[3, 3], [3, 3]]} # ] # Features: # - Coerces numpy arrays to lists # - Parses JSON strings # - Pads with empty arrays if < 2 attempts # - Maintains test input ordering ``` -------------------------------- ### Sandbox Code Execution Source: https://context7.com/poetiq-ai/poetiq-arc-agi-solver/llms.txt Execute generated Python code in an isolated subprocess with timeout protection and JSON input/output handling. ```APIDOC ## Sandbox Code Execution ### Description Isolated Python code execution. Execute generated transformation code in a subprocess with timeout protection and JSON input/output handling. ### Method Asynchronous function call (e.g., Python `async def`) ### Endpoint `run` (conceptual function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **code** (str) - Required - The Python code string to execute. * **input_grid** (list[list[int]]) - Required - The input grid for the transformation code. * **timeout_s** (float) - Optional - Timeout for the code execution in seconds. Defaults to 1.5. ### Request Example ```python from arc_agi.sandbox import run code = ''' import numpy as np def transform(grid: np.ndarray) -> np.ndarray: """Replace all 0s with 1s.""" return np.where(grid == 0, 1, grid) ''' input_grid = [[0, 0, 1], [0, 1, 0], [1, 0, 0]] success, output = await run( code=code, input_grid=input_grid, timeout_s=1.5 ) if success: # output is JSON string: '[[1, 1, 1], [1, 1, 1], [1, 1, 1]]' print(f"Transformation succeeded: {output}") else: # output contains error message print(f"Execution failed: {output}") ``` ### Response #### Success Response (200) * **success** (bool) - `True` if the code executed successfully, `False` otherwise. * **output** (str) - If `success` is `True`, this is a JSON string representing the output grid. If `success` is `False`, this contains the error message. #### Response Example ```json [ true, "[[1, 1, 1], [1, 1, 1], [1, 1, 1]]" ] ``` ### Execution Environment * Runs in a temporary directory with an isolated script. * `PYTHONHASHSEED=0` is set for determinism. * `numpy` and `scipy` libraries are available. * The subprocess is killed if it exceeds the specified timeout. * Returns a tuple: `(success_bool, json_result_or_error_string)`. ``` -------------------------------- ### Generate Canonical Test Keys with Python Source: https://context7.com/poetiq-ai/poetiq-arc-agi-solver/llms.txt Provides a utility function `canonical_test_key` to generate canonical keys for grouping solutions based on test output similarity. This is crucial for the parallel coding solver to group solutions with identical test outputs, enabling effective voting mechanisms. ```python from arc_agi.utils import canonical_test_key from arc_agi.types import RunResult test_results: list[RunResult] = [ {'success': False, 'output': '[[1, 0], [0, 1]]', 'soft_score': 0.0, 'error': None, 'code': '...'}, {'success': False, 'output': '[[2, 2], [2, 2]]', 'soft_score': 0.0, 'error': None, 'code': '...'} ] key = canonical_test_key(test_results) # Returns: "[[[1, 0], [0, 1]], [[2, 2], [2, 2]]]" # Used in solve_parallel_coding to group solutions: # - Solutions with identical test outputs get same key # - Enables voting by counting solutions per unique output ``` -------------------------------- ### LLM API Calls Source: https://context7.com/poetiq-ai/poetiq-arc-agi-solver/llms.txt Make asynchronous, rate-limited API calls to various LLM providers with built-in retry logic for transient errors. ```APIDOC ## LLM API Calls ### Description Async LLM invocation with rate limiting and retry logic. Make rate-limited API calls to various LLM providers with automatic retries for transient errors and timeout tracking. ### Method Asynchronous function call (e.g., Python `async def`) ### Endpoint `llm` (conceptual function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **model** (str) - Required - The identifier of the LLM model to use (e.g., 'gemini/gemini-3-pro-preview', 'openai/gpt-5'). * **message** (str) - Required - The prompt or message to send to the LLM. * **temperature** (float) - Optional - Controls randomness in the output (0.0-1.0). Defaults to 1.0. * **request_timeout** (int) - Optional - Timeout for the LLM request in seconds. Defaults to 600. * **max_remaining_time** (float) - Optional - Maximum remaining time allowed for requests in seconds. * **max_remaining_timeouts** (int) - Optional - Maximum number of timeouts allowed. * **problem_id** (str) - Optional - Identifier for the problem context. * **retries** (int) - Optional - Number of times to retry the request on failure. Defaults to 3. ### Request Example ```python from arc_agi.llm import llm response, duration, remaining_time, remaining_timeouts, prompt_tokens, completion_tokens = await llm( model='gemini/gemini-3-pro-preview', message='You are solving an ARC task. Analyze this pattern...', temperature=1.0, request_timeout=600, max_remaining_time=3600.0, max_remaining_timeouts=10, problem_id='abc123', retries=3 ) ``` ### Response #### Success Response (200) * **content** (str) - The response content from the LLM. * **duration** (float) - The time taken for the request in seconds. * **remaining_time** (float) - Remaining time budget in seconds. * **remaining_timeouts** (int) - Remaining timeout budget. * **prompt_tokens** (int) - Number of tokens in the prompt. * **completion_tokens** (int) - Number of tokens in the completion. #### Response Example ```json [ "The pattern suggests a transformation that replaces all 0s with 1s.", 1.23, 3598.77, 9, 150, 50 ] ``` ### Supported Models * gemini/gemini-3-pro-preview * gemini/gemini-2.5-pro (16K thinking tokens) * openai/gpt-5, openai/gpt-5.1 (high reasoning effort) * anthropic/claude-sonnet-4-5, anthropic/claude-haiku-4-5 (32K thinking) * xai/grok-4, xai/grok-4-fast * groq/openai/gpt-oss-120b ### Notes * Rate limiting is applied per model (typically 1-2 requests/second). * Automatic retries are performed for `RateLimitError`, `InternalServerError`, etc. * Timeout errors decrement `max_remaining_timeouts`. ``` -------------------------------- ### Async LLM API Invocation Source: https://context7.com/poetiq-ai/poetiq-arc-agi-solver/llms.txt Provides an asynchronous interface for making API calls to various Large Language Models (LLMs). It includes built-in rate limiting, automatic retries for common errors, and tracks request duration and remaining API limits. ```python from arc_agi.llm import llm response, duration, remaining_time, remaining_timeouts, prompt_tokens, completion_tokens = await llm( model='gemini/gemini-3-pro-preview', message='You are solving an ARC task. Analyze this pattern...', temperature=1.0, request_timeout=600, max_remaining_time=3600.0, max_remaining_timeouts=10, problem_id='abc123', retries=3 ) # Supported models: # - gemini/gemini-3-pro-preview # - gemini/gemini-2.5-pro (with 16K thinking tokens) # - openai/gpt-5, openai/gpt-5.1 (with high reasoning effort) # - anthropic/claude-sonnet-4-5, anthropic/claude-haiku-4-5 (with 32K thinking) # - xai/grok-4, xai/grok-4-fast # - groq/openai/gpt-oss-120b # Rate limiting applied per model (1-2 requests/second) # Automatic retry on RateLimitError, InternalServerError, etc. # Timeout errors decrement max_remaining_timeouts # Returns tuple: (content, duration, remaining_time, remaining_timeouts, prompt_tokens, completion_tokens) ``` -------------------------------- ### Sandbox Code Execution Source: https://context7.com/poetiq-ai/poetiq-arc-agi-solver/llms.txt Executes Python code in an isolated subprocess, providing safety and determinism. It supports JSON input/output and includes protection against timeouts. The environment is clean, with standard libraries like NumPy available. ```python from arc_agi.sandbox import run code = ''' import numpy as np def transform(grid: np.ndarray) -> np.ndarray: """Replace all 0s with 1s.""" return np.where(grid == 0, 1, grid) ''' input_grid = [[0, 0, 1], [0, 1, 0], [1, 0, 0]] success, output = await run( code=code, input_grid=input_grid, timeout_s=1.5 ) if success: # output is JSON string: '[[1, 1, 1], [1, 1, 1], [1, 1, 1]]' print(f"Transformation succeeded: {output}") else: # output contains error message print(f"Execution failed: {output}") # Execution environment: # - Temporary directory with isolated script # - PYTHONHASHSEED=0 for determinism # - numpy and scipy available # - Subprocess killed on timeout # - Returns (success_bool, json_result_or_error_string) ``` -------------------------------- ### Parallel Coding Solver with Voting Source: https://context7.com/poetiq-ai/poetiq-arc-agi-solver/llms.txt Runs multiple coding experts concurrently to solve problems. Solutions are grouped by test output similarity and ranked using diversity-first voting. It handles configurable tie-breaking strategies and supports various LLM configurations. ```python from arc_agi.solve_parallel_coding import solve_parallel_coding train_in = [[[0, 1], [1, 0]]] train_out = [[[1, 0], [0, 1]]] test_in = [[[1, 1], [0, 0]]] expert_configs = [ { 'llm_id': 'gemini/gemini-3-pro-preview', 'max_iterations': 10, 'solver_temperature': 1.0, 'use_new_voting': True, 'count_failed_matches': True, 'iters_tiebreak': False, 'low_to_high_iters': False, 'seed': 0, # ... other config parameters }, { 'llm_id': 'openai/gpt-5', 'max_iterations': 8, 'solver_temperature': 0.8, 'seed': 10, # ... other config parameters } ] results = await solve_parallel_coding( train_in=train_in, train_out=train_out, test_in=test_in, expert_configs=expert_configs, problem_id="parallel_example" ) # Returns ranked list where: # - Solutions passing all training examples come first # - Grouped by identical test outputs (diversity-first) # - Sorted by vote count within each group # - Failed solutions ranked by soft score ``` -------------------------------- ### Parallel Coding Solver API Source: https://context7.com/poetiq-ai/poetiq-arc-agi-solver/llms.txt Run multiple coding experts concurrently to solve ARC tasks. Solutions are grouped by test output similarity and ranked using diversity-first voting. ```APIDOC ## Parallel Coding Solver API ### Description Multi-expert parallel solving with voting. Run multiple coding experts concurrently, group solutions by test output similarity, and rank using diversity-first voting with configurable tiebreaking strategies. ### Method Asynchronous function call (e.g., Python `async def`) ### Endpoint `solve_parallel_coding` (conceptual function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **train_in** (list[list[list[int]]]) - Required - Training input grids. * **train_out** (list[list[list[int]]]) - Required - Training output grids. * **test_in** (list[list[list[int]]]) - Required - Test input grids. * **expert_configs** (list[dict]) - Required - List of configurations for each expert. * **llm_id** (str) - Required - Identifier for the LLM to use. * **max_iterations** (int) - Optional - Maximum number of iterations for the solver. * **solver_temperature** (float) - Optional - Temperature for LLM sampling. * **use_new_voting** (bool) - Optional - Whether to use the new voting mechanism. * **count_failed_matches** (bool) - Optional - Whether to count failed matches. * **iters_tiebreak** (bool) - Optional - Tiebreaking strategy based on iterations. * **low_to_high_iters** (bool) - Optional - Iteration ordering. * **seed** (int) - Optional - Random seed for reproducibility. * **problem_id** (str) - Optional - Identifier for the problem. ### Request Example ```python from arc_agi.solve_parallel_coding import solve_parallel_coding train_in = [[[0, 1], [1, 0]]] train_out = [[[1, 0], [0, 1]]] test_in = [[[1, 1], [0, 0]]] expert_configs = [ { 'llm_id': 'gemini/gemini-3-pro-preview', 'max_iterations': 10, 'solver_temperature': 1.0, 'use_new_voting': True, 'count_failed_matches': True, 'iters_tiebreak': False, 'low_to_high_iters': False, 'seed': 0, }, { 'llm_id': 'openai/gpt-5', 'max_iterations': 8, 'solver_temperature': 0.8, 'seed': 10, } ] results = await solve_parallel_coding( train_in=train_in, train_out=train_out, test_in=test_in, expert_configs=expert_configs, problem_id="parallel_example" ) ``` ### Response #### Success Response (200) * **results** (list) - A ranked list of solutions. Solutions passing all training examples come first, grouped by identical test outputs, then sorted by vote count. Failed solutions are ranked by soft score. #### Response Example ```json [ { "solution": [[1, 1], [1, 1]], "score": 1.0, "vote_count": 2, "passed_training": true }, { "solution": [[0, 0], [0, 0]], "score": 0.5, "vote_count": 1, "passed_training": false } ] ``` ``` -------------------------------- ### ARC AGI Solver Type Definitions in Python Source: https://context7.com/poetiq-ai/poetiq-arc-agi-solver/llms.txt Defines core TypedDict structures for configuration, messages, execution results, and solution representations used throughout the ARC AGI Solver codebase. These types ensure data consistency and clarity for components like `ExpertConfig`, `RunResult`, `ARCAGISolution`, and `ARCAGIResult`. ```python from arc_agi.types import ExpertConfig, ARCAGIResult, ARCAGISolution, RunResult, Models # Expert configuration config: ExpertConfig = { 'use_new_voting': True, 'count_failed_matches': True, 'iters_tiebreak': False, 'low_to_high_iters': False, 'solver_prompt': '...', 'feedback_prompt': '...', 'llm_id': 'gemini/gemini-3-pro-preview', 'max_iterations': 10, 'solver_temperature': 1.0, 'max_solutions': 5, 'selection_probability': 1.0, 'seed': 0, 'shuffle_examples': True, 'improving_order': True, 'return_best_result': True, 'request_timeout': 3600, 'max_total_timeouts': 15, 'max_total_time': None, 'num_experts': 1, 'per_iteration_retries': 2, } # Result from single code execution run_result: RunResult = { 'success': True, 'output': '[[1, 1], [1, 1]]', 'soft_score': 0.95, 'error': None, 'code': 'def transform(grid): ...' } # Solution with feedback solution: ARCAGISolution = { 'code': 'def transform(grid): ...', 'feedback': 'Solves Example #1 correctly. Solves Example #2 incorrectly. Shape mismatch...', 'score': 0.75 } # Complete result from solver iteration result: ARCAGIResult = { 'train_results': [run_result], 'results': [run_result], 'iteration': 5, 'prompt_tokens': 12000, 'completion_tokens': 800 } ``` -------------------------------- ### Score Task Accuracy with Python Source: https://context7.com/poetiq-ai/poetiq-arc-agi-solver/llms.txt Calculates task-level accuracy by comparing attempts against ground truth outputs for each test input. It uses `score_task` for overall accuracy and `grids_equal` for direct grid comparison. The scoring logic correctly identifies a solution if either `attempt_1` or `attempt_2` matches the ground truth, returning the fraction of solved test inputs. ```python from arc_agi.scoring import score_task, grids_equal kaggle_preds = [ {"attempt_1": [[1, 0], [0, 1]], "attempt_2": [[0, 1], [1, 0]]}, {"attempt_1": [[1, 1], [1, 1]], "attempt_2": [[0, 0], [0, 0]]} ] gt_outputs = [ [[1, 0], [0, 1]], # Matches attempt_1 [[2, 2], [2, 2]] # Matches neither ] task_score = score_task(kaggle_preds, gt_outputs) # Returns: 0.5 (1 out of 2 correct) # Grid equality check grid_a = [[1, 2], [3, 4]] grid_b = [[1, 2], [3, 4]] are_equal = grids_equal(grid_a, grid_b) # Returns: True # Scoring logic: # - Correct if attempt_1 == GT OR attempt_2 == GT # - Returns fraction of test inputs solved # - Used for evaluation against ground truth ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.