Repository navigation
feat(pdf_analyst_qa): standardize task data as flat rows plus PDF media - #6475
Conversation
The dataset bundle split each task across four places: the JSONL row, tasks/<task_id>.json, workspaces/<workspace_id>/documents.json, and document_store/. The rows meant nothing without the bundle, and the bundle had to be copied to a local dataset root on every cluster that runs the environment. That is complexity without a purpose: the policy sees only the request, and the reference is just as hidden from the sandbox whether the server reads it from a file or from the row. It also makes the data cumbersome to share, since a dataset cannot travel as plain rows plus media like other environments' data. A dataset is now the JSONL rows plus the PDFs they name. Each row carries everything the resources server needs as flat task fields: `reference` (the task record with the reference answer) and `documents` (each selected PDF's path under the bucket prefix, its sandbox target and sha256). The server builds the sandbox manifest from the row and no longer reads tasks/, workspaces/ or document_store/ from a local dataset root, so `dataset_root` and `pdf_analyst_qa_dataset_root` are removed. The seed still rejects a reference that does not grade as correct and format-compliant against itself. The new `PdfAnalystQaTaskRow` (the seed model and `TaskData`) also checks that the reference matches the row's task and workspace, that document targets are unique, and that paths are relative PDF paths. The sandbox still checks every copied PDF against the row's sha256. The example moves to data/example/ as one self-contained row and its PDF; prepare_example.py is removed. Signed-off-by: Jarno Seppänen <[email protected]>
@jseppanen, there was an error processing your request: See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/1/ |
|
/ok to test aac57f2 |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP WITH CARE
RISK: Required real rollout validation is still pending
The PR description still lists the planned 32-rollout smoke as pending. Session initialization now reads references from rows, and the manifest builder uses a different bucket-relative layout. The reported 102 passing unit tests do not show converted rows and published PDFs working through a real OpenCode/model session. AGENTS.md requires representative real smoke rollouts for behavior-changing environment work. This is a validation gap, not a demonstrated runtime defect.
Could you complete the planned smoke on this head using converted flat rows, PDFs under pdf_analyst_qa_document_prefix, and no local dataset_root? Attach the resolved configuration and rollout artifacts, identify the model and dataset, and record the inspected agent/verifier outcomes. Acceptance is evidence that selected PDFs stage successfully, the agent can read them, verification completes, and sandboxes are released. Inspect the model input to confirm the reference stays hidden. Diagnose infrastructure failures separately from scored model failures and rerun affected coverage after fixing deployment problems.
Keep grading unchanged while validating the migration. The existing correct/wrong/retry test must retain unmasked rewards of 1 for 23 and 0 for 24, stable verification retries, and masking for a missing session. Keep the document-copy test accepting matching checksums and rejecting mismatches. A reward-profile comparison is not required for this training environment.
I reviewed the changed files and their affected contract, dispatch, and sandbox paths statically. I did not execute tests or rollouts in this read-only review.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
|
Thanks. This review ran before the PR description was updated; the real-rollout smoke test it requests is complete, and the results are now in the description under Rollouts. Here are the details for each acceptance point:
The resolved config and rollout files are stored internally; I can share specific records if helpful. |
…-qa-row-tasks Signed-off-by: Jarno Seppänen <[email protected]>
|
/ok to test f990e4a |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/45372519800 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/45377527146 |
What does this PR do?
pdf_analyst_qadatasets are now plain JSONL rows plus the PDFs they reference, matching the rows-and-media layout of other environments.Previously, a dataset was a bundle that split each task across four places: the JSONL row,
tasks/<task_id>.json(the reference answer),workspaces/<workspace_id>/documents.json(which PDFs the task may see), anddocument_store/(the PDFs, read and hashed by the server from a localdataset_root). The rows were unusable without the bundle, which had to be copied by hand to every cluster running the environment. This split bought nothing—the policy sees onlyresponses_create_params.input, and the reference stays out of the sandbox whether the server reads it from a file or from the row—and it made the data cumbersome to share.Each row now carries two flat task fields:
reference: the task record (question, reference answer, answer format, and grading metadata), verbatim.documents: the selected PDFs, each withpath(relative topdf_analyst_qa_document_prefixin the bucket),target(its path under/workspace/docs), andsha256.The server builds the sandbox manifest from the row and reads no local files.
dataset_rootandpdf_analyst_qa_dataset_rootare removed.Validation checks are retained or moved into the row schema:
PdfAnalystQaTaskRow(the seed model andTaskData) rejects rows with areferencewhosetask_idorworkspace_iddoes not match the row, duplicate targets, absolute or..paths, non-PDF paths, or malformed checksums.sha256. The server-side read-only check on local PDFs is gone along with the local store; publishing the PDFs is now the data pipeline's job.The example moves to
data/example/:gym_input.jsonl(one self-contained row) anddocument_store/(its PDF).prepare_example.pyis removed because there is nothing left to copy.Validation
uv run --extra dev pytest environments/pdf_analyst_qa/tests resources_servers/pdf_analyst_qa/tests: 102 passed. New and updated tests cover building the manifest from the row, rejecting nine malformed rows before allocation, and verifying the example row's checksum against its PDF.pre-commit run --files <changed files>: passed (ruff, ruff-format, guardwords, verified flag, environment list).TaskDatawithnormalize_task_fields(tested on a small bundle, and on 32 rows of the full 11,603-task conversion in the rollouts below, none rejected).Rollouts
aac57f253c26). 32 converted rows (16 Treasury, 16 financial) throughpdf_analyst_qa_agentwith OpenCode 1.17.11 and vLLM serving an SFT checkpoint, reading PDFs from the combined S3 prefix. 32/32 rollouts completed, 0 failures, and no rows were rejected by input validation. The sandboxes copied and SHA-256-verified 5,990 PDFs. Reward was 9/32. Median rollout time was 171 s, and the slowest took 261 s.6a2763beca; no conflicts, 102 tests pass) and run with thenemo_gymenvironment on 3 nodes (1 generation, 2 training) at 64k context, for one GRPO step of 4 prompts × 4 rollouts from an SFT checkpoint. All 16 rollouts were scored through NeMo RL, with 0 data failures and 0 infrastructure drops; 12 finished within the context limit. One rollout earned reward 1, and the optimizer step completed with a nonzero gradient (loss 0.035, grad norm 0.135). Getting there took fixes in NeMo RL setup, Megatron-Bridge, and the smoke config, but none in this PR.Compatibility and benchmark impact
Breaking for existing datasets: bundle-based rows (carrying only
task_id,workspace_id, andprompt_version) are rejected at seed time, and configs that setpdf_analyst_qa_dataset_rootmust drop it. Converting a bundle is mechanical: embedtasks/<task_id>.jsonasreference, and combinedocuments.jsonwith each PDF'ssha256asdocuments, wherepathnames the PDF under the bucket prefix. Runs that pin an earlier Gym revision are unaffected. Grading and rewards are unchanged, so there is no benchmark impact.Checklist
pre-commit run --all-files) (so CI lint/format checks pass). Run on the changed files only.git commit -s) (so the DCO check passes).