MER: Minimal Extraction and Reconstruction for deep learning bug reproduction environments.
Project description
MER: Minimal Extraction and Reconstruction
MER is an agentic framework for verifying and reconstructing deep learning bug reproduction environments.
Installation
-
Clone the repository:
git clone <repository_url> cd DL-Faults-Sandbox
-
Install dependencies: It is recommended to use a virtual environment.
python3 -m venv venv source venv/bin/activate pip install -r requirements.txt
Or install the package directly with
pip:pip install .
-
Docker Setup: Ensure Docker is installed and running on your machine, as MER agents utilize Docker containers for environment isolation.
Usage
Running the Orchestrator
The main entry point for the MER system is mer/orchestrator/main.py.
# After `pip install .`
mer
# Run all bug samples under dataset/
python3 -m mer.orchestrator.main
# Run a subset by bug_id
python3 -m mer.orchestrator.main --sample huggingface_diffusers_12975 --sample pyg-team_pytorch_geometric_10548
# Limit number of samples
python3 -m mer.orchestrator.main --limit 2
# Use a custom dataset root
python3 -m mer.orchestrator.main --dataset-root /path/to/dataset
# Enable LangSmith tracing
python3 -m mer.orchestrator.main --langsmith --langsmith-project MER
# Run no-planner ablation
python3 -m mer.orchestrator.main --ablation-profile no_planner_agent
# Run no-data ablation
python3 -m mer.orchestrator.main --ablation-profile no_data_agent
# Run no-determinism ablation
python3 -m mer.orchestrator.main --ablation-profile no_determinism_agent
# Run no-environment ablation
python3 -m mer.orchestrator.main --ablation-profile no_environment_agent
# Combine full-agent and sub-component ablations
python3 -m mer.orchestrator.main \
--disable-agent planner \
--disable-component data.llm_terminal_judge \
--disable-component determinism.profile_llm
For external developers, install the package and use the portable study runner:
pip install dl-faults-sandbox
mer-study-runner \
--bug-id 035 \
--codebase /path/to/cloned/repo \
--bug-report /path/to/bug_report.txt \
--repro /path/to/reproduce.py \
--openai-api-key "$OPENAI_API_KEY"
The runner creates the dataset layout MER expects:
.mer-study/
dataset/
<bug-id>/
bug_report.txt
reproduce.py
codebase/
By default the codebase is symlinked into the staged dataset. Use --mode copy
if you want an isolated copy instead. Use --prepare-only if you only want the
staged dataset without invoking MER yet.
For local repository-based testing, the repo also includes:
scripts/setup_and_run_bug.sh --openai-api-key "$OPENAI_API_KEY"
Each bug run now writes exactly one run log file:
logs/activities/<run_id>/run.log
Additional traceability artifacts are non-log files:
workflow_logs_manifest(all activity logs)workflow_trajectory_json(phase-by-phase trajectory with durations and terminal-check outcomes)workflow_errors_json(structured failures and stack traces)workflow_langsmith_trace_config_json(trace metadata used for this run)
Batch mode also writes logs/dataset_batch_summary_<timestamp>.json including pointers to these artifacts per bug.
Ablations
Ablation config is fully CLI/JSON-driven:
--ablation-profile <name>: apply a predefined profile (repeatable)--disable-agent <planner|environment|data|determinism>: disable a whole agent--disable-component <agent.component>: disable sub-components--ablation-config <path.json>: load JSON config with keysprofiles,disable_agents,disable_components,notes--ablation-json '<json>': inline JSON config
Metadata is persisted for every run and batch:
workflow_ablation_config_jsonartifact in each runablation_labelandablation_config_pathin per-bug batch result entries- batch summary includes top-level
ablationpayload
When environment is disabled, MER bootstraps a barebones CPU sandbox (dl-sandbox:cpu-py310-torch) if needed and passes it through run context so data/determinism still run end-to-end.
Dataset Link Downloading
The data agent now scans both bug_report.* and reproduce_issue.py for dataset links, then downloads into the bug folder when remote artifacts are required.
Provider-aware handling:
Kagglelinks (kaggle.com/datasets/...,kaggle.com/competitions/...) via Kaggle API.GitHublinks (github.com/...,raw.githubusercontent.com/...) via GitHub endpoints.- Other links via direct HTTP download.
requested_formatis inferred from URL/query/context; if a ZIP is downloaded and a non-zip format is requested, MER extracts and returns a matching file when possible.
Configuration (environment variables):
KAGGLE_USERNAMEandKAGGLE_KEYfor Kaggle API downloads.GITHUB_TOKEN(optional but recommended) for GitHub API/authenticated downloads.
Built-in profiles:
no_planner_agentno_environment_agentno_data_agentno_determinism_agentplanner_no_llm_heuristicsplanner_no_llm_policy_overrideplanner_no_llmenvironment_no_dependency_planner_llmenvironment_no_resource_mockingenvironment_no_gpu_detectiondata_no_bug_static_scandata_no_remote_downloaddata_no_bug_dir_reconstructiondata_no_fidelity_iterationdata_no_repo_context_scandata_no_data_role_assessmentdata_no_llmdeterminism_no_profile_llmdeterminism_no_refinement
Legacy/utility profile:
none
LangSmith
Set LANGSMITH_API_KEY in your environment (or .env) and run with --langsmith.
Optional env/flags:
LANGSMITH_PROJECT/--langsmith-projectLANGSMITH_ENDPOINT/--langsmith-endpoint
Development
- Agents: Located in
mer/agents/. Each agent (local,data,determinism,driver) has its own package. - Tools: Located in
mer/tools/. Generic tools are shared; specific tools are injected by the orchestrator.
Structure
mer/orchestrator/: Core logic and agent management.mer/agents/: Autonomous agents for each phase of the pipeline.mer/tools/: Tool definitions (Docker control, Static Analysis, etc.).mer/libs/: Native libraries (e.g.,libdeterminism.sosource).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dl_faults_sandbox-0.1.0.tar.gz.
File metadata
- Download URL: dl_faults_sandbox-0.1.0.tar.gz
- Upload date:
- Size: 95.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dce7d761c4a27a62bb053f8327c318abe830d5d6ddec37b241963d155a5b6436
|
|
| MD5 |
1e3e7c51bcd7d74749737ce8d8db224c
|
|
| BLAKE2b-256 |
7c51558552a54a6741b31356a66efed4291791e7abca0bf0c227382df022a7fd
|
File details
Details for the file dl_faults_sandbox-0.1.0-py3-none-any.whl.
File metadata
- Download URL: dl_faults_sandbox-0.1.0-py3-none-any.whl
- Upload date:
- Size: 112.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21358cbdc7ca229d45c30d9c31eca5b6862a3767ff003e2da8db2a158c43f616
|
|
| MD5 |
781a4a409d74849e75a079f06feea958
|
|
| BLAKE2b-256 |
faabe928bfb6d98aaec281fa6bd644d3e1b1a118212400056e8cfc7a1aba9ef5
|