potentialpaper

Refactoring Code Through Library Design

Žiga Kovačič, Justin T Chiu, Celine Lee, Wenting Zhao, Kevin Ellis

NeurIPS 2026

Edit this page

Or clone it with git

Run in a terminal:

Needs Git LFS. To push, use an API key from your profile as the password.

Or let your agent set it up

It checks and sets up everything: signing in, git, the clone, credentials and an SSH key.

TL;DR. We introduce a method for refactoring programs into libraries. Using a user study and analysis, we find Minimum Description Length (MDL) captures good refactorings. Our method outperforms prior work and refactors real-world repos.

Abstract. Maintainable and general software allows developers to build robust applications efficiently, yet achieving these qualities often requires refactoring specialized solutions into reusable components. This challenge becomes particularly relevant as code agents are increasingly used to solve isolated one-off programming problems. We investigate code agents' capacity to refactor code in ways that support consolidation and reusability. We first investigate what makes a good refactoring, finding via simulation results and a human study that proxies of program size, such as Minimum Description Length, better predict preferable refactorings than extant software engineering metrics, such as Maintainability Index. We then present \textsc{Librarian}, a method that combines divide-and-conquer with sample-and-rerank to generate reusable libraries. We compare \textsc{Librarian} to state-of-the-art library generation methods, and study it on real-world Python programs.

Are you an author? Claim this paper to see who's reading it, with views and other statistics, and to write about it here.

Claim this paper
How does this paper connect to your work? Write how you built on it, compared with it or reproduced it, or add a summary, a critique or errata.
Or make it interactive:
Start writing

edit · history

DateVersionSubmitted toPDFEvidence
3 May 2026NeurIPS 2026submittedNeurIPS 2026Accept (poster)reviews ↓[1]PDF[1]
Missing a version?

NeurIPS 2026

Accept (poster) · 4 reviews · OpenReview

Updated 25 Nov 2026, 03:47 UTC.

Program Chairs · DecisionOpenReview ↗
Decision
Accept (poster)
Read decision
Meta-review

The reviewers agree that the paper addresses an important and timely problem: enabling code agents to refactor collections of programs into reusable libraries rather than producing isolated one-off solutions. Several reviewers viewed the comparison of different refactoring objectives as the paper's most novel conceptual contribution, and appreciated the attempt to extend library learning beyond toy DSLs to real Python repositories.

However, the reviewers have raised a number of issues that are critical to the paper's central claims: 1. MDL may not be shown to outperform token count. 2. The gains are not properly attributed. 3. Potential reference-model contamination. Some other minor issues include the statistical and reporting issues as well as the “real-world” evidence being too limited and partly circular.


After the rebuttal, the central finding is adjusted from MDL specifically to the broader observation that compression-style objectives may outperform traditional software-engineering metrics, while LIBRARIAN remains a relatively straightforward combination of clustering and sample-and-rerank.

Final justification

The paper lies right on the borderline of acceptance. I'm leaning towards acceptance, given the support of the reviewers who engaged in the rebutall discussion.

Area Chair Hkq4 · Meta-reviewOpenReview ↗
Read meta-review
Meta-review

The reviewers agree that the paper addresses an important and timely problem: enabling code agents to refactor collections of programs into reusable libraries rather than producing isolated one-off solutions. Several reviewers viewed the comparison of different refactoring objectives as the paper's most novel conceptual contribution, and appreciated the attempt to extend library learning beyond toy DSLs to real Python repositories.

However, the reviewers have raised a number of issues that are critical to the paper's central claims: 1. MDL may not be shown to outperform token count. 2. The gains are not properly attributed. 3. Potential reference-model contamination. Some other minor issues include the statistical and reporting issues as well as the “real-world” evidence being too limited and partly circular.


After the rebuttal, the central finding is adjusted from MDL specifically to the broader observation that compression-style objectives may outperform traditional software-engineering metrics, while LIBRARIAN remains a relatively straightforward combination of clustering and sample-and-rerank.

Final justification

The paper lies right on the borderline of acceptance. I'm leaning towards acceptance, given the support of the reviewers who engaged in the rebutall discussion.

1 comment
Authors · CommentOpenReview ↗

Thanks for summarizing the main points. Please see our individual responses to each reviewer, but to address the headline concerns:

MDL may not be shown to outperform token count

We agree! Our point is not to champion MDL, but to study a range of metrics and present a nuanced picture, which is absent from the prior literature, and which multiple reviewers see as (the) main contribution. We show MDL>=Tokens, not MDL>Tokens (and Tokens>MI/CC). The paper states this explicitly (L252), and the abstract advertises the success of “proxies of program size, such as MDL” (we’ll revise to “such as MDL and token count”). Nonetheless we find nuanced token<>MDL differences, such as the analyses starting on line 207.

