Skip to content

nnue_train: LayerStack raw checkpointからのdense QAT追加学習 - #413

Merged
SH11235 merged 2 commits into
mainfrom
feat/layerstack-dense-qat
Sep 13, 2026
Merged

SH11235 merged 2 commits into
mainfrom
feat/layerstack-dense-qat

Conversation

@SH11235

@SH11235 SH11235 commented Sep 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

既存の1536×16×32・3072×16×32 LayerStack raw checkpointから、通常追加学習とdense QAT追加学習を同じ開始点で比較できるようにします。layerstack --qat off|denseを追加し、既定OFFの既存経路を維持します。

native CUDAのdense forwardでexport/rshogiのscale・丸め・clip・整数MAC・負値を含むsquare activation・skipを再現し、backwardにはSTEを使います。L1 sharedは合成後に一度量子化し、norm-loss・optimizerと保存前にはFP32 masterを復元します。norm-lossはmaster復元後・optimizer更新前に適用し、精度診断の適用前snapshotを保持します。FT weight/factorizer/accumulatorと最終FV_SCALE除算は対象外の部分QATです。NNUE export formatと推論architectureは変更しません。

raw v10に有効なQATモードを保存します。resume時は指定省略で継承、明示的な--qat off|denseで切替可能です。旧rawはOFFとして読み込み、experimentのparams.qatに有効値を記録します。cuda-oxide/oxide-parity、rescore、PSQT、L2/L3 shared-deltaとの併用はエラーにします。対応範囲と短期比較手順はdocs/dense-qat.mdに記載しました。

Validation

  • WSL Ubuntu 24.04 / RTX 5090: RUST_TEST_THREADS=1 bash scripts/local-ci.sh(fmt、全workspace clippy、backend matrix、kernel build、native/oxide parity、release tests)

  • Windows native CUDA: workspace release tests、clippy、QAT targeted tests

  • 1536/3072 integer reference・export roundtrip、丸め/負値/clip境界、shared合成、skip、STE、FT factorizer、同一rawからOFF/Dense再開、raw後方互換、metadata、FP16/TF32短期smoke

  • 独立ローカルレビュー: Codex APPROVE / Claude APPROVE

  • norm-loss回帰: data gradient/weight decayをゼロにして全dense/shared/biasのmaster補正を計算式と照合。QAT OFF/Dense、診断ON/OFF、selected/unselected step、Lookahead境界、factorizer foldを検証。元の処理順ではL1 masterの補正が消えるassertionで失敗し、修正版では成功。

Integration notes

build identity・精度診断を含むmain (0bdda3ec4831bf9758a31061c30d4ae08ba36acc) を取り込み済みです。Params.trainer_build・trainer_backend・qatを保持し、kernel inventoryはLayerStack 71 / production 87 / CUDA exports 91、QATソースの走査includeも保持しています。

QAT固有の統合箇所はcli.rsのLayerstackArgs、training.rsのbuilder引数、experiment.rsのParams.qat、ckpt.rsのraw v10追加フィールドです。学習来歴側でraw versionを変更する場合はversionとフィールド順を調整してください。

本格学習・対局評価は実施していません。

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 13, 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-09-13T05:41:30.962514Z faa894d PR opened
ℹ️ 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: faa894d3e5

ℹ️ 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".

// を維持しつつ前進するので、現行値を pin して意図しない変更を検出する。
assert_eq!(&RAW_CKPT_MAGIC, b"RNRC");
assert_eq!(RAW_CKPT_VERSION, 9);
assert_eq!(RAW_CKPT_VERSION, 10);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep the compatibility comment in sync with version 10

Now that this assertion pins raw-checkpoint version 10 and the reader accepts versions 1..=10, the immediately preceding comment still describes the compatibility contract as accepting only 1..=9. This makes the format guard misleading when it is consulted during the next version bump; update the documented range to include version 10.

AGENTS.md reference: AGENTS.md:L52-L53

Useful? React with 👍 / 👎.

@SH11235
SH11235 merged commit 14147c2 into main Sep 13, 2026
1 check passed
@SH11235
SH11235 deleted the feat/layerstack-dense-qat branch September 13, 2026 12:10
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