Skip to content

Report cap-hit, empty and unclosed-think counts beside every score - #421

Merged
abhishekraok merged 19 commits into
mainfrom
abhishekr/generation-counts-399
Oct 15, 2026
Merged

abhishekraok merged 19 commits into
mainfrom
abhishekr/generation-counts-399

Conversation

@abhishekraok

@abhishekraok abhishekraok commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator

Codex · codex://threads/01a1326f-ed81-75e3-80e4-661392dbe4b5

Show generation diagnostics beside task, suite and baseline scores in logs and the dashboard: total outputs, cap hits, empty final answers, unclosed explicit thinking tags and unknown finish reasons. LiteLLM retains finish reasons. Metrics and the optional ingest field persist counts; nullable JSONB migration 0006 and read endpoints make them available without prediction/vector rows. Deploy the ingest API before updated upload clients.

Suite totals count scored member tasks once. Omitted/null counts preserve legacy upload hashes and finalized-upload data. Failed-task drilldown still shows diagnostics while withholding scores. Tasks, Overview and drilldown render counts; task rows accommodate wrapped diagnostics while retaining normal density without counts. Loglikelihood/legacy results have no counts. SAGE counts reflect its own post-thinking scoring text, with tool calls exempt from empty-answer counts. No new failure gate is added.

Validation: independent Claude review; legacy hash/upsert, overlap/membership, baseline API, drilldown and page regressions. Python/API checks pass; all 83 UI tests, typecheck and ESLint pass. Full Python CI and dashboard CI pass.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T19:25:03.125424Z afb8e7d New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2110bc99b2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

abhishekraok and others added 2 commits October 1, 2026 18:08
)

A generation cut off by its token budget, or one that closes its thinking
trace and then says nothing, scores near zero without any error, so a
budget or template defect reads as a capability gap. Count how each
task's saved generations ended and carry the counts to every surface a
score is read from:

- generations: outputs counted, the denominator
- cap_hit: the provider stopped at the token limit (finish_reason "length")
- empty: no text left to score after thinking traces are stripped
- unclosed_think: a <think> block the generation opened and never closed
- finish_reason_unknown: the provider did not say why it stopped, so
  cap_hit is a lower bound

The counts appear in the task completion line, a Generations column in
the results summary table, metrics.json, suite aggregations (summed over
member tasks) and the stored task row, via a new nullable JSONB column.
Loglikelihood tasks generate nothing and carry no counts.

Co-Authored-By: Claude Code <[email protected]>
Native tool calling returns text="" beside the structured calls that
ToolCallScorer scores, so such outputs read as empty beside a passing score.
An output is now empty only when it has neither text nor tool calls.

Addresses Codex review on #421.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@abhishekraok
abhishekraok force-pushed the abhishekr/generation-counts-399 branch from 2110bc9 to 892a187 Compare October 1, 2026 18:30
@abhishekraok
abhishekraok requested a review from a team as a code owner October 1, 2026 18:30

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 892a187c25

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

abhishekraok and others added 2 commits October 2, 2026 17:55
Suite summaries were rebuilt as (metric, score), so the counts attached
to a suite result never reached metrics.json, single- or multi-model.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@gregorybchris gregorybchris left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 This review was written by an AI agent (Claude Code), posted on behalf of @gregorybchris. It is not a human review.

Summary: This looks good to merge after a few small changes. The problem is real, the design is sound, and I found no correctness bugs. The biggest gap is that the counts are empty for API models, and that takes one line to fix.

Is the problem real?

Yes. In #399, truncated reasoning traces made ifeval_ood look like a capability gap, and nothing in the logs or summary table showed it. finish_reason and original_text were already saved per output in predictions.jsonl (runners/io/builders.py:74-93), but nobody reads that file during a run. Putting a summary next to the score is the right fix.

Design

  • Counting after strip_thinking_traces on both result paths, reusing original_text the same way the predictions builder does, is correct. Skipping loglikelihood tasks and returning None is right.
  • JSONB vs. integer columns (open question 1): JSONB is fine. task_results already stores metrics and task_config as JSONB, and these are diagnostic counters that rarely need SQL filtering. I'd keep it.
  • I considered putting the counts into the metrics dict instead, which would need no migration. Suite aggregation averages every metric, though, so a separate field is cleaner.
  • Gating (open question 2): agreed on report-only for now. A max_cap_hit_rate default needs data we don't have yet.

