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

オープン 初心者向け
#1,202 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
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分
マージ済み PR(30日)
32

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

NVIDIA-NeMo/DataDesigner のほかの issue

NVIDIA-NeMo/DataDesigner の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。