Skip to content

Nemotron math - #165

Open
Rette66 wants to merge 11 commits into
qboson:mainfrom
Rette66:nemotron-math
Open

Nemotron math#165
Rette66 wants to merge 11 commits into
qboson:mainfrom
Rette66:nemotron-math

Conversation

@Rette66

@Rette66 Rette66 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

No description provided.

- 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 and others added 5 commits September 3, 2026 18:14
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>
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.

1 participant