Skip to content

feat: add Intern-Decision text training cookbook on Ascend - #295

Draft
Liuchenbing-2026 wants to merge 5 commits into
modelscope:mainfrom
Liuchenbing-2026:intern_decision_4b_npu_pr
Draft

Liuchenbing-2026 wants to merge 5 commits into
modelscope:mainfrom
Liuchenbing-2026:intern_decision_4b_npu_pr

Conversation

@Liuchenbing-2026

@Liuchenbing-2026 Liuchenbing-2026 commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

PR type

  • New Feature
  • Document Updates
  • More Models or Datasets Support

PR information

Add a text-only Qwen3.5-4B Intern-Decision training cookbook for four Ascend NPUs. Joint questions use a complete JSON skeleton and <decision> markers; answer tokens appear only in labels. Unlike HF causal loss, Twinkle's external cross-entropy does not shift labels, so this adapter shifts supervision exactly once during encoding.

The cookbook contains a decision processor that selects supervised output positions while retaining full-vocabulary cross-entropy, deterministic case-level preparation, frozen-vision/full-language training, validation accounting, and save/reload checks. FSDP2 optimizer state is saved with PyTorch distributed checkpointing; resharding before export preserves optimizer parameter identities. The final model is saved before validation so a later validation error does not discard completed training.

The cookbook is listed in Community Components and uses the existing TransformersModel/InputProcessor APIs rather than adding a duplicate Qwen architecture. Repository-wide dependencies are unchanged: the earlier NumPy lower-bound relaxation has been removed. Historical device validation used NumPy 1.26.4 through an explicit no-deps install, outside the upstream NumPy >=2.0 requirement; a dependency-compliant NPU run remains pending. The guide distinguishes that limitation, and launch paths/device assignment are configurable.

No datasets, weights, private machine details or raw predictions are committed. Public Typed Decisions cases are split independently for training, validation and calibration; the test split is not used for training or selection. This is an Intern-Decision method reproduction, not StartLux training or a reproduction of the unpublished original training corpus. AI assistance was used in implementation, testing and documentation.

Experiment results

Checks on the PR source:

uvx pre-commit run --files README.md $(git diff --name-only upstream/main...HEAD)
PYTHONPATH="$PWD/src" "$PYTHON_BIN" -m pytest tests/processor/test_intern_decision.py -q
cd cookbook/transformers/intern_decision_npu
PYTHONPATH="$TWINKLE_SOURCE/src:$PWD" "$PYTHON_BIN" -m twinkle_adapter.check_contract --output "$NEW_AUDIT_PATH"
  • Seven standard-directory CPU pytest cases passed: no target leakage, one causal shift, malformed-target and truncation rejection, supervised-token counting, and actual processor/CE loss-gradient equivalence. No model or dataset download is required.
  • Three launch argument checks passed without starting training.
  • Applicable pre-commit hooks passed; the repository configuration excludes cookbook Python from flake8/isort/yapf. Python syntax and shell syntax checks passed separately.
  • Real tokenizer/processor contract passed for 1,600 cases and 8,000 supervised fields, including answer exclusion from input and single causal shift.
  • Selected-position loss and gradients match dense causal cross-entropy at rtol=atol=1e-12.
  • Label counting covers both Python rows and singleton tensor rows. The check runs on CPU and explicitly overrides only test device placement; it is not an NPU training test.

Historical four-NPU validation at 6e4a8bc3acec1323f7e7ba5bb0935263800876e0: short training, optimizer-state resume, 120-step training, final model reload and seven-suite evaluation completed. Optimizer moments and step restoration were checked exactly in a separate four-rank test. The trained model remained below the official aggregate quality target; final metrics and raw predictions remain local.

Keep this PR draft pending upstream CI/review and device validation of the final PR head. Full training was not repeated for this submission. Images, sequence parallelism, cross-example packing and 35B training are outside the validated scope.

@Liuchenbing-2026 Liuchenbing-2026 changed the title feat: add Intern-Decision 4B training cookbook on Ascend feat: add Intern-Decision text training cookbook on Ascend Oct 8, 2026
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.

2 participants