The gains are not properly attributed

We’ve revised to include a compute-matched comparison against coding agent (specifically Claude Code), showing that the gains do not derive just from increased test test time compute, but also derive from the objective function and clustering that governs how that compute is used. By comparing to REGAL, our submission showed that most of the gain derives from reranking under the right objectives, not from clustering (Table 3).

Potential reference-model contamination… partly circular

We think this objection is probably a confusion. We’re not arguing that objective X is good because it maximizes X, which would be circular, and would invite contamination concerns whenever X is learned to maximize what we test on. Instead we study objective X (for various X), and measure different downstream metrics (such as library reuse on holdout files).

Reviewer Z4hsOpenReview ↗
Rating
2/6
Confidence
4/5
Quality
2/4
Clarity
2/4
Significance
3/4
Originality
1/4
Contribution type
general
Ethical concerns
NO or VERY MINOR ethics concerns only
Read review
Summary

The paper studies library-design refactoring: given a set of N related files (a "task"), produce a shared library L of common abstractions and rewrite the files to use it, while preserving correctness (the original unit/integration tests still pass). It makes two moves.

(1) What objective captures a "good" refactoring? It compares compression-style objectives — token count and Minimum Description Length (MDL), the latter defined as the negative log-probability of the library and refactored programs under a reference language model (Qwen-2.5-3B) — against classical software-engineering metrics (Cyclomatic Complexity, Maintainability Index). Via a simulation (running the proposed method under each objective and measuring proxies of library reuse) and a human study (14 participants, 129 pairwise judgments, Bradley–Terry analysis), it argues that compression-based metrics, and MDL in particular, align better with reusable libraries and with human preference than CC/MI.

