Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,4 @@ tensorboard/
.env
.env.*
tutorials/tutorial_llamaindex/data/gutenberg/
.ipynb_checkpoints/
1 change: 1 addition & 0 deletions multi-agent-ds-benchmark/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
Binary file added multi-agent-ds-benchmark/Amazon_Reviews_eda.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added multi-agent-ds-benchmark/Amazon_Reviews_shap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions multi-agent-ds-benchmark/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Use Python 3.12 slim (already has Python and pip).
FROM python:3.12-slim

# Avoid interactive prompts during apt operations.
ENV DEBIAN_FRONTEND=noninteractive

# Install CA certificates (needed for HTTPS).
RUN apt-get update && apt-get install -y \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*

# Install project specific packages.
RUN mkdir -p /install
COPY requirements.txt /install/requirements.txt
RUN pip install --upgrade pip && \
pip install --no-cache-dir jupyterlab jupyterlab_vim jupytext -r /install/requirements.txt

# Config.
COPY etc_sudoers /install/
COPY etc_sudoers /etc/sudoers
COPY bashrc /root/.bashrc

# Report package versions.
COPY version.sh /install/
RUN /install/version.sh 2>&1 | tee version.log

# Jupyter.
EXPOSE 8888

CMD ["/bin/bash"]
Binary file added multi-agent-ds-benchmark/Heart_Disease_eda.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added multi-agent-ds-benchmark/Heart_Disease_shap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added multi-agent-ds-benchmark/NYC_Taxi_eda.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added multi-agent-ds-benchmark/NYC_Taxi_shap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
142 changes: 142 additions & 0 deletions multi-agent-ds-benchmark/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# Benchmarking in Agentic Reasoning for Data Science

This project tests whether a multi-agent pipeline with a built-in quality
reviewer gives more reliable results on data science tasks than a plain
one-pass pipeline or an AutoML tool, especially when the data is messy. The
write-up is the blog post "We Broke Our Data on Purpose. Here's Who Noticed."

## The short answer

- The reviewer did not make the pipeline more accurate. On heart disease and
Amazon reviews the systems tie. On NYC taxi tips the single pass is ahead.
- The reviewer is useful for catching broken data. It found every impossible
value we planted, and it flagged a planted leaked column and a real one (taxi
payment type) in 10 of 10 runs, where the other systems, AutoGluon included,
reported fake near-perfect scores.
- It missed a weaker leak (taxi total amount), so it is a safety net with
holes, not a guarantee.

## What we compare

All systems get the same train/test split, the same features and the same
corrupted training data. The test set is always clean.

- **Single pass:** the pipeline with no reviewer and no retries.
- **Graph without reviewer:** the same graph with the reviewer switched off.
- **LangGraph + reviewer:** the cyclic pipeline. The reviewer can send the
graph back to the EDA step or the model step, up to three times. There are two
versions, the first reviewer and a rebuilt one.
- **AutoGluon:** `medium_quality` preset with a 60 second limit, set to optimize
MCC.
- **Always positive:** a model that predicts "yes" for everyone, to show how
much a score is worth.

## Datasets

- **Heart disease:** the Cleveland data, 303 patients.
- **NYC taxi tips:** a 5,000-row sample of yellow cab trips. Target: was the
ride tipped.
- **Amazon Beauty reviews:** a 5,000-row sample. Target: is the review positive.

## How the test is kept fair

- Models are chosen by 3-fold cross-validated MCC on the training data only.
Nothing is chosen on the test set.
- MCC is the main score. F1 is not used for choosing models because it rewards
a model that answers "yes" for everyone.
- Corruption is seeded and applied to the training data only. Each dataset uses
10 random splits.
- The damage conditions are (wrong labels, impossible values): 0% and 0%, 5% and
2%, 15% and 5%, 30% and 5%.

## The pipeline

Planner, EDA analyst, ML architect, quality reviewer, report writer. The
reviewer checks four things:

1. Impossible values, using hand-written limits for each dataset.
2. A leaked feature: one column that almost gives away the answer on its own.
It uses a single-column score check, a score-jump check and a cross-validated
test that removes the column.
3. Wrong labels, using a model trained on the rest of the data. Rows are removed
only if a leak-free cross-validation test shows that helps.
4. A model that just says yes (very lopsided recall and specificity).

