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

Abierto Apto para principiantes
#1,202 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
76/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
pandas, python

Línea de trabajo

Lee sample_scores_and_reasoning en engine/analysis/utils/judge_score_processing.py y las pruebas existentes en tests/engine/analysis/utils/test_judge_score_processing.py. Comprueba cómo la rama proporcional pondera las filas y, después, añade una prueba de regresión con categorías de puntuación desequilibradas. Verifica que los recuentos de categorías muestreadas coincidan con las proporciones esperadas. La tarea estará terminada cuando pase la prueba de regresión y la muestra conserve las puntuaciones poco comunes como se espera.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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
Lenguaje dominante
Python
Estrellas
2.4k
Forks
258
Merge medio
4 d 20 min
PR fusionados (30 d)
32

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de NVIDIA-NeMo/DataDesigner

Todos los issues de NVIDIA-NeMo/DataDesigner

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.