An OpenEnv-compliant reinforcement learning environment for data cleaning agents.
DataClean-Env challenges LLM agents to clean realistic tabular datasets β null imputation, dtype correction, outlier clipping, deduplication, and more. Every episode is reproducible via a seeded generator. Every grader is a deterministic pandas assertion.
export API_BASE_URL=https://router.huggingface.co/v1
export MODEL_NAME=meta-llama/Meta-Llama-3-70B-Instruct
export HF_TOKEN=hf_...
pip install -r requirements.txt
python inference.py
inference.py uses the OpenAI client pointed at the HuggingFace router. Runs all 3 tasks, completes in under 20 minutes, saves scores to baseline_scores.json.
Data cleaning consumes 60β80% of a data scientist's working time. It is a universal, expensive, well-understood problem β but no existing OpenEnv environment tests it.
DataClean-Env fills that gap:
/web for live judge demos| Field | Type | Description |
|---|---|---|
action_type | string | One of 7 operations |
column | string | null | Target column (required for most ops) |
params | object | Operation-specific parameters |
confidence | float 0β1 | Agent's self-reported confidence β calibration is rewarded |
| Action type | Key params | Effect |
|---|---|---|
fill_nulls | strategy: mean|median|mode|constant|ffill | Impute missing values |
remove_duplicates | subset (optional) | Drop duplicate rows |
fix_dtype | target_dtype: int64|float64|str|datetime64 | Cast column to correct type |
clip_outliers | method: iqr|zscore|percentile | Clip extreme values |
rename_column | new_name | Rename to canonical name |
drop_column | β | Drop irrelevant column |
done | β | Signal cleaning complete |
| Field | Type | Description |
|---|---|---|
episode_id | string | Unique episode UUID |
step | int | Current step |
budget_remaining | int | Steps left |
n_rows / n_cols | int | Dataframe shape |
duplicate_rate | float | Fraction of duplicate rows |
columns | list[ColumnProfile] | Per-column stats + corruption flags |
ops_log | list | All operations applied so far |
quality_scores | dict | null_score, type_score, outlier_score, dup_score, overall |
last_action_result | string | Feedback on previous action |
Corruption flags: heavy_nulls, has_nulls, heavy_outliers, type_chaos
300 rows. Challenges: 22% null ages, salary outliers, years_at_company stored as string, 30 duplicates.
Grader: null_rate β€ 0.01, numeric dtypes, IQR-clean salary, no duplicates β score 0.0β1.0
500 rows. Challenges: 28% null quantities, 15% null ratings, amount outliers, irrelevant internal_hash column to drop, 40 duplicates.
Grader: all nulls β€ 1%, numeric dtypes, outliers clipped, internal_hash absent β score 0.0β1.0
800 rows. Mixed per-column corruption β agent must diagnose each independently:
| Column | Issue |
|---|---|
patient_age | 25% nulls |
weight_kg | impossible outliers (β10 to 999 kg) |
glucose_mgdl | type_chaos (floats + strings mixed) |
cholesterol | 12% nulls + outliers |
systolic_bp | 8% nulls |
admin_notes | irrelevant β drop it |
Grader: weighted null + dtype + outlier + dup scores β score 0.0β1.0
Base: β0.01 per step (efficiency pressure)
| Event | Reward |
|---|---|
| Fill nulls (dirty column) | +0.10 Γ (1 β remaining_null_rate) |
| Remove duplicates | +0.12 |
| Fix dtype | +0.10 |
| Clip outliers | +0.08 Γ (1 + std_reduction) |
| Drop irrelevant column | +0.04 |
| Action on clean column | β0.05 |
| Done (quality β₯ 0.80) | +0.15 |
| Done (quality < 0.80) | +0.15 Γ quality |
| Provenance bonus | +0.05 if ops log is fully reproducible |
| Confidence bonus | +0.04 high-confidence correct action |
| Confidence penalty | β0.06 high-confidence wrong action |
| Variable | Default | Description |
|---|---|---|
API_BASE_URL | https://router.huggingface.co/v1 | LLM API endpoint |
MODEL_NAME | meta-llama/Meta-Llama-3-70B-Instruct | Model identifier |
HF_TOKEN | β | HuggingFace API key (huggingface.co/settings/tokens) |
export API_BASE_URL=https://router.huggingface.co/v1
export MODEL_NAME=meta-llama/Meta-Llama-3-70B-Instruct
export HF_TOKEN=hf_...
python inference.py
uvicorn server:app --host 0.0.0.0 --port 7860
# Gradio UI at http://localhost:7860/web
docker build -t dataclean-env .
docker run -p 7860:7860 \
-e API_BASE_URL=https://router.huggingface.co/v1 \
-e MODEL_NAME=meta-llama/Meta-Llama-3-70B-Instruct \
-e HF_TOKEN=hf_... \
dataclean-env
openenv validate --url https://huggingface.co/spaces/jithendra/dataclean-env
Seed: 42 | Script: python inference.py
| Task | Score | Reward | Steps | Provenance |
|---|---|---|---|---|
| task_1 | 0.9167 | 0.4700 | 3 | β |
| task_2 | 0.9500 | 0.7899 | 5 | β |
| task_3 | 0.9500 | 0.9900 | 7 | β |
inference.pyModel: meta-llama/Meta-Llama-3-70B-Instruct Β· Provider: HuggingFace router Β· Client: OpenAI
| Task | Score | Reward | Steps | Provenance |
|---|---|---|---|---|
| task_1 | TBD | TBD | TBD | TBD |
| task_2 | TBD | TBD | TBD | TBD |
| task_3 | TBD | TBD | TBD | TBD |
Run python inference.py with your HF_TOKEN to reproduce.
from baseline.agent import NemotronAgentWrapper
agent = NemotronAgentWrapper(
server_url="https://huggingface.co/spaces/jithendra/dataclean-env"
)
obs = agent.reset(task_id="task_1", seed=42)
action = agent.step(obs)
score = agent.score()
agent.close()
DataClean-Env is not just to evaluate existing models β it is a fully functional RL Training Environment.
We provide training_script.py to demonstrate how AI researchers can securely hook our mathematically dense reward signals into the HuggingFace TRL library to fine-tune Small Language Models (like Qwen2.5) from scratch using Group Relative Policy Optimization (GRPO).
# Optional RL dependencies (requires large GPU for actual training)
pip install trl transformers torch datasets accelerate
# Run the training loop demonstration
python training_script.py --dry-run
DataClean-Env features a professional Gradio interface with two distinct modes:
.csv files bypassing the TASK_REGISTRY, proving the environment scales seamlessly to custom, real-world data outside of the hackathon's static tests.openenvHF_TOKEN, API_BASE_URL, MODEL_NAMEopenenv validate --url https://huggingface.co/spaces/Jxth/dataclean-envMIT License. Built for the Meta-Scalar OpenEnv Hackathon.
11 commits
Python
99.3%
An OpenEnv-compliant reinforcement learning environment for data cleaning agents.
DataClean-Env challenges LLM agents to clean realistic tabular datasets β null imputation, dtype correction, outlier clipping, deduplication, and more. Every episode is reproducible via a seeded generator. Every grader is a deterministic pandas assertion.
export API_BASE_URL=https://router.huggingface.co/v1
export MODEL_NAME=meta-llama/Meta-Llama-3-70B-Instruct
export HF_TOKEN=hf_...
pip install -r requirements.txt
python inference.py
inference.py uses the OpenAI client pointed at the HuggingFace router. Runs all 3 tasks, completes in under 20 minutes, saves scores to baseline_scores.json.
Data cleaning consumes 60β80% of a data scientist's working time. It is a universal, expensive, well-understood problem β but no existing OpenEnv environment tests it.
DataClean-Env fills that gap:
/web for live judge demos| Field | Type | Description |
|---|---|---|
action_type | string | One of 7 operations |
column | string | null | Target column (required for most ops) |
params | object | Operation-specific parameters |
confidence | float 0β1 | Agent's self-reported confidence β calibration is rewarded |
| Action type | Key params | Effect |
|---|---|---|
fill_nulls | strategy: mean|median|mode|constant|ffill | Impute missing values |
remove_duplicates | subset (optional) | Drop duplicate rows |
fix_dtype | target_dtype: int64|float64|str|datetime64 | Cast column to correct type |
clip_outliers | method: iqr|zscore|percentile | Clip extreme values |
rename_column | new_name | Rename to canonical name |
drop_column | β | Drop irrelevant column |
done | β | Signal cleaning complete |
| Field | Type | Description |
|---|---|---|
episode_id | string | Unique episode UUID |
step | int | Current step |
budget_remaining | int | Steps left |
n_rows / n_cols | int | Dataframe shape |
duplicate_rate | float | Fraction of duplicate rows |
columns | list[ColumnProfile] | Per-column stats + corruption flags |
ops_log | list | All operations applied so far |
quality_scores | dict | null_score, type_score, outlier_score, dup_score, overall |
last_action_result | string | Feedback on previous action |
Corruption flags: heavy_nulls, has_nulls, heavy_outliers, type_chaos
300 rows. Challenges: 22% null ages, salary outliers, years_at_company stored as string, 30 duplicates.
Grader: null_rate β€ 0.01, numeric dtypes, IQR-clean salary, no duplicates β score 0.0β1.0
500 rows. Challenges: 28% null quantities, 15% null ratings, amount outliers, irrelevant internal_hash column to drop, 40 duplicates.
Grader: all nulls β€ 1%, numeric dtypes, outliers clipped, internal_hash absent β score 0.0β1.0
800 rows. Mixed per-column corruption β agent must diagnose each independently:
| Column | Issue |
|---|---|
patient_age | 25% nulls |
weight_kg | impossible outliers (β10 to 999 kg) |
glucose_mgdl | type_chaos (floats + strings mixed) |
cholesterol | 12% nulls + outliers |
systolic_bp | 8% nulls |
admin_notes | irrelevant β drop it |
Grader: weighted null + dtype + outlier + dup scores β score 0.0β1.0
Base: β0.01 per step (efficiency pressure)
| Event | Reward |
|---|---|
| Fill nulls (dirty column) | +0.10 Γ (1 β remaining_null_rate) |
| Remove duplicates | +0.12 |
| Fix dtype | +0.10 |
| Clip outliers | +0.08 Γ (1 + std_reduction) |
| Drop irrelevant column | +0.04 |
| Action on clean column | β0.05 |
| Done (quality β₯ 0.80) | +0.15 |
| Done (quality < 0.80) | +0.15 Γ quality |
| Provenance bonus | +0.05 if ops log is fully reproducible |
| Confidence bonus | +0.04 high-confidence correct action |
| Confidence penalty | β0.06 high-confidence wrong action |
| Variable | Default | Description |
|---|---|---|
API_BASE_URL | https://router.huggingface.co/v1 | LLM API endpoint |
MODEL_NAME | meta-llama/Meta-Llama-3-70B-Instruct | Model identifier |
HF_TOKEN | β | HuggingFace API key (huggingface.co/settings/tokens) |
export API_BASE_URL=https://router.huggingface.co/v1
export MODEL_NAME=meta-llama/Meta-Llama-3-70B-Instruct
export HF_TOKEN=hf_...
python inference.py
uvicorn server:app --host 0.0.0.0 --port 7860
# Gradio UI at http://localhost:7860/web
docker build -t dataclean-env .
docker run -p 7860:7860 \
-e API_BASE_URL=https://router.huggingface.co/v1 \
-e MODEL_NAME=meta-llama/Meta-Llama-3-70B-Instruct \
-e HF_TOKEN=hf_... \
dataclean-env
openenv validate --url https://huggingface.co/spaces/jithendra/dataclean-env
Seed: 42 | Script: python inference.py
| Task | Score | Reward | Steps | Provenance |
|---|---|---|---|---|
| task_1 | 0.9167 | 0.4700 | 3 | β |
| task_2 | 0.9500 | 0.7899 | 5 | β |
| task_3 | 0.9500 | 0.9900 | 7 | β |
inference.pyModel: meta-llama/Meta-Llama-3-70B-Instruct Β· Provider: HuggingFace router Β· Client: OpenAI
| Task | Score | Reward | Steps | Provenance |
|---|---|---|---|---|
| task_1 | TBD | TBD | TBD | TBD |
| task_2 | TBD | TBD | TBD | TBD |
| task_3 | TBD | TBD | TBD | TBD |
Run python inference.py with your HF_TOKEN to reproduce.
from baseline.agent import NemotronAgentWrapper
agent = NemotronAgentWrapper(
server_url="https://huggingface.co/spaces/jithendra/dataclean-env"
)
obs = agent.reset(task_id="task_1", seed=42)
action = agent.step(obs)
score = agent.score()
agent.close()
DataClean-Env is not just to evaluate existing models β it is a fully functional RL Training Environment.
We provide training_script.py to demonstrate how AI researchers can securely hook our mathematically dense reward signals into the HuggingFace TRL library to fine-tune Small Language Models (like Qwen2.5) from scratch using Group Relative Policy Optimization (GRPO).
# Optional RL dependencies (requires large GPU for actual training)
pip install trl transformers torch datasets accelerate
# Run the training loop demonstration
python training_script.py --dry-run
DataClean-Env features a professional Gradio interface with two distinct modes:
.csv files bypassing the TASK_REGISTRY, proving the environment scales seamlessly to custom, real-world data outside of the hackathon's static tests.openenvHF_TOKEN, API_BASE_URL, MODEL_NAMEopenenv validate --url https://huggingface.co/spaces/Jxth/dataclean-envMIT License. Built for the Meta-Scalar OpenEnv Hackathon.
11 commits
Python
99.3%