Judge score profiler samples reasoning with squared category weights, crowding out uncommon scores

未关闭 适合新手
#1,202 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
76/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
pandas, python

调研方向

阅读 engine/analysis/utils/judge_score_processing.py 中的 sample_scores_and_reasoning,以及 tests/engine/analysis/utils/test_judge_score_processing.py 中现有的测试。检查比例分支如何为各行加权,然后使用分布不均衡的分数类别添加回归测试。验证抽样得到的类别数量是否符合预期比例。回归测试通过且样本按预期保留少见分数后,即表示完成。

由索引模型根据 Issue 内容生成。

描述

Priority Level

Low (Cosmetic / Minor)

Describe the bug

sample_scores_and_reasoning in engine/analysis/utils/judge_score_processing.py picks the judge reasoning examples that JudgeScoreProfiler sends to the summarization model and stores in JudgeScoreSummary.score_samples. The code comment says it samples "proportionally to maintain original category ratios", but each row is weighted by the count of its own score category:

weights = df_samples["score"].map(score_category_counts)
samples = df_samples.sample(n=num_samples, weights=weights, random_state=random_seed)

A category with c rows then gets total weight c * c, so the sampled share of each score is proportional to the square of its frequency. Uncommon scores (usually the low ones, which carry the "areas for improvement" reasoning) are crowded out of the sample, and the summary prompt mostly sees reasoning for the majority score.

Steps/Code to reproduce bug
from collections import Counter

from data_designer.engine.analysis.utils.judge_score_processing import sample_scores_and_reasoning

scores = [5] * 90 + [1] * 10
reasoning = [f"r{i}" for i in range(100)]

total = Counter()
for seed in range(200):
    sample = sample_scores_and_reasoning(scores, reasoning, num_samples=20, random_seed=seed)
    total.update(s.score for s in sample)

n = sum(total.values())
print({k: round(v / n, 3) for k, v in total.items()})
# main (861a082): {5: 0.988, 1: 0.013}

Score 1 is 10% of the records but only 1.3% of the sampled reasoning; most 20-row samples contain no score-1 reasoning at all.

Expected behavior

The sample keeps the score proportions of the data, as the comment describes: about 18 rows with score 5 and 2 with score 1 in the example above.

Prior Investigation

Read sample_scores_and_reasoning and its tests (tests/engine/analysis/utils/test_judge_score_processing.py); the existing tests only check sample sizes and the one-per-category branch, not the proportional branch. Searched open and closed issues and PRs for sample_scores_and_reasoning, judge_score_processing and judge score sampling; found nothing related.

Proposed fix: replace the per-row weights with a proportional allocation per score category (largest-remainder rounding to hit num_samples exactly), then sample that many rows from each category. Plain unweighted df.sample would also be unbiased; the per-category allocation additionally keeps the counts exact so a 10% score is not dropped by chance. I have the fix and a regression test ready and can open a PR once this is triaged.

Checklist
  • I reproduced this issue or provided a minimal example
  • I searched the docs/issues myself
主要语言
Python
星标
2.4k
派生
258
平均合并
4 天 20 分钟
30 天内合并 PR
32

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

NVIDIA-NeMo/DataDesigner 的其他 Issue

查看 NVIDIA-NeMo/DataDesigner 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。