Nemotron math - #165
Open
Rette66 wants to merge 11 commits into
Open
Conversation
- score_visible_logits(num_lowest=...) averages only the N lowest-energy candidates - QDiffusion.energy keeps the context facade and forwards only non-None context entries, so context-free models reject context loudly - train() keeps a frozen proposal model in eval mode - remove unused weight/weighting, generate temperature, state history - export SequenceTokenSpec from the package root - normalize file headers; tests updated accordingly
Energy-guided block-diffusion decoding for math reasoning: a frozen Nemotron proposal plus a ContextualEnergyModel (Transformer encoder -> KPP BM 512x256 -> Kaiwu SA). Includes same-state pair collection, outcome-pairwise training with resumable state, versioned checkpoints, and matched Native/BM evaluation with append-only resume. Root .gitignore absorbs the example's local artifact patterns.
Rewrite the private ESM patch around scaled-dot-product attention with signatures mirroring the pinned transformers 4.39.2 internals; drop HF generation hooks, decoder paths, and position resizing while keeping the contact head for strict state_dict compatibility. Declare the optional fair-esm dependency used by the ESM2 distance evaluation.
Add a checkpoint_format field, write via tmp file + os.replace, and validate the payload type, format version, and required state entries on load. Aligns the dplm example with the nemotron checkpoint standard.
…lows - dplm: single train (workflows/train.py) and eval (workflows/esm2_eval.py) entrypoints run via python -m after pip install -e .; remove the re-export shims and sys.path bootstraps, flatten to package imports - dplm: drop manual proposal eval() calls now handled by QDiffusion.train() - dplm: slim the ESM2 evaluation helpers (order-only pairing, lazy esm import with a clear error, single sequence-conditioned generator) - dplm: add missing Google-style docstrings to workflow helpers and model encoders; replace upstream file headers with the project header - simple: import build_qdiffusion through the installed package - README: document the install requirement and module invocations
Fill in full Google-style docstrings (Args/Returns/Raises) across qdiffusion.py; add CHANGES.md walking through the nemotron file layout and summarizing branch-wide changes; allow documented modules to exceed the default line count in pylintrc.
Rette66
force-pushed
the
nemotron-math
branch
from
September 3, 2026 09:07
58f32af to
21b0971
Compare
Revert QDiffusion.energy() to the original three-parameter form: the facade no longer forwards or even knows about context arguments. Contextual scoring is an energy-model capability; the nemotron hook now calls ContextualEnergyModel.score_conditioned directly with named context arguments, while the dplm training path keeps using the context-free energy() entry. Misuse stays loud: context kwargs against a context-free model raise TypeError.
Drop the per-field int/float coercions (both construction paths already pass proper ints) and merge the scattered positivity guards into one check that names the offending hyperparameters and also covers the BM and sampler dimensions. Keep the divisibility check as an explicit ValueError: MultiheadAttention only raises AssertionError, which python -O strips.
score_conditioned already validates context presence, token-shape consistency, and the sequence-length cap; build_visible_logits re-checked the same conditions for its only caller. Move the length cap up and remove the duplicated blocks.
- Improved docstrings across various functions in train.py for clarity and completeness. - Added detailed explanations for parameters and return types in pair_loss, evaluate_rows, and other key functions. - Introduced a new QDIFFUSION_ARCH_REVIEW.md file to document architectural review findings and suggestions. - Created GUIDE.md for a comprehensive overview of the nemotron example, detailing file purposes and workflows. - Updated pylintrc for better code quality checks and adjusted comments for clarity. - Enhanced type hints and imports in simple_generate_example.py for better type safety and readability. - Made minor adjustments to the QDiffusion class to improve code organization and clarity.
The helper was a bare **kwargs passthrough to the SimulatedAnnealingOptimizer constructor with the import already at module top level; __init__ now constructs it directly. GUIDE.md drops the matching row. Co-Authored-By: Claude Code <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.