Findings

  1. cap_hit is always 0 for litellm, and the fix is one line (src/olmo_eval/inference/providers/litellm.py:149-173, outside this diff). The description notes that litellm doesn't set finish_reason. But the value is available: the loop over response.choices drops choice.finish_reason, and the metrics collector already reads it (inference/metrics/core/collector.py:50). Adding metadata["finish_reason"] = getattr(choice, "finish_reason", None) would make cap_hit real for every API model. As it stands, "cap-hit beside every score" holds only on vLLM. Worth doing here or in a quick follow-up.

  2. The description contradicts the code on summary{} (src/olmo_eval/runners/common/models.py:76). Open question 3 says the counts are "not on summary{}", but 9ce98f0 adds generation_counts to ScoreSummary for suites, so it shows up in metrics.json summary. That is probably the right call, since MetricsOutput has no suites list. But it means summary entries now have mixed shapes (suites carry counts, tasks don't). Please update the description, or keep summary uniform and put suite counts somewhere else.

  3. unclosed_think will usually read 0 in the #399 case (src/olmo_eval/runners/processing/generation_counts.py:78). As the description says, a trace that the template opens has no <think> in the output. The completion line still prints unclosed-think 0 every time, which a reader could take to mean there's no problem. Consider printing it only when it's nonzero, like finish-reason unknown.

  4. Nit: finalize_task's success path never runs in production (src/olmo_eval/runners/asynq/preparation.py:195). Its docstring says the async runner calls it only for task-level errors, and real results go through compute_task_metrics. The addition is harmless for consistency, but the finalize_task test covers a path production never takes.

  5. Nit: the results viewer doesn't show the new column. That's fine for a follow-up.

Verified

  • All 18 new tests pass. ruff check and ruff format --check are clean.
  • The PR merges cleanly into current main, and the alembic chain has a single head (add_instance_failure_accounting → add_generation_counts).
  • The DB write and read paths (storage/base.py, repository.py save and load) are wired. Suite sums use the right task lists for AVERAGE, WEIGHTED_AVERAGE, and AVERAGE_OF_AVERAGES, including nested suites.

Comment thread src/olmo_eval/runners/common/models.py Resolved
Update generation diagnostics for the dashboard migration
Retain API finish reasons, clarify diagnostics, and persist counters through dashboard ingest
Include the approved OMEGA extraction fix
@abhishekraok

abhishekraok commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator Author

Codex · codex://threads/01a1326f-ed81-75e3-80e4-661392dbe4b5

Addressed the review: LiteLLM retains choice.finish_reason even when logprobs supply metadata, and the completion line suppresses unclosed-think when zero. Updated the description to distinguish counts on task entries from summed counts on suite summary entries. The finalize_task success-path assignment stays for consistent results from that entrypoint; its test covers compatibility, while compute_task_metrics has separate production-path coverage.

Main replaced the storage layer, so counters now travel through the optional ingest field and nullable JSONB migration 0006. Uploads omit unavailable counts. Added API metadata, upload, contract validation, and database-upsert regression tests. All 3,322 unit tests pass; the final focused counters/upload selection passes. Dashboard CI passed all 265 API tests, including Postgres persistence and migration consistency. Its migration idempotence assertion now follows the current Alembic head.

Include the approved IFBench reasoning defaults

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 36a2b1459a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Check migration idempotence against the current Alembic head
Expose generation diagnostics through the read API and render them beside dashboard scores

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 511dcaa2e9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sum member generation diagnostics beside dashboard suite scores
Preserve legacy upload identity and failed-task diagnostics after Claude review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e3fa9ca3f4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Include referenced files in the legacy-upload fixture hash
Expose generation diagnostics on baseline task and suite score cells

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 130518f5b4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Match suite generation diagnostics to the leaves included in its score

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: db041caa32

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread dashboard/ui/src/pages/run/TasksTab.tsx Resolved
Give task score rows room for generation diagnostics. Exercise baseline counts in a filtered task row and verify its height.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9da7ead40b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread dashboard/ui/src/pages/run/TasksTab.tsx Resolved
Retain density-based task rows when generation diagnostics are absent. Remeasure virtual rows when height changes to avoid overlapping positions; cover compact legacy rows and diagnostic row transitions.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b0d2df5da2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Let scorers report whether their processed answer is empty. SAGE reports this after removing balanced or truncated thinking regions; generation diagnostics retain the tool-call exemption. Cover both SAGE tasks with traces and visible answers.

@gregorybchris gregorybchris left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This review was generated by an agent following REVIEW_GUIDE.md. It is not from a human reviewer. Reply in the PR thread and a maintainer will follow up.

Looks good overall! The counts are wired end to end, and every earlier review thread is addressed. I found nothing blocking. One finding affects the accuracy of the empty count on several existing tasks. The rest are documentation and dashboard consistency.

Blocking

None.

Non-blocking

  1. src/olmo_eval/runners/processing/generation_counts.py:39
    empty under-counts on tasks that strip <think> blocks themselves instead of setting strip_thinking. SAGE was fixed with the scoring_text_empty flag. ExpertQA, ResearchQA and GeneTuring strip the same way (expertqa.py:200, researchqa.py:338, geneturing.py:234) and do not set the flag. I reproduced this against count_generations after Task.strip_thinking_traces: for expertqa, expertqa:cite, researchqa and geneturing_amino_acid_translation (all strip_thinking=False), an output of "<think>long reasoning</think>\n" with finish_reason="stop" gives empty 0. Those tasks score that output as having no answer, so the diagnostic reads clean beside a zero. This is a gap in the framework: nothing records which text a task actually scored. Could count_generations judge emptiness from the text after the last </think> (via extract_think_answer) whenever the raw output contains one, regardless of strip_thinking? That covers every task at once and lets SAGE drop its per-task flag. If you prefer to keep the flag, please set it in the three tasks above and add a test for each.

  2. src/olmo_eval/evals/tasks/sage.py:326, src/olmo_eval/evals/tasks/sage.py:417, src/olmo_eval/runners/processing/generation_counts.py:39
    "scoring_text_empty" is a bare string shared between a task module and the runner. A new task author has no way to learn that it exists. If the flag stays after finding 1, please define it once as a documented constant, the way REQUEST_ERROR_KEY is defined in inference/errors.py, and import it in both places.

  3. src/olmo_eval/runners/processing/generation_counts.py:23
    The key definitions were removed in 0bc15f3 ("Trim comments and docstrings"). These keys are now persisted in metrics.json, the ingest contract and the task_results table. TaskResult.generation_counts (src/olmo_eval/runners/common/types.py:68) and TaskMetricsEntry both send the reader to this module, which now says only "Count generation outcomes after scoring". That is also slightly off: counting happens after thinking-trace stripping. Please restore a short, general definition of each key. It should say what cap_hit counts and that it is a lower bound when the finish reason is unknown, that unclosed_think only sees tags the model emitted, and that empty ignores tool-call outputs. The earlier docstring was close to right.

  4. dashboard/ui/src/pages/run/TasksTab.tsx:263, dashboard/api/src/olmo_eval_api/services/ingest.py:970
    The Tasks table now shows two truncation figures on one row, and they use different units. The existing Trunc. column is per instance: an instance counts as truncated if any of its samples hit the limit (src/olmo_eval/upload/extract.py:286-288). It only exists when predictions were uploaded. The new cap x/y is per output. On a task with 10 samples per instance, one truncated sample in each of 20 of 100 instances shows Trunc. 20.0% beside cap 20/1000. Both numbers are correct, but a reader will see a contradiction. Should Trunc. fall back to cap_hit / generations when there are no instance rows, with tooltips that name each unit? Or should one of them go? A follow-up issue is fine for this.

Nits

  • Nit: dashboard/ui/src/pages/run/TasksTab.tsx:101 and :128 widen the Score and Base columns to 190px for every run, while the row height is only raised when counts exist. Legacy and loglikelihood runs lose horizontal space for nothing. Consider using the same condition for the widths.
  • Nit: dashboard/api/src/olmo_eval_api/services/read_suites.py:25 sums every key it finds, while the runner's sum_generation_counts sums only GENERATION_COUNT_KEYS. Harmless today. Matching them keeps suite totals from drifting if a key is added later.
  • Nit: the branch has 14 commits titled "Codex · codex://threads/...". Please squash with a descriptive message at merge.

What I checked

  • ruff check and ruff format --check are clean. ty check src/ reports one unused type: ignore in sandbox code this PR does not touch (an artifact of my local environment). CI type check is green.
  • Unit tests in a worktree at 10709bbb: 3344 passed, 35 skipped (pytest tests/ --ignore=tests/integration).
  • I read the count paths in finalize_task and compute_task_metrics, aggregate_results, suite aggregation for every strategy, both metrics.json builders, the uploader, the ingest upsert and content hash (legacy hashes are preserved when counts are absent), the read endpoints and the UI cells. Context-overflow outputs become failed instances and are not counted. No resume path rebuilds TaskResult without counts.

Before merge

Nothing blocks the merge. Please address finding 1 here or in a linked issue, since it makes the new diagnostic wrong on existing tasks. Finding 3 is a small docstring change and belongs in this PR. Finding 4 can be a follow-up issue titled something like "Reconcile per-instance truncation rate with per-output cap-hit count in the Tasks table." You may merge once CI is green.

Comment thread src/olmo_eval/evals/tasks/sage.py Resolved
Comment thread dashboard/ui/src/pages/run/TasksTab.tsx Resolved

@gregorybchris gregorybchris left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. The non-blocking items in the agent review above are worth a look, especially the empty count for ExpertQA, ResearchQA and GeneTuring; a follow-up issue is fine. Merge once CI is green.

@abhishekraok
abhishekraok enabled auto-merge (squash) October 15, 2026 19:22
@abhishekraok
abhishekraok merged commit edf5fd0 into main Oct 15, 2026
11 of 12 checks passed
@abhishekraok
abhishekraok deleted the abhishekr/generation-counts-399 branch October 15, 2026 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants