Dataset Viewer
Duplicate
The dataset viewer is not available for this split.
Cannot extract the features (columns) for the split 'train' of the config 'default' of the dataset.
Error code:   FeaturesError
Exception:    UnicodeDecodeError
Message:      'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
Traceback:    Traceback (most recent call last):
                File "/src/services/worker/src/worker/job_runners/split/first_rows.py", line 243, in compute_first_rows_from_streaming_response
                  iterable_dataset = iterable_dataset._resolve_features()
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/iterable_dataset.py", line 4195, in _resolve_features
                  features = _infer_features_from_batch(self.with_format(None)._head())
                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/iterable_dataset.py", line 2533, in _head
                  return next(iter(self.iter(batch_size=n)))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/iterable_dataset.py", line 2711, in iter
                  for key, pa_table in ex_iterable.iter_arrow():
                                       ^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/iterable_dataset.py", line 2249, in _iter_arrow
                  yield from self.ex_iterable._iter_arrow()
                File "/usr/local/lib/python3.12/site-packages/datasets/iterable_dataset.py", line 494, in _iter_arrow
                  for key, pa_table in iterator:
                                       ^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/iterable_dataset.py", line 384, in _iter_arrow
                  for key, pa_table in self.generate_tables_fn(**gen_kwags):
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/packaged_modules/text/text.py", line 98, in _generate_tables
                  batch = f.read(self.config.chunksize)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.12/site-packages/datasets/utils/file_utils.py", line 844, in read_with_retries
                  out = read(*args, **kwargs)
                        ^^^^^^^^^^^^^^^^^^^^^
                File "<frozen codecs>", line 322, in decode
              UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

CP-Arena: Decision-Making Under Uncertainty — An RL Environment for Algorithm Reasoning

CP-Arena is a partially observable reinforcement learning environment that models one of the hardest real-world cognitive skills: making correct decisions with incomplete information, under time pressure, with costly mistakes.

The agent faces a hidden problem. It must decide what to reveal, what to test, and when to commit — just like an engineer triaging a production incident, a doctor narrowing a diagnosis, or a trader reading a market. The domain is algorithm selection; the skill being learned is universal.

CP-Arena does not teach an agent to write code. It teaches an agent how to reason and decide — which information is worth gathering, which hypotheses to test, and when to commit to a solution.


Submission Checklist

Requirement Status
HF Space deployed and running ✅
OpenEnv spec compliant (openenv.yaml) ✅
Dockerfile builds and runs ✅
3 tasks with graders (scores 0.0–1.0) ✅
inference.py with correct log format ✅
Offline execution — no external APIs ✅
Docker-first execution ✅
validate-submission.sh passes all 3 checks ✅

Mandatory File Tree

cp_arena_env/
├── inference.py                     # Demo agent (LLM-powered) — evaluator entry point
├── Dockerfile                       # Docker build (root level)
├── openenv.yaml                     # OpenEnv spec
├── requirements.txt                 # Python dependencies
├── validate-submission.sh           # Pre-submission validator
├── README.md                        # This file
├── __init__.py                      # Package exports
├── client.py                        # Environment client interface
├── models.py                        # Action/Observation/State models
├── pyproject.toml                   # Project metadata
└── server/
    ├── app.py                       # FastAPI server
    ├── cp_arena_env_environment.py  # Core environment logic
    └── dataset/
        └── problems.json            # 50 CP problems (local, offline)

Quick Start

1. Install

pip install openenv-core
uv sync

2. Run locally

uv run uvicorn server.app:app --reload --port 8000

3. Run with Docker

docker build -t cp-arena-env:latest .
docker run -p 8000:8000 cp-arena-env:latest

4. Run inference (demo agent)

Note: inference.py is a demo script only. It is not required for environment correctness. The environment runs fully without it.

export HF_TOKEN=your_huggingface_token
export API_BASE_URL=https://router.huggingface.co/v1
export MODEL_NAME=Qwen/Qwen2.5-72B-Instruct
export IMAGE_NAME=cp-arena-env:latest

python inference.py

5. Validate before submitting

bash validate-submission.sh https://deekshitha08-cp-arena-env.hf.space

Expected output:

[06:56:33] Step 1/3: Pinging HF Space ...
[06:56:35] PASSED -- HF Space is live and responds to /reset
[06:56:35] Step 2/3: Running docker build ...
[06:58:13] PASSED -- Docker build succeeded
[06:58:13] Step 3/3: Running openenv validate ...
[06:58:14] PASSED -- openenv validate passed
[06:58:14]   [OK] cp_arena: Ready for multi-mode deployment

All 3/3 checks passed!
Your submission is ready to submit.

Offline Execution — Compliance Statement

CP-Arena is fully self-contained and runs completely offline:

  • No external APIs required at runtime
  • No cloud database dependencies
  • No internet access needed inside the container
  • Dataset stored locally at server/dataset/problems.json
  • Deterministic grading logic — same input always gives same output
  • Docker-first execution — fully reproducible inside container
  • OpenEnv-compatible structure — passes openenv validate

Quick Evaluation Example

Problem: cf_031 | Difficulty: 1600

