Skip to content

[Feature] Multi-image Jev/Clef decision model training and prediction on PyTorch/CUDA #13461

Closed

Description

@resnant

Feature request

Please support image-conditioned Clef/Jev-style decision model training and prediction on the PyTorch/CUDA backend, including multiple images per record.

The desired workflow is the one in the decision model tutorial, with an additional images field.

Related work

Is there an existing plan or tracking issue for equivalent PyTorch/CUDA support?

Current behavior observed in the source

I inspected unsloth/models/decision.py at commit c6db48dd3859e8eaa73fdee3b599b321f29d0bea:

  • _clef_items() passes only state and questions to encode_record(), dropping a top-level images field.
  • ClefDataCollator does not propagate the image tensors.
  • ClefDecisionModel.forward() selects the inner language model and does not forward image inputs.
  • The PyTorch FastDecisionModel.predict() signature has no images argument.

As a result, selecting a vision-language backbone does not by itself enable image-conditioned decision training. An image column can be ignored while text-only training proceeds.

Desired interface

Illustrative input, using already loaded PIL images:

row = {
    "state": "The images are ordered from oldest to newest, one second apart.",
    "images": [frame_0, frame_1, frame_2],
    "questions": {
        "motion": {
            "type": "choice",
            "instructions": "How does the object move across these frames?",
            "criteria": {
                "left": "It moves to the left.",
                "right": "It moves to the right.",
                "stationary": "It stays in the same position.",
            },
        },
    },
    "gold": {"motion": "right"},
}

items, report = FastDecisionModel.build_dataset([row], processor, model)

# Desired CUDA API, matching the MLX interface:
answers = FastDecisionModel.predict(
    model, processor, row["state"], row["questions"], images=row["images"]
)

Expected scope

  • Preserve images through preprocessing, batching, the multimodal forward pass, and the Clef joint schema head.
  • Support multiple images per record, preserving their order.
  • Keep images available during evaluation/calibration and question permutation.
  • Save/reload the processor and required vision components for image-conditioned prediction.
  • Until supported, raise a clear error or warning for image-bearing rows rather than silently training without images.

An initial implementation restricted to Qwen3.5-based Clef models with a frozen vision tower would already cover the requested workflow.

Thanks for the decision model support and the MLX implementation!

Activity

  1. changed the title [-][Feature] Multi-image Clef decision model training and prediction on PyTorch/CUDA[/-] [+][Feature] Multi-image Jev/Clef decision model training and prediction on PyTorch/CUDA[/+] on Oct 12, 2026
  2. added
    feature request
    on Oct 12, 2026
  3. self-assigned this
    on Oct 12, 2026
  4. Imagineer99 commented on Oct 12, 2026

    @Imagineer99
    Member

    Can confirm images were getting dropped before reaching the vision tower, trying a fix to carry them through preprocessing, batching and prediction.

  5. danielhanchen commented on Oct 13, 2026

    @danielhanchen
    Member

    Fixed! On PyTorch/CUDA a Clef's images were dropped before reaching the vision tower, so it trained and predicted on text alone. #13471 carries ordered images (one or many per row) through build_dataset, batching, the multimodal forward, evaluation and save / reload, and adds FastDecisionModel.predict(..., images=...), matching the MLX interface.
    To update: uv pip install --upgrade unsloth unsloth_zoo --force-reinstall --no-cache-dir (if it's not in the current release yet it'll be in the next one). Reopen if it still happens.

  6. resnant commented on Oct 13, 2026

    @resnant
    Author

    Thanks for the quick fix! I’ll try it and report back if I run into any issues. Really appreciate your help👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

feature request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions