Repro: An Open-Source Library for Improving the Reproducibility and Usability of Publicly Available Research Code

Daniel Deutsch, Dan RotharXiv 2022 · DOI

Abstract

Reproducing the results of published research is a cornerstone of the scientific method, yet in the field of Natural Language Processing (NLP), it remains a significant challenge. Even when source code is released, researchers often face "dependency hell," missing resource files, and idiosyncratic APIs. We introduce Repro, an open-source Python library that bridges this reproducibility gap by wrapping academic software in Docker containers. Repro provides a unified, lightweight API that allows researchers to execute code from over 30 major NLP papers instantly, ensuring environment consistency and long-term usability without manual configuration.

1. Introduction: The Reproducibility Gap

In modern AI research, simply sharing code on GitHub is often insufficient for true reproducibility. A "reproducibility gap" frequently emerges between the publication of a paper and the ability of a third party to run the associated software. This gap is primarily driven by three factors:

  • Environment Mismatch: Subtle differences in library versions (e.g., PyTorch 1.6 vs. 1.7) or specific OS-level dependencies can cause code to crash or produce divergent results.
  • Resource Decay: Pre-trained models, datasets, or configuration files are often hosted on personal or university servers that eventually go offline, rendering the code unusable.
  • Complex and Non-Standard APIs: Every research group employs its own coding style and data-loading conventions, requiring significant engineering effort to integrate a new tool into an existing pipeline.

Repro addresses these challenges by shifting the focus from sharing code to sharing the entire execution environment in a standardized, accessible format.

2. The Repro Framework

The core of the Repro library is built upon Docker, a containerization technology that allows for the creation of isolated, standalone environments. The framework consists of four primary components:

2.1 Docker Encapsulation

For every supported paper, the authors create a dedicated Docker image. This image contains the exact operating system, software libraries, and resource files required to run the code. By pinning these dependencies, the software becomes immune to "bit rot"—the phenomenon where software stops working because the underlying ecosystem (Python versions, drivers) has evolved.

2.2 Lightweight Python Wrappers

To lower the barrier to entry, Repro abstracts the complexity of Docker. Users do not need to learn Docker commands; instead, they interact with a standard Python API. When a user calls a method such as model.predict(), Repro handles the container orchestration behind the scenes.

2.3 Seamless Communication

Data transfer between the host machine and the isolated container is managed through a file-system mounting approach. Repro serializes input data to a temporary directory, mounts that directory into the Docker container, executes the research code, and then reads the output back into the main Python process. This ensures that the user's local environment remains clean while the research code runs in its native habitat.

2.4 Automated Distribution

Repro utilizes GitHub Actions to automatically build and push images to DockerHub. This centralized distribution ensures that as long as DockerHub is accessible, the environment for a paper published today will remain functional for years to come.

3. Standardizing Research Interfaces

Beyond environment isolation, Repro provides a concerted effort to standardize inputs and outputs for similar tasks. For example, all text generation metrics (such as ROUGE, METEOR, or BERTScore) follow a similar calling convention. This standardization makes it trivial for researchers to swap different models or evaluation metrics within their pipelines without rewriting integration code.

At present, Repro supports implementations from over 30 research papers, primarily focused on NLP tasks including:

  • Summarization & Evaluation: ROUGE, METEOR, BERTScore, and SacreROUGE.
  • Generative Models: BART and various question-generation models.
  • Parsing: Constituency parsers and QA-SRL parsers.

4. Results and Ease of Use

The primary result of the Repro project is the drastic reduction in engineering overhead required to use state-of-the-art models. The library demonstrates that running a complex model like BART can be reduced to just four lines of Python code, requiring zero manual installation of BART's specific dependencies. By providing a centralized repository for the NLP community, Repro serves as a vital infrastructure for benchmarking and comparative research.

5. Limitations and Future Work

A significant hurdle remains regarding Hardware Compatibility. While Docker images are highly portable, they are not a complete solution for hardware-level dependencies. A Docker image built for a specific version of NVIDIA's CUDA platform may not run on newer generations of GPUs. Consequently, while the software environment is preserved, hardware requirements can still drift.

Future development will focus on encouraging the research community to adopt "Reproducibility Best Practices," such as including example inputs/outputs in documentation and using stable, organization-owned storage (like Zenodo) for large model weights to ensure the longevity of the resources Repro relies upon.

6. Conclusion

Repro offers a practical solution to the reproducibility crisis by combining the isolation of containerization with the ease of a high-level Python library. By standardizing the way research code is distributed and executed, Repro enables the community to focus on scientific advancement rather than environment configuration.

Summary updated

BibTeX
@misc{deutsch2022repro,
  author = {Daniel Deutsch and Dan Roth},
  title = {{Repro: An Open-Source Library for Improving the Reproducibility and Usability of Publicly Available Research Code}},
  year = {2022},
  eprint = {2204.13848},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2204.13848},
}
Figure