Step Action Observation Reward
1 reveal_N N scale: large -2.0
2 reveal_time_limit Time: tight -4.0
3 test_graph PLAUSIBLE +3.0
4 submit_nlogn AC +117.5

Total reward: 114.5 | Score: 0.715 | Steps: 4


Three Tasks

Task Objective Success Metric
algorithm_selection Identify correct algorithm Correct paradigm chosen
complexity_optimization Choose optimal time complexity Feasibility under constraints
problem_classification Classify with minimum reveals Efficiency + correctness score

Task 1 — Algorithm Selection

Agent reveals constraints, tests algorithm hypotheses, and submits. Grader checks whether the chosen algorithm is valid.

  • Correct algorithm: +100 + time bonus (up to +30)
  • Wrong algorithm: -30
  • Submission cost: -10 per attempt
  • Info gathering: exponential cost (-2, -4, -8, -16, -32)

Task 2 — Complexity Optimization

Agent commits to a time complexity. Grader checks feasibility under constraints.

  • Correct complexity: +100 + efficiency bonus
  • Better than needed: +50 (partial credit)
  • TLE: -20

Task 3 — Problem Classification

Agent is rewarded for correctness AND efficiency. Fewer reveals = higher score.

  • Correct classification: +60 + efficiency score (up to +50)
  • Efficiency score = (5 - reveals_used) × 10
  • Wrong classification: -25

Normalized Score

score = (total_reward + 100) / 300
score = clamp(score, 0.0, 1.0)

Action Space (14 Actions)

ID Action Type Description
0 reveal_N Info Reveal input size scale
1 reveal_time_limit Info Reveal time pressure
2 reveal_memory Info Reveal memory pressure
3 reveal_tags Info Reveal problem category tags
4 reveal_example Info Reveal sample I/O pattern
5 test_greedy Reasoning Test if greedy is plausible
6 test_dp Reasoning Test if DP is plausible
7 test_graph Reasoning Test if graph approach is plausible
8 test_binary_search Reasoning Test if binary search is plausible
9 test_math Reasoning Test if math approach is plausible
10 test_string Reasoning Test if string approach is plausible
11 submit_linear Submit Submit O(N) solution
12 submit_nlogn Submit Submit O(N log N) solution
13 submit_quadratic Submit Submit O(N²) solution

Observation Space

{
  "revealed_n": "large",
  "revealed_time_limit": "tight",
  "revealed_memory": "normal",
  "revealed_tags": null,
  "revealed_example": false,
  "test_greedy_signal": null,
  "test_dp_signal": null,
  "test_graph_signal": true,
  "test_binary_search_signal": null,
  "test_math_signal": null,
  "test_string_signal": null,
  "time_remaining": 245,
  "attempts_left": 2,
  "last_verdict": "none",
  "last_reward": 3.0,
  "step_count": 3,
  "info_actions_taken": 2,
  "message": "test_graph: PLAUSIBLE (+3)"
}

Reward Design

Event Reward
AC — Algorithm Selection +100 + time bonus
AC — Complexity Optimization +100 + efficiency bonus
AC — Problem Classification +60 + efficiency bonus
WA wrong algorithm -30
TLE wrong complexity -20
All attempts exhausted -50
Time runs out -20
Info reveal (exponential) -2 / -4 / -8 / -16 / -32
Reasoning action +3 or -3
Submission attempt -10
Repeated reveal -5
Inconsistent complexity -5

Dataset

50 problems, difficulties 800–2000, covering greedy, dp, graph, binary_search, math, string, brute_force with complexities O(N), O(N log N), O(N²).

{
  "id": "cf_031",
  "N_scale": "large",
  "time_pressure": "tight",
  "memory_pressure": "normal",
  "valid_algorithms": ["graph"],
  "valid_complexities": ["nlogn"],
  "tags": ["graph", "topological_sort"],
  "difficulty": 1600
}

Why This Is Genuine RL

Property Description
Partial observability Agent starts with zero information every episode
Sequential decisions Earlier actions affect later states
Exploration needed Agent must learn which reveals are most diagnostic
Shaped reward Multi-component reward encourages strategy
Belief updating Verdicts update available state for retries
Multiple tasks 3 distinct evaluation objectives

API Endpoints

Endpoint Method Description
/reset POST Start new episode. Body: {"task": "algorithm_selection"}
/step POST Take action. Body: {"action_id": 0}
/state GET Get current episode metadata
/health GET Health check — returns 200 if live

Python Client Example

import asyncio
from cp_arena_env import CpArenaAction, CpArenaEnv

async def main():
    client = await CpArenaEnv.from_env("Deekshitha08/cp_arena_env")
    async with client:
        result = await client.reset(task="algorithm_selection")
        print(result.observation.message)

        result = await client.step(CpArenaAction(action_id=0))
        result = await client.step(CpArenaAction(action_id=7))
        result = await client.step(CpArenaAction(action_id=12))
        print(result.observation.last_verdict)
        print(result.reward)

asyncio.run(main())

Tech Stack

OpenEnv, FastAPI, Uvicorn, Pydantic, Docker, Hugging Face Spaces.


Downloads last month
35