SWHForest: A Structural Curation and Search Layer for Large-Scale Code Corpora

Federico Pennino, Andrea Gurioli, Maurizio Gabbrielli, Paolo Ferragina
11/8/2026
cs.SEcs.LG

No confident code implementation found for this paper.

Abstract

Pre-training code language models relies on massive code corpora usually streamed over the internet. However, researchers rarely need a multi-terabyte archive in its entirety; instead, their workflow centers on curated subsets: selecting well-documented files, filtering out repetitive boilerplate, auditing for benchmark contamination, or retrieving specific code patterns.

Show full abstract

Yet, because modern corpora are typically published as file pointers and basic attributes rather than source text, no general structural layer exists to select which files to download: curating a subset requires downloading and parsing millions of files first just to discard most of them. We present SWHForest, an open-source framework and public dataset that provides this missing structural layer for any pointer-based corpus without redistributing source code. A single pass over the archive parses each file into an AST and immediately discards the source text, keeping only its structural summary. Queried locally or exposed by archive providers as a server-side filtering API, SWHForest selects matching files first (via SQL or index intersection) and downloads only surviving candidates. Across the ten largest languages of Stack-Edu (52.1M unique files, 341M definitions), SWHForest answers curation queries in milliseconds while cutting downloads by 46-72%, reducing live structural searches from hours of per-language streaming to seconds or minutes.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{pennino2026swhforest,
  title  = {SWHForest: A Structural Curation and Search Layer for Large-Scale Code Corpora},
  author = {Federico Pennino and Andrea Gurioli and Maurizio Gabbrielli and Paolo Ferragina},
  year   = {2026},
  eprint = {2611.11439},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2611.11439v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2611.11439.svg)](https://codeofpaper.com/paper/2611.11439)

Discussion