跳到正文
原文
Hacker News· lasu·· 4 小时前精选AI 评分53

开发者 lasu 开源 Parsimony 基准,量化 AI 编码模型净增的代码量

Show HN: Parsimony – an open-source benchmark for how much code AI models add

AI 导读

开发者 lasu 开源 Parsimony 基准,量化 AI 编码模型在完成任务时净增了多少代码单元。它复用 SWE-bench Verified 已发布的 patch,按净增单元数(新增减去删除)排序而非按行计数,目前仅支持 Python。榜单显示代码量更小的模型并未解决更多任务,模型排名与解决数的 Spearman 系数为 0.33–0.60,所有模型共用 mini-SWE-agent 运行。

推荐理由

Parsimony 把 AI 编码模型的代码净增量做成可比较榜单,给出与解决数并列的另一维度,读者可据此比较不同模型的简洁程度。

正文 · 原文

Existing benchmarks measure solve rate and cost, but don't punish excess code, which makes a codebase harder to work with in the long term. Parsimony measures how much code AI models add.

It takes the patches that benchmarks already publish and counts coding units: syntax elements like statements, calls, comparisons, names and literals. Lines aren't counted, so cramming code isn't rewarded, and deleted code is subtracted: net units = added − removed.

Compare models

How to read this

Models are ranked by mean net units added on the tasks they solved, lowest first. "Net units added (mean)" also includes failed attempts. Solved comes from SWE-bench Verified; tests aren't rerun. Measured is how many solved attempts could be measured.

Leaderboard

Rank Model

Method

  • Each patch is applied to the task's code, and both versions of every changed file are parsed. Nothing is run.
  • Tests, docs and generated files are left out. Only Python is measured.
  • Pass/fail comes from SWE-bench's published results; tests aren't rerun.

Limits

  • Smaller isn't always better: units measure size, not readability or design.
  • Models that write more code also tend to solve more tasks (Spearman 0.33–0.60 on the boards with 26+ models).
  • Every model uses the same agent (mini-SWE-agent), but the agent still affects how much code gets written.

Add your own benchmark

Have code-size numbers from another benchmark? Download the example file, fill in your results and open it to get the same chart and table. The file stays in your browser. Format and how to share it.

Example: check for a negative number

Both return the same result.

def has_negative(values):
    found = False
    for value in values:
        if value < 0:
            found = True
    return found
def has_negative(values):
    return any(value < 0 for value in values)

来源:Hacker News · parsimony.lasu.dev