Using Small Language Models to Reverse-Engineer Machine Learning Pipelines Structures

Nicolas Lacroix, Mireille Blay-Fornarino, Sébastien Mosser, Frederic PreciosoarXiv 2026 · DOI

Abstract

Background: Extracting the stages that structure Machine Learning (ML) pipelines from source code is key for gaining a deeper understanding of data science practices. However, the diversity caused by the constant evolution of the ML ecosystem (e.g., algorithms, libraries, datasets) makes this task challenging. Existing approaches either depend on non-scalable, manual labeling, or on ML classifiers that do not properly support the diversity of the domain. These limitations highlight the need for more flexible and reliable solutions. Objective: We evaluate whether Small Language Models (SLMs) can leverage their code understanding and classification abilities to address these limitations, and subsequently how they can advance our understanding of data science practices. Method: We conduct a confirmatory study based on two reference works selected for their relevance regarding current state-of-the-art's limitations. First, we compare several SLMs using Cochran's Q test. The best-performing model is then evaluated against the reference studies using two distinct McNemar's tests. We further analyze how variations in taxonomy definitions affect performance through an additional Cochran's Q test. Finally, a goodness-of-fit analysis is conducted using Pearson's chi-squared tests to compare our insights on data science practices with those from prior studies.

The Challenge of Pipeline Extraction

To improve ML quality and transparency, researchers must understand how pipelines are structured—identifying which blocks of code correspond to "Data Cleaning," "Feature Engineering," or "Model Evaluation." However, the ML ecosystem evolves rapidly, with new libraries and coding patterns emerging constantly.

Existing approaches generally fall into two categories, both with significant flaws:

  1. Static/Rule-based Mapping: These rely on hard-coded lists of library functions. If a data scientist uses a new or obscure library, the system fails to recognize the stage.
  2. Supervised Classifiers: Traditional ML models (like Random Forests) often struggle with the high diversity and imbalanced nature of pipeline stages, sometimes yielding poor results, such as F1 scores as low as 0.29.

This research proposes Small Language Models (SLMs) with fewer than 8 billion parameters as a "middle ground." They possess the deep semantic understanding of large language models but remain sustainable, reproducible, and runnable on modest hardware.

Methodology and Experimental Design

The authors designed a confirmatory study to rigorously test SLMs against established baselines. The experimental framework is defined by a set of independent, dependent, and confounding variables to ensure a controlled and statistically sound evaluation.

Summary of the experimental variables, including independent, dependent, and confounding factors used in the study.

Key Methodological Components:

  • Model Selection: Five SLMs (<8B parameters) were pre-selected based on their performance on the HumanEval benchmark, focusing on models specifically trained for code.
  • Taxonomy Unification: To ensure fair comparisons across studies with different naming conventions, the authors collaborated with expert data scientists to create a "Unified Taxonomy" ($T_{unified}$).
  • Statistical Rigor: Beyond simple accuracy, the study employs Cochran’s Q tests and McNemar’s tests to determine if SLM performance gains are statistically significant compared to previous methods.
  • Taxonomy Mutation: A novel aspect of the method involves "mutating" taxonomy wording (e.g., changing "Modeling" to "Model Building") to assess the sensitivity of SLMs to specific linguistic labels.

Datasets and Evaluation

The study utilizes two primary reference datasets from landmark studies:

  • DS-Pipelines: 105 Jupyter notebooks analyzed at the instruction level.
  • DASWOW: 470 notebooks (nearly 9,700 code cells) analyzed at the cell level.
  • D-rule: A supplementary dataset used to ensure sufficient statistical power.

Key Insights: Semantic Understanding and Sustainability

The core advantage of SLMs is their shift from syntactic to semantic analysis. Unlike rule-based systems that look for specific function names, SLMs understand the intent of the code. This allows them to identify a "Data Preprocessing" stage even when custom or internal libraries are used.

Furthermore, the study highlights the importance of "Green AI." By intentionally limiting the scope to models under 8B parameters, the authors advocate for sustainable research practices that do not require massive compute clusters for replication.

Expected Results and Limitations

While this paper outlines an execution plan, it establishes clear benchmarks for success. The goal is to demonstrate that the best-performing SLM ($SLM_{best}$) significantly outperforms Random Forest and rule-based baselines in terms of Matthews Correlation Coefficient (MCC) and F1-scores, particularly for infrequent pipeline stages.

However, certain limitations remain:

  • Data Contamination: There is a risk that evaluation notebooks were part of the SLMs' original training data. The authors mitigate this by using a unique, expert-defined taxonomy.
  • Knowledge Cutoff: SLMs are limited by their last training date and may struggle with revolutionary new libraries released after their training.
  • Prompt Sensitivity: Results are highly dependent on prompting techniques (e.g., Few-Shot vs. Chain-of-Thought), which remains a critical variable in LLM-based research.

Summary updated

BibTeX
@misc{lacroix2026using,
  author = {Nicolas Lacroix and Mireille Blay-Fornarino and Sébastien Mosser and Frederic Precioso},
  title = {{Using Small Language Models to Reverse-Engineer Machine Learning Pipelines Structures}},
  year = {2026},
  eprint = {2601.03988},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2601.03988},
}
Figure