Skip to content

feat(decision): schema augmentation, generic_decision LLM migration, verbalizer fix - #10317

Open
z0o0ey wants to merge 5 commits into
modelscope:mainfrom
z0o0ey:pr-10306
Open

z0o0ey wants to merge 5 commits into
modelscope:mainfrom
z0o0ey:pr-10306

Conversation

@z0o0ey

@z0o0ey z0o0ey commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR adds three groups of changes to the typed-decision (System-1) subsystem:

1. Decision schema augmentation (DecisionAugmentConfig)

Adds training-time data augmentation for decision task_type datasets:

  • --decision_drop_instructions — randomly drop the question instruction text (layout still rendered), forcing the model to infer intent from options alone.
  • --decision_subsample_options — subsample choice question options to at most N (gold + N-1 distractors), only for choice questions.
  • --decision_state_as_text — randomly flatten dict state to human-readable text instead of JSON, so the model sees different renderings of the same record.
  • --decision_shuffle_fields — shuffle dict state field order and question order in multi-question records.

All options are disabled by default (zero-cost passthrough). Wired through DataArguments, loader.init_decision_augment, and all ScoringPreprocessor subclasses (ClefPreprocessor, JevPreprocessor, OmniJevPreprocessor, OpenJevPreprocessor).

2. Move generic_decision to LLM type

generic_decision loads AutoModelForCausalLM (a text-only model), not a multimodal model. Moved from MLLMModelType / MLLMTemplateType to LLMModelType / LLMTemplateType. This fixes the model registration to match the actual loader behavior.

3. Fix JevVerbalizerHead token resolution

Previously, get_verbalizer_token silently returned ids[0] when a label encoded to multiple tokens, even when only the first token was the intended verbalizer. Now:

  • Only returns the single token when the label encodes to exactly 1 id.
  • Falls back to unk_token_id with a warning explaining the degenerate case (multiple labels collapsing to the same unk id).
  • Error message includes the full token list for debugging.

Also normalizes JEV synonyms: yes/y/1 → true, no/n/0 → false (previously yes and true were distinct).

Files changed

  • swift/arguments/base_args/data_args.py — new CLI args + get_decision_augment_config()
  • swift/dataset/preprocessor/decision.py — DecisionAugmentConfig, augment_decision_row(), wired into ScoringPreprocessor base
  • swift/dataset/loader.py — init_decision_augment() injection
  • swift/dataset/dataset/llm.py — OpenJevPreprocessor synonym normalization + augment passthrough
  • swift/model/constant.py — generic_decision → LLMModelType
  • swift/model/decision_head.py — verbalizer token resolution fix
  • swift/model/models/decision.py — use LLMModelType.generic_decision
  • swift/template/constant.py — generic_decision → LLMTemplateType
  • swift/template/templates/decision.py — use LLMTemplateType.generic_decision
  • swift/dataset/preprocessor/__init__.py — export DecisionAugmentConfig
  • examples/train/decision/dataset.py — remove generic_decision from self-check

hjh0119 and others added 5 commits October 8, 2026 10:27
…OmniJev

Non-generative `decision` task_type: a single forward pass scores every
option into calibrated per-option probabilities. transformers backend only.

- model: ScoringModelLoader + JEV/Clef/OmniJev heads; OmniJev two-stage
  cached branch forward over the hybrid Qwen3.5 backbone + media compose
- template: decision encode/collate (train right- / infer left-padding)
- dataset: unified user schema, per-model preprocessor subclasses
- loss: ScoringLoss + JEV/Clef/OmniJev heads (masked soft-CE + ordinal RPS)
- trainer: ScoringTrainer re-activates and saves the fp32 head under LoRA
- examples/train/decision/{jev,clef,omnijev}.sh + dataset plugin + data
- tests/test_align: four-stage alignment harness vs each official oracle

Aligned to each official inference path: encoding byte-exact, head math
<=1e-7, full forward within bf16 tolerance, loss+grad vs re-derived formula.
… type, fix verbalizer head

- Add DecisionAugmentConfig with drop_instructions, subsample_options,
  state_as_text, shuffle_fields augmentation options for decision datasets
- Move generic_decision from MLLMModelType/MLLMTemplateType to LLMModelType/LLMTemplateType
  (loads AutoModelForCausalLM, not multimodal)
- Fix JevVerbalizerHead token resolution: warn on multi-token labels instead of
  silently using first token; improve error message
- Normalize JEV synonyms: yes/y/1 -> true, no/n/0 -> false
- Wire augment_config through DataArguments, loader, and all decision preprocessors
- Remove generic_decision from self-check dataset list
…dataset pipeline, add BestPractices docs, update alignment tests

This branch has not been deployed

No deployments
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