Repository navigation
Stage-1 v7: Nemotron-Image-Training caption and reasoning sources - #935
Conversation
…ources New `nemotron_image` module: prepares subsets of nvidia/Nemotron-Image-Training-v3/v3.5 (pinned revisions) by fetching each row's image from its upstream copy (Open Images from the CVDF mirror, our cc3m tars and TextCaps on Weka, ECD-10k-Images, DeepVision-103K, the bundled BabyVision synthetic images), and serves them as `"<task tag>: <question>"` examples. - captions: openimages_1/2 and cc3m (`detailed_caption`, filler openings dropped), textcaps_commercial (`text_caption`) - reasoning, `<think>` trace kept: ecd (`chart_reasoning`), deepvision (`visual_logic_reasoning`), babyvision (`visual_perception_reasoning`); rows with an unclosed trace or empty answer are dropped `--recipe.visual_data=stage1_v7`: v6's sources in v6's ratio plus the Nemotron sources at fixed passes over a 20,000-step run (1 over the detailed captions, 2 over the rest), with the vision share's loss per step kept at v6's. Source sizes and means are estimates from the NVIDIA text until the prepared subsets are calibrated.
…image more than once DeepVision-103K's parquet repeats some images byte for byte, so its rows were written once per copy (14,030 rows from 9,818). Shards now skip an image they already emitted, the stats count distinct images, and rows repeated across shards are dropped after sorting by id.
…the referenced images An empty shard fails the final from_parquet (ArrowInvalid: BatchSize must be greater than 0); cc3m has tars with none of NVIDIA's images.
Sorting left an index mapping that save_to_disk resolved by random reads over every image (cc3m: over 30 minutes on Weka without finishing). Shards are named by index and each emits rows in a fixed order, so reading them by name is already deterministic; repeated ids are found from the id column alone.
Rows from the prepared subsets and means from estimate_mean_loss_weights (128 samples, seed 0, dolma2, 65,536 tokens, documents mode). The Nemotron sources take 9.4% of the visual loss (detailed captions 7.45%), the v6 sources keep the rest at 0.906 of their v6 shares.
…d BabyVision's web images - nemotron_fintabnet (table_multihop_reasoning): FinTabNet page PDFs range-read from an HF mirror of the release and rendered - nemotron_hopchain (doc_multihop_reasoning): the CC-MAIN-2021-31 PDF pages each row's image_sources names, range-read from Digital Corpora's zips and rendered - nemotron_raven (matrix_puzzle_reasoning): HuggingFaceM4/RAVEN panels composed into the matrix and A-H options NVIDIA's prompt describes (its RAVEN_<id> is the row id and its answer the row's target on all 12,000 rows checked) - nemotron_babyvision now also fetches the web images its JSONL names by URL sa_finance stays out: its JSONL names images by file name only.
…ion's web images Measured rows and means (128 samples, seed 0). BabyVision grows to 125,875 rows (7% of its web images are gone) with 1,189 loss tokens per draw. The Nemotron sources now take 13.75% of the visual loss (captions 7.5%, reasoning 6.3%); the v6 sources keep 0.8625 of their v6 shares.
…s positions per step v6 moved the loss of the capped PixMo-Cap and PixMo-Count to OCR (39% to 61% of the visual loss) for want of fresh caption data; the Nemotron captions are that data, so v7 now takes the Nemotron share from the OCR group alone (OCR lands at 47%) and leaves caption, pointing, academic and clock sources at their v6 shares. Taking it from every v6 source also cut the position-heavy pointing and academic sets, so the vision share filled 11% fewer positions per step than v6. The Nemotron sources are text-dense (1.4-3.7 positions per response token against 2.5-7 for OCR), so even OCR-funded v7 fills 3% fewer positions per visual loss token. recipe.text_loss_share now defaults per visual data: 0.9, or STAGE1_V7_TEXT_LOSS_SHARE (0.897) for stage1_v7, the share that splits positions per step between text and vision exactly as v6 at 0.9 does, so the text per step and the step time stay v6's. STAGE1_POSITIONS_PER_LOSS_TOKEN records the measured positions.
…ir loss to Nemotron v6 drew the CoSyn sets 8.7-30 times and olmOCR books, LoC and national archives 21-30 times over a 20,000-step run. v7 caps both families at 5 passes (olmOCR documents, at 4.5, is under it), so each comes out even. The 5.5% of the visual loss the CoSyn cap frees goes to the Nemotron detailed captions (1 to 1.74 passes), the 1.6% the olmOCR cap frees to the Nemotron reasoning sets (2 to 2.5 passes; 7.8% of the visual loss, near the 7.5% reasoning traces have in the OLMo 3 text mix). The capped sets were position-heavy, so the solved text loss share falls to 0.883: positions per step between text and vision stay exactly v6's, and the vision share trains about 19% more response tokens in them.
…ir loss to olmOCR documents v6 drew the receipts 28.5 times and TextOCR 19.6 times over a 20,000-step run. The 0.49% of the visual loss the caps free goes to olmOCR documents, the one olmOCR source under its 5-pass cap (4.5 to 4.96 passes). Caps are now per source (STAGE1_V7_PASS_CAPS).
…e text-rich sources The CoSyn cap freed enough for 1.74 passes; the remaining 1.9% of the visual loss comes from the five text-rich OCR sources in their ratio (each about 5% lower, e.g. text_rich_doc 5.7 to 5.4 passes). Pointing is unchanged. Text loss share 0.8824.
…instead of scanning save_to_disk writes Arrow stream files, which have no footer: opening one walks every message, and on Weka that pages in the whole file. The v7 smoke run spent 42 minutes opening the 650 GB of Nemotron data (Open Images alone 21). Prepare now writes batch_index.json (each record batch's byte offset and row count), and the dataset memory-maps the files lazily and decodes only a row's own batch: opening Open Images takes 0.01 s. Subsets without the index fall back to the HF loader; --index-only adds it to subsets already prepared.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d55dcbc404
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| seq = encode_sft_example( | ||
| self.tokenizer, | ||
| image, | ||
| list(zip(prompts, row["responses"])), |
There was a problem hiding this comment.
Preserve multi-turn conversations as one branch
For any row containing multiple user/assistant pairs, this flat list is interpreted by encode_sft_example as multiple independent branches rather than one sequential conversation. Consequently the branches may be shuffled, later questions such as “Why?” lose the preceding turns they depend on, and only the first branch receives the task-style prefix. Pass the zipped turns inside an outer list so each parsed conversation remains a single sequential branch.
Useful? React with 👍 / 👎.
| r"^\s*(of course[.,!]?|based on the image provided,|this is a detailed description of)" | ||
| r"[^\n]*(\n+|$)", |
There was a problem hiding this comment.
Preserve same-line caption text after filler
When a response starts with a filler phrase but continues with its real caption on the same line, such as Of course! A dog is running on a beach., [^^\n]* consumes the entire line; clean_caption then returns None, and preparation silently drops the row. The cleaner should remove only the recognized lead-in (or otherwise retain text following it) instead of requiring the useful caption to begin after a newline.
Useful? React with 👍 / 👎.
…d, PixMo-Count kept v7 has not had a full run, so the revised mix keeps the name. The #935 split stays as v7's base split (STAGE1_V7_BASE_LOSS_TARGETS / STAGE1_V7_BASE_TEXT_LOSS_SHARE). On top of it, in passes over the 22,240-step hero: - PixMo-Points halved (25.4 -> 12.7); PixMo-Count unchanged (13.4). - GUISyn at 12 passes: each element about 3.4 times, as mm_olmo main's Molmo3 stage 1 trains it (split_annotations, 4 epochs of a 424,423-example group before GUISyn joined). - PixMo-Cap, transcripts and TextOCR 13.3 -> 15; the base split's caps of 5 restated over the hero (6.7 -> 5); NVIDIA synthetic OCR and the Nemotron sources to 5. - Text share 0.879: v6's positions per step, the text taking what vision leaves (1.12x v6's text).
Stacked on #916. Adds ten subsets of nvidia/Nemotron-Image-Training-v3/v3.5 to the stage-1 vision mixture as
--recipe.visual_data=stage1_v7. The write-up (subset choice, stage 1/2 split, token accounting) is shared separately.Sources
nemotron_openimages_1detailed_captionnemotron_openimages_2detailed_captionnemotron_cc3mdetailed_captionnemotron_textcapstext_captionnemotron_ecdchart_reasoningnemotron_deepvisionvisual_logic_reasoningnemotron_babyvisionvisual_perception_reasoningnemotron_fintabnettable_multihop_reasoningnemotron_hopchaindoc_multihop_reasoningnemotron_ravenmatrix_puzzle_reasoning<think>trace is trained, as the text mid-training mix trains its traces. Rows whose trace never closes or whose answer is empty are dropped.Data prep
This writes one
save_to_diskdirectory per subset, plus aprepare_stats.json. Images are capped at 1,536 px on the long side.Mixture
Built in two steps (
STAGE1_V7_LOSS_TARGETS):STAGE1_V7_PASS_CAP). v6 drew the CoSyn sets 8.7–30 times and olmOCR books, LoC and national archives 21–30 times; now every one is at 5 (olmOCR documents is already at 4.5). The 5.5% of the visual loss the CoSyn cap frees goes to the Nemotron detailed captions, and the five text-rich OCR sources top them up to exactly 2 passes (STAGE1_V7_NEMOTRON_CAPTION_PASSES) with another 1.9%, in their ratio (each about 5% lower, e.g. text_rich_doc 5.7 → 5.4 passes). The 1.6% the olmOCR cap frees goes to the Nemotron reasoning sets (2 → 2.5 passes). Synthetic receipts are capped at 5 (from 28.5) and TextOCR at 10 (from 19.6); the 0.5% they free goes to olmOCR documents, the one olmOCR source under its cap (4.5 → 4.96 passes).Result: Nemotron captions 14.9% and reasoning 7.8% of the visual loss, close to the ~7.5% share reasoning traces have in the OLMo 3 text mix. OCR is at 43.9% and academic QA at 4.2%. PixMo-Cap, PixMo-Count, PixMo-Points, NVIDIA synthetic OCR, DVQA, FigureQA, PlotQA and clocks keep their step-1 shares; pointing is deliberately untouched.
Positions per step stay v6's. The Nemotron sources are text-dense (1.4–3.7 positions per response token) and the capped CoSyn sets were position-heavy (25–186), so v7 uses 9.6 positions per visual response token against v6's 11.5.
recipe.text_loss_sharenow defaults per visual data: 0.9 as before, orSTAGE1_V7_TEXT_LOSS_SHARE= 0.882 forstage1_v7. That share splits positions per step between text and vision exactly as v6 at 0.9 does, so the text per step and the step time are unchanged, and the vision share trains about 20% more response tokens in the same positions. An explicit--recipe.text_loss_sharestill wins. Measured positions per response token for every source are inSTAGE1_POSITIONS_PER_LOSS_TOKEN.Full
stage1_v7mixShare of the visual loss next to v6 and the Molmo2-Stage1
v3recipe. The visual share is 11.8% of all loss under v7 (text 88.2%) and 10% under v6. The tag is the prefix of every user turn. Passes are over a 20,000-step run (v6's reference length).pixmo_captionlong_captionpixmo_transcripttranscriptpixmo_points_v2pointing, point_countpixmo_count_v2pointing, point_countcosyn_point_v2cosyn_pointtext_rich_docfig_caption_high/_mid/_lowtext_rich_tablefig_caption_high/_mid/_lowtext_rich_chartfig_caption_high/_mid/_lowtext_rich_diagramfig_caption_high/_mid/_lowtext_rich_graphicfig_caption_high/_mid/_lowolmocr_documentsolmocrolmocr_booksolmocrolmocr_national_archivesolmocrolmocr_loc_transcriptsolmocrnvidia_synth_ensynth_ocrsynth_receipts_enreceipt_ocrtextocrtextocrcosyn_chart_expcosyn_chart_expcosyn_table_expcosyn_table_expcosyn_math_expcosyn_math_expcosyn_diagram_expcosyn_diagram_expcosyn_music_expcosyn_music_expcosyn_chemical_expcosyn_chemical_expplot_qaplot_qacosyn_documentcosyn_documentdv_qadv_qafigure_qafigure_qapixmo_clocksclocksnemotron_openimages_1detailed_captionnemotron_cc3mdetailed_captionnemotron_openimages_2detailed_captionnemotron_textcapstext_captionnemotron_babyvisionvisual_perception_reasoningnemotron_fintabnettable_multihop_reasoningnemotron_ecdchart_reasoningnemotron_ravenmatrix_puzzle_reasoningnemotron_deepvisionvisual_logic_reasoningnemotron_hopchaindoc_multihop_reasoningCapped at 5 passes: every CoSyn and olmOCR set and the synthetic receipts; TextOCR at 10. Still above 10: PixMo-Points (19.1), deliberately unchanged.
Status
nemotron_image_test.pyand the v7 recipe test./weka/oe-training-default/jasonr/dataset/nemotron-image.STAGE1_V7_NEMOTRON_SOURCE_SIZES/..._MEAN_LOSS_WEIGHTS(128 samples, seed 0). Nemotron is 22.8% of the visual loss (captions 14.9% at 2 passes, reasoning 7.8%); CoSyn and olmOCR capped at 5 passes; text share 0.882 keeps v6's positions per step.batch_index.json) so subsets open without scanning: the first smoke spent 42 min opening the 650 GB of Nemotron data on Weka; now 0.01 s per subset. Backfilled for all ten subsets.ai2/oe-olmo3p5-mt, scaling-laddersjasonr/mixed-stage1-v7): https://beaker.org/ex/01M5TG7305A773CFCJ14JE1BN5, exit 0, all 38 sources load, CE 0.85 at step 40, no skipped steps, 52.7K tokens/s/GPU, 188 GiB active memory (v6 256K run: 175 GiB).