Transformers adds Reflection AI’s Beam and loads models on PyTorch 2.7 again

3 weeks ago

Transformers v5.20.1 and v5.20.2: Reflection AI's Beam model, from_pretrained working again on PyTorch 2.7, generate fixes for vision-language and encoder-decoder models, and real expert gradients in bfloat16 MoE training. https://github.com/huggingface/transformers/releases/tag/v5.20.1 https://github.com/huggingface/transformers/releases/tag/v5.20.2 https://huggingface.co/docs/transformers/main/en/model_doc/beam

Ask about this presentation

Chapters

  1. 0:00Beam
  2. 0:16Beam hardware
  3. 0:33Reasoning effort
  4. 0:49PyTorch 2.7
  5. 1:06generate across devices
  6. 1:22Vision-language models
  7. 1:40Expert gradients
  8. 1:57Smaller fixes
  9. 2:15Release notes
Show transcript
  1. Transformers now runs Beam, the first open-weight model from Reflection AI. It's a mixture of experts with 501 billion parameters, 23 billion of them active per token, built for coding, reasoning and agent work.

    Slide text
    Transformers
    01 02 03 New model
    huggingface/transformers · release v5.20.1 · PR #49664

    Transformers now runs Beam, Reflection AI’s open-weight model

    501B parameters 23B active per token Coding and agents
    Beam by Reflection AI, the image from the v5.20.1 release notes
  2. The BF16 checkpoint is about a terabyte. The examples shard it across eight GPUs with expert parallelism, which puts whole experts on each device. That beats device_map auto, which can run out of memory while loading.

    Slide text
    Transformers
    01 02 03 New model
    Transformers docs · Beam model page · PR #49664

    Beam needs eight GPUs and about a terabyte

    torchrun --nproc-per-node 8 script.py
    DistributedConfig(tp_size=8, ep_size=8)
  3. Beam reasons before every answer, and a reasoning effort setting in the chat template controls how much. It runs from minimal up to max, the default. If the token limit runs out mid-reasoning, you get thinking and no answer.

    Slide text
    Transformers
    01 02 03 New model
    Transformers docs · Beam model page · PR #49664

    You set how long Beam thinks

    minimal 8
    low 32
    medium 64
    high 128
    xhigh 256
    max 512 · default

    Text only · a token limit hit mid-reasoning returns thinking and no answer

  4. On PyTorch 2.7, every from_pretrained call in 5.20.0 failed with this missing module error. Loading works again, and so does tensor-parallel loading on 2.6 and 2.7. Distributed checkpointing now needs PyTorch 2.8.

    Slide text
    Transformers
    01 02 03 Fixed
    huggingface/transformers · release v5.20.1 · PRs #49652, #49657

    from_pretrained works on PyTorch 2.7 again

    ModuleNotFoundError: No module named
    'torch.distributed.checkpoint.hf_storage'
    Tensor-parallel loading fixed on 2.6 and 2.7 Distributed checkpointing needs 2.8
  5. Since 5.20.0, generate crashed for encoder-decoder models and some vision-language models whenever the input IDs sat on a different device from the model. It was rebuilding their encoder outputs as plain dictionaries. It keeps their type now.

    Slide text
    Transformers
    01 02 03 Fixed
    huggingface/transformers · release v5.20.2 · PR #49731 · issue #49699

    generate stops crashing when inputs sit on another device

    Encoder-decoder models encoder outputs lost their type
    Vision-language models passing multimodal encoder outputs
  6. Eight vision-language models, including Qwen3.5 and Muse Spark, declared text as their only input, so generate treated them as text-only. They take the multimodal path now. Aria, Inkling and PaddleOCR-VL have the same bug and still need their own fix.

    Slide text
    Transformers
    01 02 03 Fixed
    huggingface/transformers · release v5.20.2 · PR #49677

    Eight vision-language models now take generate’s image path

    Exaone 4.5 GLM-5 Next Muse Glimmer Muse Spark Qwen3.5 Qwen3.5-MoE Qwen4-Exp Step3p7

    Still waiting: Aria, Inkling and PaddleOCR-VL need their own fix

  7. With expert parallelism under FSDP2, and an expert group smaller than the FSDP group, bfloat16 expert gradients came back as zero, so the experts never learned. They get real gradients now.

    Slide text
    Transformers
    01 02 03 Fixed
    huggingface/transformers · release v5.20.2 · PR #49688

    Mixture-of-experts layers train again in bfloat16

    Who it hit expert parallelism under FSDP2, expert group smaller than the FSDP group
    What happened every expert gradient came back as zero
  8. HunYuan-VL gives each beam its own image in batched generation. DeepSeek V4 with the DeepGEMM Mega MoE kernel runs under expert parallelism instead of failing on its first forward pass. And Gemma 4 audio stops forcing a GPU sync on every mask.

    Slide text
    Transformers
    01 02 03 Fixed
    huggingface/transformers · release v5.20.1, v5.20.2 · PRs #49557, #49428, #49684

    Fixes for HunYuan-VL, DeepSeek-V4 and Gemma 4 audio

    HunYuan-VL each beam gets its own image in batched generation
    DeepSeek-V4 on Mega MoE runs under expert parallelism instead of failing on the first forward pass
    Gemma 4 audio masks stop forcing a GPU sync, which broke vLLM’s tests
  9. The full list of fixes is in the release notes for 5.20.1 and 5.20.2 on GitHub. Which PyTorch version is your training setup pinned to?

    Slide text
    Transformers
    01 02 03 Release notes
    huggingface/transformers · release v5.20.1 · release v5.20.2

    Which PyTorch version is your training setup pinned to?

    Full list: the Transformers v5.20.1 and v5.20.2 release notes on GitHub

What happened in AI today, in your inbox

One short email each evening. Read it and you’re caught up.

Built with ❤️ in New York