(2) LIBRARIAN. A method combining clustering (divide-and-conquer over the task's files) with sample-and-rerank (sample K candidate refactorings from a backend LLM/agent, keep the test-passing one that minimizes the MDL loss). LIBRARIAN is compared to REGAL on the Logo and Date program-synthesis benchmarks (improving downstream pass rate, notably ~+20 points on Logo) and applied to a small curated set of real-world HuggingFace Transformers/Diffusers model files (8 tasks total), where it lowers MDL roughly in line with human refactoring and yields more reused library functions than a single-pass coding-agent prompt. A U-statistic argument for the Best@k estimator is given in an appendix. The tasks (CodeContests, Transformers, Diffusers, Logo, Date) are assembled into a benchmark ("MiniCode," named only in the appendices).

Strengths and weaknesses

Strengths

  • Timely, well-motivated problem. Framing "refactoring into reusable libraries" as the unit of study — and connecting it to the rise of code agents that solve one-off problems myopically — is genuinely interesting and forward-looking. The work sits at a useful intersection of program synthesis / library learning and practical software engineering.
  • The objective-comparison study is the most original part. Asking which objective captures a good refactoring, and pitting compression-style objectives (tokens, MDL) against classical SE metrics (MI, CC), is a clean, novel question. The (admittedly small) finding that classical SE metrics like Maintainability Index align worse with human preference than a compression proxy is interesting and somewhat counter-intuitive.
  • Scaling library learning beyond DSLs. Prior library learning (DreamCoder, Stitch/Babble, LILO, Trove, REGAL) is largely confined to λ-calculus / DSLs and small programs. Demonstrating the pipeline on real Python from HuggingFace Transformers/Diffusers is a real step, appropriate for a Concept-and-Feasibility contribution.
  • Sensible architecture. Clustering (divide-and-conquer) + sample-and-rerank is a reasonable way to fit large tasks into limited LLM context, and the clustering-coherence analysis (Appendix I) is a nice supporting touch.
  • Honesty and some rigor. The cost (~30 min/refactoring) is disclosed, an IRB-approved human study is run, and the Best@k estimator is given a correct U-statistic unbiasedness argument (Appendix G).

Weaknesses

W1 — The headline claim ("MDL captures good refactorings") is not established over the trivial tokens baseline. The novelty hinges on MDL specifically, but: (a) the human study cannot distinguish MDL from tokens (MDL-vs-Tokens preference = 0.56, error bars overlap 0.5 → not significant; only MDL-vs-MI = 0.67 is significant); (b) the in-distribution simulation shows "little difference between MDL and tokens" (the authors' own words); and (c) the entire case for MDL > tokens rests on held-out-source generalization with effect sizes the paper itself calls "small." Since tokens is dramatically simpler and needs no reference LM, the paper needs a powered, direct MDL-vs-tokens comparison to justify its central thesis. As presented, a skeptical reader would adopt tokens. The "Perl golf" corner case and the Bayesian/MAP argument are qualitative.

W2 — Likely reference-LM contamination undermines the real-world MDL claims (not discussed). MDL is −log p_LM(L) − Σ log p_LM(ρ'_n | L) under Qwen-2.5-3B, which was almost certainly trained on the public HuggingFace Transformers/Diffusers source. So "MDL-minimizing" HF refactorings may be regressing toward the LM's memorized canonical HF code. This plausibly explains why LIBRARIAN "matches human coders" on MDL — it may be matching code the LM already memorized. The cross-LM 84.2% agreement does not address contamination, since Llama/DeepSeek/Mistral were likely all trained on HF too. This confound directly threatens the interpretability of the flagship real-world result and is not acknowledged anywhere.

W3 — Real-world evaluation is small, curated, and intrinsic-only. The real-world headline rests on 8 tasks total (Transformers: 15 files / 3 tasks; Diffusers: 17 files / 5 tasks), with Transformer files "manually chose[n]" (Appendix C) → selection bias. Evaluation is intrinsic: MDL reduction and library-reuse counts. But reuse is essentially the optimization target, so "MDL-optimized libraries have higher reuse" is partly circular — the objective rewards compression/reuse and the proxy measures reuse. There is no independent criterion (human judgment, downstream maintainability, functional benefit) showing the HF libraries are actually better rather than merely smaller and test-passing. This contradicts the paper's own Section 6 thesis that size alone is insufficient.

W4 — No ablation attributes the gains. LIBRARIAN bundles clustering, tuple grouping, sample-and-rerank, the MDL rerank, and an incremental variant (Appendix A). For the REGAL comparison (Table 3) the authors "keep their setup the same and only augment training using sample + MDL rerank," so the ~+20-point Logo gain could come from MDL, from sample-and-rerank, from clustering, or simply from added test-time compute (K samples). No ablation isolates these (e.g., sample-and-rerank with token-rerank vs MDL-rerank; with/without clustering). Without attribution, the conceptual claim that MDL is what matters is not supported by the strongest empirical win in the paper.

W5 — Statistics are confusingly reported and partly questionable. Appendix F writes "MDL significantly outperforming MI (p = 0.67, 95% CI [0.56, 0.78])." 0.67 is a Bradley–Terry preference probability, not a p-value; writing "p = 0.67 ... significantly" invites the opposite reading. The "75% consensus-based filtering" discards minority responses on high-consensus comparisons — i.e., it filters data using the very preference being estimated, which can bias the estimate and inflate apparent significance (the unfiltered MDL-vs-MI result being significant is reassuring, but the procedure should be justified, not assumed correct). With 129 judgments from 14 participants (~9 each), within-participant clustering is not modeled (no random effects), so the CIs are likely optimistic.

W6 — "Correct" = existing tests pass, and several claims over-reach. Passing a test suite is not semantic equivalence; a refactoring can change behavior on untested configs / dtypes / devices / numerical edge cases — a real risk in production ML code, acknowledged only in passing. The claim "the first time library learning has been successfully applied to real-world software projects" (Contribution 4) is strong relative to N=8 hand-selected tasks, and sits in tension with the checklist's cautious "we have carefully avoided any claims that we do repository-level refactoring."

W7 — Polish / internal-consistency issues that should not exist in a submission.

  • Checklist Q3 (Theory assumptions and proofs): Answer N/A with Justification [TODO] — yet the paper has a proposition + proof (Appendix G), so the answer is both incomplete and arguably wrong. Checklist Q11 (Safeguards): Justification [TODO].
  • Appendix C: "with larger K we discover better libraries ??" — broken \ref.
  • Footnotes 3 and 5 claim "o4-mini outperformed coding agents such as Codex and ClaudeCode (Appendix K)," but Appendix K (Table 5) contains only {original, sonnet 3.7, sonnet 4, codex-mini} — there is no o4-mini, Claude Code, or Codex row, so the table does not substantiate the claim.
  • The benchmark is named "MiniCode" only in the appendices/Table 4, never introduced in the main text, weakening the "benchmark" contribution.
  • Figures 2/3/5/7 are dense, multi-panel, and near-illegible (cryptic "+24.0%", "TOKEN→MI", "Above 0: …" annotations with under-explaining captions). Figure 3 carries the central MDL-vs-tokens-generalization argument and is the hardest to read.
Questions
  1. Reference-LM contamination (most important). Were Qwen-2.5-3B / Llama-3.2-3B / DeepSeek-Coder / Mistral plausibly trained on the public HuggingFace Transformers and Diffusers source? If so, how do you rule out that "MDL-minimizing" HF refactorings are regressing toward the LM's memorized canonical HF code — the most likely explanation for LIBRARIAN "matching human coders" on MDL? A convincing control (e.g., MDL scored by a reference LM demonstrably not trained on these repos, or evaluation on post-training-cutoff / private code) would substantially raise my score.
  2. MDL vs tokens. Your own human study (0.56, n.s.) and in-distribution simulation cannot separate MDL from the much simpler tokens objective; the case rests on small-effect held-out generalization. Can you provide a powered, direct MDL-vs-tokens comparison with effect sizes and CIs, ideally on held-out HF sources? If MDL cannot be shown to beat tokens, why not adopt tokens (no reference LM, no contamination concern)? Cleanly establishing MDL > tokens would raise my score.
  3. Attribution / ablation for the REGAL gains. Is the Logo (+~20 pt) / Date improvement due to MDL, sample-and-rerank, clustering, or simply added test-time compute (K samples)? Please ablate — e.g., REGAL + sample-and-rerank with token-rerank vs MDL-rerank, and with vs without clustering. Isolating the source is necessary to credit the conceptual MDL claim (and to fix the related broken "??" reference in Appendix C).
  4. Statistics. Please (a) clarify the "p = 0.67" notation (this reads as a Bradley–Terry preference probability, not a p-value); (b) justify the 75% consensus filtering — which discards data based on the measured preference — and report the unfiltered estimates and CIs for all three comparisons; and (c) account for within-participant clustering (14 participants, 129 judgments) via random effects.
  5. Real-world scope, correctness, and consistency. (a) Given "correct" = existing tests pass, how do you address that test suites under-specify semantics (untested configs/dtypes/devices/numerics)? (b) Given N=8 hand-selected tasks, can you temper or better support the "first time library learning successfully applied to real-world software" claim (e.g., more tasks, or random rather than manual file selection)? (c) Please reconcile footnotes 3/5 with Appendix K: Table 5 contains no o4-mini, Claude Code, or Codex row, so it does not support "o4-mini outperformed Codex and ClaudeCode." (d) Please resolve the [TODO] checklist entries (Q3, Q11) and the N/A answer to the theory-proofs item given Appendix G.
Limitations

Partially. The paper has an explicit Limitations section (per-refactoring cost ~30 min; reliance on existing tests; clustering cannot split files; compression may not predict reusability on unseen programs) — credit for being upfront, and the authors should not be penalized for honesty. However, the most consequential limitations are missing and should be added (this pre-empts reviewer concern rather than inviting it): (a) reference-LM contamination of the MDL distribution on public HF code (W2); (b) the small, hand-selected real-world sample and resulting selection bias (W3); (c) sensitivity to the reference LM (the reported 84.2% cross-LM agreement implies ~16% of best-refactoring choices flip with the scorer); (d) tests-pass ≠ semantic equivalence (W6); and (e) the weak/insignificant MDL-vs-tokens separation (W1). The negative-societal-impact discussion (checklist Q10 = No) is acceptable for this work.

Formatting concerns
  • NeurIPS Paper Checklist contains unfilled template placeholders: Q3 (Theory assumptions/proofs) Justification = [TODO] with Answer N/A despite a proof in Appendix G; Q11 (Safeguards) Justification = [TODO].
    • Broken cross-reference "??" in Appendix C (larger-K ablation sentence).
    • Footnotes 3 and 5 cite Appendix K for an o4-mini-vs-coding-agents comparison that Appendix K (Table 5) does not contain (it lists original / sonnet 3.7 / sonnet 4 / codex-mini only).
    • Benchmark "MiniCode" is named only in the appendices, not in the main text where it is contributed.
    • Anonymity: the appendix discloses IRB review/approval and an author-performed refactoring baseline; code is stated as released "but not yet anonymized" (checklist Q5 = No). At submission, anonymized assets/links are expected.
    • Main text appears within page limits; several empirical figures (2/3/5/7) are too dense/small to read at print size.
Reviewer p5DuOpenReview ↗
Rating
5/6
Confidence
4/5
Quality
3/4
Clarity
3/4
Significance
3/4
Originality
3/4
Contribution type
concept_feasibility
Ethical concerns
NO or VERY MINOR ethics concerns only
Read review
Summary

The paper proposes LIBRARIAN, a method that cobines divide and conquer with sample and rerank method to generate reusable library. This paper studies in great detail, the coding agents capacity to refactor code that is reusable and consolidated. The authors also investigate various metrics to quantify what a good refactoring means. The empirical experiments provided in the paper goes beyond past work that is limited to small scale files instead the authors have scaled to more real world use case like huggingface transformers and diffusers library, In algorithm LIBRARIAN, extends REGAL in terms of clustring, which essentially summarize the files using LLM and then cluster the summary to get more semantically aligned clustering. The methods takes in the files ρi;∀i∈[N]\rho_i; \forall i \in [N], LIBRARIAN returns the library L\mathcal{L} and refactored files ρi′;∀i∈[N]\rho'_i; \forall i \in [N]. Overall the paper is easy to read, empirical evaluations are satisfactory and are extended to real world and relatively large scale source code.

Strengths and weaknesses

strengths

  • The paper is well written and motivates a real world usecase of code refactoring
  • The authors have extended their experiments to real world and large scale repositories like huggingface transformer and diffusers library. The refactoring quality is properly quantified and demonstrated in the main paper.
  • The empirical gains are considerable compared to the closest competition REGEL

weaknesses

  • Although the paper extends its experiments to large scale and real world code, it still uses 15, 17 files for transformers and diffusers respectively, I am wondering how would LIBRARIAN performs if it is extended to more files from the respective repos
  • In the related works section, the works could be elaborated in more detail to provide more insights
Questions

The clustering techniques seems to be an important factor in LIBRARIAN, can authors provide more insights on what other clustering techniques can be used apart from clustering based on summary by an LLM, is the LLM finetuned for providing code summaries especially for transformers and diffusers ?

Limitations

yes

Formatting concerns

None

1 comment
Authors · CommentOpenReview ↗

Thank you for your input and support. Below we respond to your question.

The clustering techniques seems to be an important factor in LIBRARIAN, can authors provide more insights on what other clustering techniques can be used apart from clustering based on summary by an LLM, is the LLM finetuned for providing code summaries especially for transformers and diffusers ?

We initially tried REGAL-style clustering, which clusters based on the problem solved by each source file, but found it to be more effective to cluster based on a summary of the code itself (L153). We do not fine tune the LLM to produce summaries. Appendix I provides further analysis of the clustering algorithm.

Reviewer LH6kOpenReview ↗
Rating
3/6
Confidence
3/5
Quality
2/4
Clarity
3/4
Significance
3/4
Originality
3/4
Contribution type
general
Ethical concerns
NO or VERY MINOR ethics concerns only
Read review
Summary

The paper studies automated refactoring of related source files into a reusable library. The proposed method, LIBRARIAN, clusters related files, samples multiple candidate refactorings with coding agents, filters them by tests, and reranks them using a refactoring objective. The main empirical point is that MDL under a reference language model is a better objective for library refactoring than token count, Maintainability Index, or Cyclomatic Complexity.

I think the paper asks a good question. The objective function for refactoring is not obvious, and the comparison between MDL, token count, and classical software engineering metrics is useful. That said, I am not fully convinced that the evidence supports the stronger claims about real-world library learning or about MDL being clearly better than simpler compression objectives.

Strengths and weaknesses

Strengths:

The problem is timely. Coding agents are often good at producing one-off solutions, but consolidating those solutions into reusable abstractions is a real issue. I like that the paper focuses on refactoring quality rather than only functional correctness.

The comparison of objectives is the most interesting part of the submission. It is not obvious whether MDL, token count, MI, or CC should be preferred for this setting. The paper gives a plausible argument that language-model MDL can capture naturalness in a way that raw token count cannot. The obfuscation example is a clean illustration of this point.

The paper also tries to move library learning beyond toy DSLs and program synthesis benchmarks. Applying these ideas to Python code from Transformers and Diffusers is a useful step, even if I think the evaluation is still too small to justify the broadest claims.

The use of sample-and-rerank is simple but sensible. The authors also make a reasonable effort to report best@k behavior and to separate different objectives.

Weaknesses:

My main concern is that the real-world evaluation is quite small. The paper repeatedly frames the result as a move to real-world software, but the HuggingFace experiments cover only a small number of files and clusters. This is a useful demonstration, but it does not establish repository-scale refactoring or show that the abstractions would be accepted by maintainers.

The human study is underpowered. It uses 129 judgments from 14 participants, and the clearest statistically supported result appears to be MDL over Maintainability Index. The MDL versus token count comparison, which is central to the paper’s story, is much less convincing. The paper should state this more carefully.

The algorithmic novelty is modest. The core pipeline is clustering plus sample-and-rerank with a chosen objective. This is a reasonable engineering design, but much of the gain may come from test-time compute, coding-agent quality, and correctness filtering rather than from the proposed objective itself.

The comparison to REGAL is not fully controlled. LIBRARIAN uses multiple samples and reranking, while the prior method appears to be evaluated under a different sampling budget. A matched-budget REGAL-style baseline, or a direct coding-agent baseline with the same number of samples and the same filtering, would make the result much more convincing.

There is also a possible circularity in the MDL objective. Candidate refactorings are produced by LLM-based agents and then ranked by likelihood under another LLM. This may reward code that is familiar to the reference model rather than code that is actually easier to maintain or reuse. The cross-model agreement analysis helps, but it still leaves a nontrivial fraction of cases where rankings change.

Finally, the paper needs more cleanup. There are inconsistencies in the reported model and agent setup, several typos and formatting artifacts, and unfinished checklist items. These issues make the experimental setup harder to trust.

Questions
  1. Can the authors evaluate REGAL or a REGAL-style method with the same sample budget and backend model as LIBRARIAN?
  2. How much of the improvement comes from the MDL objective rather than from simply sampling more candidates and filtering by tests?
  3. Can the authors report a direct baseline where Claude Code or another coding agent gets the same number of attempts, with the same test filtering, but without the LIBRARIAN clustering and MDL reranking?
  4. How sensitive are the final rankings to the reference model, tokenizer, and context formatting used for MDL?
  5. Can the authors provide the unfiltered human-study results, inter-annotator agreement, and the exact statistical test used for each pairwise comparison?
  6. For the HuggingFace examples, were the generated abstractions reviewed by experienced maintainers, or tested on future edit/reuse tasks? Passing tests is useful, but it does not by itself show maintainability.
  7. Does the best@k estimator include invalid candidates, or is it only computed after conditioning on valid candidates?
Limitations

The authors mention some limitations, but I think the main limitations should be stated more directly.

First, the real-world evaluation is small. It is better described as a proof of concept on selected real files than as evidence of repository-scale refactoring.

Second, correctness is measured by existing tests. This is reasonable, but it does not guarantee behavioral equivalence, API compatibility, readability, or maintainability. Refactoring quality is especially hard to judge from tests alone.

Third, the MDL objective may be biased toward code that is likely under the reference model. This is not necessarily the same as code that human maintainers would prefer.

Fourth, the human evaluation is too small to fully support the MDL versus token-count story. It mainly supports the weaker claim that MDL is better than MI in this setup.

Fifth, the paper does not fully isolate algorithmic contribution from inference-time compute. A matched-budget baseline is needed.

Formatting concerns

The paper has several presentation and reproducibility issues that should be fixed. There are typos and formatting artifacts in the figures and text. The checklist contains unfinished TODO entries. The LLM usage checklist answer is also odd, since LLMs are central to the method. The experimental setup should consistently state which models and agents were used in each experiment.

1 comment
Authors · CommentOpenReview ↗

Thanks for your input. Below is a point by point response, but we feel what is most important is (1) new compute-matched baseline, and (2) revising to better signpost the lack of repo-level refactoring.

coding-agent baseline with the same number of samples and the same filtering, would make the result much more convincing

We've improved our Claude Code baseline (L228) by adding sampling and test-based filtering. This compute-matched baseline improves library function count (7 -> 8.8) and total library use (41 calls -> 56.5), but still falls short of LIBRARIAN (15 functions reused across 100.05 calls). See lines 228-243, which will be revised with these new results.

The comparison to REGAL is not fully controlled. LIBRARIAN uses multiple samples and reranking, while the prior method appears to be evaluated under a different sampling budget

We don’t see how to control for compute against REGAL, which lacks an objective function, leaving it unclear how to deploy extra compute. If the reviewer can suggest a compute-matched REGAL, we’re happy to run it. As explained above, we’re now doing a compute-controlled Claude Code comparison: probably more ecologically relevant than a REGAL comparison anyway.

How much of the improvement comes from the MDL objective rather than from simply sampling more candidates and filtering by tests?

Improvements in pass rate: We do not claim that LIBRARIAN (or library learning generally) serves to improve pass rate. We think pass rates improve from testcase-filtering: “Pass rate modestly improves as an incidental consequence of sampling and filtering with test cases“ (L291).

Improvements in reuse: The new coding agent baseline shows that simply sampling+filtering does not suffice to maximize library reusability, and the REGAL comparison shows that clustering plays a secondary role to sampling+reranking (Table 3).

Can the authors report a direct baseline where Claude Code or another coding agent gets the same number of attempts, with the same test filtering, but without the LIBRARIAN clustering and MDL reranking?

Yes, see earlier response

Can the authors provide the unfiltered human-study results, inter-annotator agreement, and the exact statistical test used for each pairwise comparison?

Inter-annotator agreement (we report Krippendorff's \alpha, since each participant judged only a subset of comparisons): 0.16 for MDL vs MI, 0.17 for Tokens vs MI, and −0.02 for MDL vs Tokens. Agreement is slight throughout, as is typical for subjective pairwise comparisons; Bradley-Terry recovers a population-level preference from individually noisy judgments, and the reported intervals reflect that noise. This is consistent with our claims: preference is slightly positive for the two comparisons involving MI, and at chance for MDL vs Tokens, consistent with the human study not separating these two objectives (L252). Our preference for MDL rests instead on the reuse proxies, which favour MDL on holdout HuggingFace sources (Fig. 3) and on CodeContests (Fig. 5). Without consensus filtering, MDL is preferred over MI at 0.63, which remains significant.

For the HuggingFace examples, were the generated abstractions reviewed by experienced maintainers, or tested on future edit/reuse tasks? Passing tests is useful, but it does not by itself show maintainability.

Yes! We tested on future reuse tasks (L207). Still haven’t tried to PR our refactorings into HuggingFace, but it’s on the docket. They were reviewed by one of the authors who is quite familiar with this kind of code, and found to be very reasonable.

Does the best@k estimator include invalid candidates, or is it only computed after conditioning on valid candidates?

best@k is computed after filtering by testcases.

selected real files than as evidence of repository-scale refactoring

We certainly don’t mean to claim repo-level refactoring, and we believe the manuscript makes no such claim. It does cite related work in repo-level coding, though, which may be the source of this confusion. We’ve revised L64 to now say: “Our work considers multi-file refactoring, \emph{not} repo-wide refactors, but recent work has considered repo-level software engineering tasks.” The limitations section now begins with “We do not refactor whole repositories, leaving that to future work.”

possible circularity in the MDL objective… may reward code that is familiar to the reference model rather than code that is actually easier to maintain or reuse. The cross-model agreement analysis helps, but it still leaves a nontrivial fraction of cases where rankings change.

We do not argue that MDL (or tokens, or MI) is good because it improves MDL (or tokens, or MI). We study downstream measures of reuse, and human preferences (Fig 2, Fig 3, Fig 5, Fig 6). Circular reasoning would be “objective X is good because optimizing it improves X”. We argue “objective X is good because optimizing it improves downstream metrics A, B, and C.”

Reviewer ycjBOpenReview ↗
Rating
5/6
Confidence
3/5
Quality
3/4
Clarity
3/4
Significance
3/4
Originality
4/4
Contribution type
concept_feasibility
Ethical concerns
NO or VERY MINOR ethics concerns only
Read review
Summary

This paper investigates the problem of automatic code refactoring. They have 4 primary contributions:

  1. MiniCode, a new collection of code refactoring benchmarks.
  2. A refactoring method called LIBRARIAN, which has a plug in for a scoring function for refactorings.
  3. Evaluate how scoring functions (token count, MDL, cyclomatic complexity, maintainability index) work as plug-ins for LIBRARIAN by evaluating the refactorings produced using natural metrics of code re-use (including on hold-out files) and human quality assessment. They found that MDL (measured by a langauge model) is the best objective.
  4. Evaluation of Librarian on benchamrks and real-world datasets (huggingface Transformers and Diffusers libraries): "the first time library learning has been successfully applied to real-world software projects".
Strengths and weaknesses

I've updated the contribution type to match the author's: "Concept & Feasibility". I've reconsidered the paper under these criteria and I think my overall assessment stays essentially the same. To me, the essential contribution is identifying that compression-style evaluations (MDL and token count) may predict code reuse and human preferences better than traditional software engineering metrics (maintainability index; cyclomatic complexity). The demonstration on real HuggingFace code can be seen as a solid feasibility demonstration for a "Concept & Feasibility" contribution. My initial review flagged the small number of such realistic demonstrations as a weakness, but with the change of contribution type, this is a smaller deal.

Reviewers LH6k and Z4hs made a good observation that the current evidence supports MDL ≥ token count but does not separate the two. The authors indicate they will adjust their claims accordingly.

Strengths:

  • Addresses a very important problem in a domain of practical relevance, as opposed to prior work focused on simpler settings, e.g., lambda-calculus, as opposed to full scale Python code bases.
  • The evaluation of different re-ranking scores for refactoring quality was well done, with 3 different approaches to validate (in-sample code re-use, out-of-sample code re-use, and human evaluation).
  • Interesting findings (e.g., strong evidence for MDL being a a good proxy assessor for library / refactoring quality; o4-mini beats claude code on small tasks; Librarian can improve over Claude code)

Weaknesses:

  • There are not a lot of tasks in the most interesting/realistic category of tasks (the transformers and diffuser tasks); most tasks are small/competition code; how well the MDL metric generalizes to other realistic tasks is still TBD.
  • 2 of the 3 independent evaluations for refactorings (i.e., used to evaluate the scoring functions) are a priori very related to the scoring functions: code reuse is basically about MDL and token length. The 3rd eval, human eval, is independent, but only applied on the smaller tasks. Maybe you could introduce an LLM evaluator posing as a human (after assessing for correlation to human eval, etc).
  • some methods descriptions are hard to parse.
Questions
  • I think the text around equation (2) is too brief and hard to parse. Maybe expand "sample K candidates" to "sample K candidate refactorings", or explicitly define the SAMPLE_K operator.
  • Line 178: "while MDL can encourage comments that increase the likelihood of subsequent code" -- I think "can" is doing a lot of work here. 1) I think a lot is dependent on the density of comments in the code the. model is trained on and 2) I'm very skeptical that code with a comment with have lower MDL than same code without the comment. Would be very interesting to see an example of this.
  • Line 157: repetition: "set of set of"
Limitations

Yes - quite a good job identifying limitations.

Final justification

My recommendation remains at 5, even under the change to "Concept & Feasibility" for contribution type.

Resolved in discussion:

  1. My question on MDL: the authors' constructed example and their restatement are satisfactory.
  2. Attribution of gains to the method rather than extra test-time compute (raised by LH6k and AC): addressed by the compute-matched Claude Code baseline (though curious for reviewer LH6k's take).

Unresolved or partially resolved:

  1. MDL is not shown to outperform token count (Reviewers LH6k and Z4hs). Z4hs's reference-LM contamination point makes this even stronger: MDL scores on HuggingFace tasks come from models that were likely trained on that very code, affecting the MDL-specific result, but not the token count result. I weight this lightly, so long as the authors state their claims accordingly. I think the broader point that compression-style proxies (including simple token count) beat classical SE metrics is interesting in any case.

  2. My original weakness #2 seems unresolved to me: two of the three evaluations used to judge the scoring functions (in-sample and held-out code reuse) are very related to the compression-style scoring functions themselves. The third evaluation, the human study, was only applied on the smaller tasks. The authors' response (that reuse is measured on held-out files) seems to address a concern about overfitting, but I'm mainly saying the deck seems stacked to prefer MDL/token length from the choice of evaluations. I weight this moderately: I think it does reduce the strength of evidence that compression proxies are better, and I still think my original suggestion (an LLM evaluator that could scale independent judgment to the realistic tasks) would be worth investigating. As a Concept & Feasibility paper, my recommendation doesn't change.

Formatting concerns

All good.

2 comments
Authors · CommentOpenReview ↗

Thank you for your input and support. Below we respond to your questions.

I'm very skeptical that code with a comment with have lower MDL than same code without the comment. Would be very interesting to see an example of this.

You’re right that comments typically increase MDL (and always increase tokens). But here’s one case we constructed where comments overall decrease MDL:

import numpy as np

# Avogadro's number
ag = 6.02214076e23

# Hydrogen mass
hm = 1.008

(MDL -53.3 with comments vs. -57.8 without comments). We’ll add this example to the revision. But you’re basically right: It took us several tries to construct the above example. A better way of putting it is that MDL penalizes comments less than tokens, and occasionally encourages comments.

2 of the 3 independent evaluations for refactorings (i.e., used to evaluate the scoring functions) are a priori very related to the scoring functions: code reuse is basically about MDL and token length

Just to clarify: Code reuse is not necessarily about MDL/tokens, because we measure reuse on unseen files – i.e., does the new library get reused when refactoring files not originally used to build the library? MDL/tokens are about compressing the training source files, not the unseen source files.

I think the text around equation (2) is too brief and hard to parse. Maybe expand "sample K candidates" to "sample K candidate refactorings",

Fixed! We’ve revised to say exactly what you suggested.

Reviewer ycjB · CommentOpenReview ↗

Thanks for the response and investigating the MDL / comments question. Please see my updated strengths/weaknesses and final justification section.

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Missing a submission?

Loading the discussion…