Skip to content

feat: add native typed decision training components - #314

Open
Liuchenbing-2026 wants to merge 2 commits into
modelscope:mainfrom
Liuchenbing-2026:decision_system1_training
Open

Liuchenbing-2026 wants to merge 2 commits into
modelscope:mainfrom
Liuchenbing-2026:decision_system1_training

Conversation

@Liuchenbing-2026

Copy link
Copy Markdown

PR type

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

PR information

Add typed-decision training and scoring through Twinkle's TransformersModel, InputProcessor, Loss, metric and PEFT interfaces. Decision outputs are probabilities over each question's legal candidates, rather than generated answers.

The components cover generic tokenizer-derived verbalizers, JEV verbalizer heads, Clef joint schema heads, OmniJev cached option branches and StartLux candidate projections. The local recipe supports soft-label cross-entropy, Brier and ordered RPS presets, explicit Open-Jev normalization, training-only augmentation, adapter/head persistence and per-question accuracy. An offline tiny checkpoint/data generator makes the training/recovery path reproducible without model downloads. Community Components entries and a cookbook describe setup and scope.

Scope is intentionally explicit: the recipe is single-device; packing and sequence/context parallelism are rejected. Clef image encoding is not included. Full JEV/Clef/OmniJev released-checkpoint numerical and visual benchmark validation is pending; the tests below do not establish those models' benchmark scores.

This branch includes the persistent-buffer checkpoint fix submitted separately in #313; it is required for complete saved-head state. AI assistance was used for implementation and tests; source attribution is retained in reused numerical modules.

Experiment results

  • python -m pytest tests/decision tests/transformers/test_adapter_persistent_buffers.py -q --confcutdir=tests: 30 passed.
  • Four loss presets and gradients match independent unpadded formulas at rtol=atol=1e-12 on CPU.
  • Tests cover uneven question counts, target exclusion, candidate-order remapping, option subsampling, calibration loading, head gradients, adapter/head persistence, media payloads and malformed inputs.
  • Native one-NPU tiny-model workflow: 3 updates, checkpoint save, optimizer/model recovery to 6 updates, adapter reload and scoring. Also checked weights-only adapter continuation.
  • Native one-NPU StartLux-4B workflow: two updates, checkpoint save and reload/scoring on two synthetic requests. This is an engineering smoke test, not a held-out quality result or evidence of training benefit.
  • pre-commit run --all-files: passed.
  • Environment: Python 3.12, Torch 2.10.0, torch-npu 2.10.0.post4, Transformers 5.14.1, PEFT 0.19.0. Full released-model accuracy, multi-rank recovery and performance remain separate validation work.

Signed-off-by: liuchenbing <chenliumail@163.com>
Signed-off-by: liuchenbing <chenliumail@163.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.

2 participants