If a retry changes nothing, the graph stops and says so.

## Main results

MCC on the clean test set, averaged over 10 splits.

| Dataset | Wrong labels (and impossible values) | AutoGluon | Single pass | LangGraph + reviewer |
| -------------- | ------------------------------------ | --------- | ----------- | -------------------- |
| Heart disease | 0% | 0.635 | 0.646 | 0.650 |
| Heart disease | 5% (and 2%) | 0.629 | 0.654 | 0.654 |
| Heart disease | 15% (and 5%) | 0.600 | 0.651 | 0.628 |
| Heart disease | 30% (and 5%) | 0.482 | 0.504 | 0.466 |
| Amazon reviews | 0% | 0.591 | 0.597 | 0.597 |
| Amazon reviews | 5% (and 2%) | 0.597 | 0.587 | 0.587 |
| Amazon reviews | 15% (and 5%) | 0.568 | 0.549 | 0.553 |
| Amazon reviews | 30% (and 5%) | 0.524 | 0.527 | 0.527 |
| NYC taxi tips | 0% | 0.206 | 0.221 | 0.124 |
| NYC taxi tips | 5% (and 2%) | 0.179 | 0.222 | 0.207 |
| NYC taxi tips | 15% (and 5%) | 0.206 | 0.222 | 0.208 |
| NYC taxi tips | 30% (and 5%) | 0.160 | 0.222 | 0.141 |

Our first AutoGluon run optimized balanced accuracy, not MCC. It scored lower on
taxi (0.159, 0.117, 0.112 and 0.087), so we reran it with MCC. The table uses
the rerun.

## Extra checks

- **Leaks:** a planted leaked column, and two real ones in the taxi data
(payment type and total amount). The reviewer caught the planted leak and
payment type in 10 of 10 runs and missed total amount. There were no false
alarms in 30 clean runs.
- **Reviewer settings:** six versions of the reviewer on heart disease. None was
more accurate than the single pass, and all caught the planted leak.
- **Language model routing:** a small local model (llama3.2) picked the retry
strategy 29 times. It made the same choice as the rules every time.
- **AutoGluon best quality:** a small check (180 second limit, a few splits). It
did not change the picture.

## What is in this folder

- `agentic_bench.py`: the benchmark code (pipeline, reviewer, experiment runner)
- `agents/`, `graph/`, `config.py`, `agentic_viz.py`: agent, graph and plotting
code
- `closing_the_gaps.ipynb`: the final study: 10 splits per dataset, natural
leaks, AutoGluon best quality, language model answers, reviewer settings, and
the AutoGluon rerun with MCC
- `full_study.ipynb`: the earlier full study
- `run_*.py`, `main.py`: earlier run scripts
- `outputs/`: results (see below)
- `Dockerfile` and the `docker_*.sh` scripts: build and run the container
- `requirements.txt`: Python packages

### Results files in `outputs/`

- `ag_mcc.csv`: AutoGluon rerun with MCC (used in the main table)
- `final_mcc_table.csv`, `final_spread.csv`: mean MCC and per-split differences.
The AutoGluon column in these two is the first run (balanced accuracy). The
MCC rerun is in `ag_mcc.csv`.
- `ag_best_quality.csv`, `full_ag_300s.csv`: AutoGluon best-quality and 300
second checks
- `natpay_NYC_Taxi_*.csv`, `nattot_NYC_Taxi_*.csv`: natural leaks (payment type
and total amount)
- `sensitivity_heart.csv`: the six reviewer settings
- `llm_strategy_raw_answers.csv`, `llm_strategy_rows.csv`: language model
routing
- `full_*.csv`, `more_*.csv`, `results*.csv`: the other runs

## Limits

- Each dataset used 10 random splits. Amazon and taxi were 5,000-row samples.
- The planted leak, the natural leaks and the best-quality check used the first
AutoGluon setting (balanced accuracy). That does not change the leak results,
since every system reported the same fake score on the leaks.
- The best-quality check used few splits and the time limit was not strictly
kept (most runs took about 180 seconds, a few took much longer).
- One small local language model was used.
- The planted leak is easy to spot, both natural leaks come from one dataset,
and the reviewer missed the weaker one.
Loading
Loading