Paper-as-Code: Can LLMs Generate Usable Algorithms Directly from Research Papers?

    This article examines a systematic evaluation of whether major LLMs can build working algorithm implementations from paper text alone. It breaks down where models succeed (standardized, highly formalized methods) and where they fail (domain-specific data structures, implicit conventions, and low-density papers requiring cross-literature reasoning), and offers practical guidance for making methods reproducible. Readers will learn the key factors that determine paper-to-code success and how to structure a method specification to make implementations more reliable.

    A Long-Overlooked Cost: Implementation Is More Expensive Than Design

    Between algorithm research and real-world engineering deployment lies a gap that consumes far more team effort than the algorithm design itself. The heavy lifting usually happens not in the core idea, but in the tedious engineering overhead built around it: dependency version conflicts, runtime environment drift, edge-case fixes, data format adaptation. These tasks look trivial individually, yet often cost more in practice than designing the core algorithm. And there is a curious fact behind them: the core idea of most algorithms is already described relatively clearly in the original paper, both mathematically and procedurally.

    This raises a natural question: if a paper already “explains” the algorithm, can today’s large language models directly generate working implementation code from the literature alone? If the answer is yes, then the vision of “paper-as-code”—converting a formal description into an executable implementation in a single step—would dramatically shrink the cost between research and engineering.

    A recent systematic evaluation published in a bioinformatics journal took up exactly this question. The research team selected representative algorithms from multiple real-world scenarios, asked several mainstream LLMs to build complete implementations from scratch using only the original paper text, and then quantitatively evaluated the correctness and consistency of the generated code.

    Evaluation Design: Measuring “Paper-to-Code” Reproducibly

    To make this kind of comparison persuasive, the evaluation had to control variables tightly.

    The team chose five algorithm categories that are representative and vary in difficulty: random forest classification, batch effect correction, gene regulatory network inference, metabolomics correction, and gene set enrichment analysis. These tasks differ markedly in mathematical complexity, data dependency, and domain specificity, together forming a capability spectrum that runs from “highly standardized” to “highly domain-specific.”

    Several key constraints were applied to the task setup:

    • Models received only the original paper (usually a PDF) plus basic input/output requirements.
    • Calling existing library functions or third-party implementations was not allowed; the algorithm logic had to be written from scratch.
    • Evaluation spanned three levels: whether the code runs successfully, whether the output matches a mature standard implementation, and whether key statistical metrics agree.

    The “no existing libraries” constraint was central to the entire evaluation. It closed off the shortcut of “searching for and calling existing tools,” forcing the model to reconstruct the algorithm’s internal logic from the paper’s description. As a result, the evaluation no longer measured the model’s knowledge-retrieval ability, but its actual ability to turn a formal description into equivalent code.

    Layered Results: Where the Boundaries of Capability Lie

    The results revealed a clear stratification of capability, closely tied to how “standardized” each algorithm is.

    1. Clear Math, Standardized Workflows: High-Fidelity Reproduction

    For methods with clear mathematical definitions and highly standardized workflows—such as random forest classification and batch effect correction—mainstream LLMs, especially those with stronger general reasoning ability, produced code that showed no statistically significant difference from mature open-source libraries on key metrics like classification accuracy and batch-correction quality.

    This finding matters a great deal: when the algorithm logic itself is complete and formalized enough, the model genuinely can convert natural-language and mathematical descriptions into equivalent code. The tree-splitting criterion, the ensemble voting mechanism, the mean-variance alignment idea behind correction—parts usually defined explicitly in a paper—were captured accurately and implemented faithfully by the model.

    2. Domain-Specific Data Structures: Logically Correct, Engineering Adaptation Fails

    Problems began to surface when domain-specific data structures were involved. Take metabolomics correction: its example data used a multi-level indexed table structure, and the paper did not clearly state the semantics of rows and columns. The model’s first generated code was logically correct but failed outright because it could not correctly parse this composite index. Only after the researchers added a detailed description of the data structure did the model produce a working implementation.

    This exposes a deeper contradiction: readers of a paper usually assume they already possess the domain’s “data common sense,” so authors omit any explanation of the data structure itself. For a model, though, those unstated conventions are exactly what determine success or failure. Logic that is correct but does not run is not caused by misunderstanding the algorithm—it is caused by a missing interface contract.

    3. Implicit Implementation Conventions: Systematic Bias in the Paper’s Gaps

    In the gene regulatory network inference task, the model’s first reproduction produced the correct network topology, but the direction and sign judgments of the edges showed a systematic bias against the official implementation. Tracing the source of the difference led back to implementation details the paper never specified: the choice of discretization strategy, the choice of mutual information estimator, and the rule for handling coincident peak times.

    In engineering practice, such details are often assumed to follow some “conventional approach,” which is why they are omitted from the paper. Yet they are precisely the root cause of differences in algorithm output. Under different discretization or estimator choices, the same algorithmic framework can produce edges with completely opposite directions. This is a reminder that an algorithm’s reproducibility depends not only on the main pipeline, but also on those implementation conventions the paper “assumes you already know.”

    4. Cross-Literature Reasoning: Where Capability Diverges When Information Density Is Low

    The gene set enrichment analysis task presented a different challenge. The applied paper corresponding to this task did not describe the algorithm steps in detail; instead, it cited an earlier, classic foundational work. Faced with this “low information density” paper, most models could not complete a from-scratch implementation. Only the few models with active knowledge-retrieval and cross-literature reasoning ability could trace back to the ranking statistics and permutation-testing workflow in the original reference and ultimately output results highly consistent with the official tool.

    This reveals a key conclusion: whether a model succeeds depends not only on the current paper’s information density, but also on its knowledge-retrieval and cross-literature reasoning ability. When a paper is a “pointer” rather than a “complete description,” the ability to follow the citation chain and fill in the missing pieces becomes an important marker distinguishing model capability.

    Why This Stratification Emerges

    Abstracting and distilling the four result categories above, we can identify the key factors that decide whether “paper-to-code” succeeds:

    • Degree of formalization: The clearer the mathematical definition and the more standardized the workflow, the higher the reproduction success rate; the more gaps left in the paper, the more it depends on the model’s ability to fill them in.
    • Clarity of the data contract: Whether the structure, semantics, and boundaries of the input data are stated explicitly directly determines whether the interface layer runs at all.
    • Inferability of implicit conventions: Engineering conventions such as discretization, estimators, and boundary handling are often omitted in papers; the model can only guess from experience, which brings the risk of systematic bias.
    • Information completeness and cross-literature reasoning: When a paper is incomplete, whether the model can proactively retrieve and connect multiple sources to complete the reasoning becomes the dividing line.

    A reproduction workflow worth referencing can be summarized as the following formalized steps:

    1. Input: paper text + basic input/output conventions
    2. 1. Parse the algorithm's formal definition and main workflow
    3. 2. Identify and make explicit the implicit conventions (discretization, estimator, boundary rules)
    4. 3. Define the data structure contract (row/column semantics, index hierarchy, missing-value handling)
    5. 4. Implement the core logic from scratch (no existing libraries)
    6. 5. Align with mature implementations via key statistical metrics to verify equivalence

    Steps 2 and 3 are exactly the parts most likely to be omitted in a paper, and most likely to “crash” during implementation.

    Practical Recommendations for Reproduction Engineering

    Based on the evaluation findings, the research team offered a pragmatic suggestion: when submitting or publishing a method, authors can attach a “Method Specification Prompt” to systematically fill in the paper’s gaps. Its content should at minimum cover:

    • A prompt template used for reproduction: clearly defining the task boundary and the input/output contract;
    • Precise specification of the input data format: including row/column semantics, index structure, and field meanings;
    • Valid ranges and default conventions for key parameters: for example, the discretization strategy, estimator choice, and boundary handling;
    • Validation criteria and alignment metrics: so that reproducers can judge whether an implementation is equivalent.

    This approach pays off in both directions. On one hand, it provides automated reproduction—including by LLMs—with complete, structured input, significantly raising the success rate of “paper-to-code.” On the other hand, it is itself good academic practice for improving paper reproducibility; even human readers benefit from it. For cloud platforms that carry model-inference and batch-reproduction workloads, such structured input can also be captured as reusable task templates and validation pipelines, turning “paper-driven implementation” from isolated cases into a scalable, measurable engineering capability.

    Conclusion: LLMs Are Efficient Implementation Assistants, Not Magic Buttons

    Taken together, LLMs’ ability to generate algorithms from the literature is now sufficient to replace a substantial share of repetitive implementation work on standardized, highly formalized tasks, freeing engineers from tedious engineering overhead. But when facing domain-specific data structures, implementation conventions left unstated in a paper, or low-density scenarios that require cross-literature reasoning, the model still needs humans to provide clear supplementation and verification.

    In other words, “paper-as-code” is not a slogan but a practical path that needs supporting engineering standards. What truly determines success is often not how powerful the model itself is, but whether the paper, the data contract, and the validation criteria are expressed clearly enough. For developers, investing effort in “how to describe a method unambiguously” is becoming just as important as “how to implement it efficiently with the help of LLMs.”