Skip to content

The default DeepSpeed preset zero2.json sets allgather_bucket_size: "auto", which neither transformers nor accelerate fills, so ZeRO-2 aborts (CR-A16-007) #410

Open

Description

@cemililik

Wave 1 · theme D1-5: Training, merging and export correctness · highest severity High · 1 finding(s) · effort trivial

Summary

An operator enables DeepSpeed with the default preset, and training aborts during accelerator.prepare with a ValueError after model load, on every GPU node.

Primary finding

CR-A16-007 — The default DeepSpeed preset zero2.json sets allgather_bucket_size: "auto", which neither transformers nor accelerate fills, so ZeRO-2 aborts

severity High · reachability default · intent contract-violation · confidence confirmed · independently confirmed · reproduced with stubs

What happens. configs/deepspeed/zero2.json:36 sets "allgather_bucket_size": "auto". transformers' HfTrainerDeepSpeedConfig.trainer_config_finalize fills only reduce_bucket_size, stage3_prefetch_bucket_size and stage3_param_persistence_threshold. accelerate's DeepSpeedPlugin.fill_match raises ValueError for any remaining 'auto' key that is not in its kwargs. zero2 is also the preset used when distributed.deepspeed_config is unset (trainer.py:638-639), so distributed.strategy: deepspeed fails by default. zero3.json and zero3_offload.json resolve fully.

Where.

Evidence.

  • Script w/ds_repro.py runs each preset through transformers' trainer_config_process/finalize (real code; deepspeed is absent, so a subclass is grafted onto accelerate's HfDeepSpeedConfig), then through accelerate's DeepSpeedPlugin.deepspeed_config_process(must_match=False, **kwargs as built in accelerator._prepare_deepspeed). Results for lower (transformers 5.3.0, accelerate 1.4.0), extras (5.13.0/1.14.0) and latest (5.18.0/1.15.0): zero2 leaves 'auto' in zero_optimization.allgather_bucket_size,…

Recommended fix. Replace 'auto' with an integer (for example 5e8) or remove the key from zero2.json. Add a test that runs the presets through the transformers/accelerate auto-fill.

Acceptance criteria

  • A regression test reproduces the failure scenario and asserts the corrected behaviour.
  • Documentation listed above is corrected in English and in its Turkish mirror in the same PR.
  • Every finding in this issue is resolved or explicitly closed with a reason.

Found by the October 2026 ForgeLM code and documentation review against commit cab2947. Code links point at that commit; line numbers may have moved since. Finding IDs (CR-…, DOC-…, TECH-…) are stable references for this backlog.

Activity

  1. added
    bugSomething isn't working
    severity: highWrong behaviour or a false claim users rely on
    source: review-2026-10Found by the October 2026 code and documentation review
    wave: 1Roadmap wave 1: high severity, small effort
    on Oct 9, 2026
  2. cemililik commented on Oct 22, 2026

    @cemililik
    CollaboratorAuthor

    Where to start

    Thanks for taking a look. Claim it by starting a comment with /assign so nobody duplicates the work.

    The bug. configs/deepspeed/zero2.json sets "allgather_bucket_size": "auto" (line 36). transformers fills only reduce_bucket_size, stage3_prefetch_bucket_size and stage3_param_persistence_threshold, and accelerate raises a ValueError for any other "auto" left in the config. zero2 is also the default preset (_resolve_deepspeed_config in forgelm/trainer.py), so distributed.strategy: deepspeed aborts by default. zero3.json and zero3_offload.json are fine.

    What to change (decided).

    1. In zero2.json, set "allgather_bucket_size": 500000000. That is DeepSpeed's own default; keep the key.
    2. Add a CPU-only test to the class TestDeepSpeedConfigResolution in tests/test_distributed.py, next to test_all_presets_use_auto_values.
      • Parametrize it over zero2, zero3 and zero3_offload.
      • Collect the dotted path of every "auto" value in the JSON, and assert that the set is a subset of the keys transformers and accelerate fill. Take that allowlist from HfTrainerDeepSpeedConfig.trainer_config_process / trainer_config_finalize in transformers/integrations/deepspeed.py:
        • train_batch_size, train_micro_batch_size_per_gpu, gradient_accumulation_steps, gradient_clipping;
        • fp16.enabled, bf16.enabled;
        • optimizer.params.{lr,betas,eps,weight_decay};
        • scheduler.params.{warmup_min_lr,warmup_max_lr,warmup_num_steps,total_num_steps};
        • zero_optimization.reduce_bucket_size, zero_optimization.stage3_prefetch_bucket_size, zero_optimization.stage3_param_persistence_threshold.
      • Name the preset and the offending key in the assertion message.
      • Check that it fails on development (it should report zero_optimization.allgather_bucket_size for zero2) and passes after your change.
    3. Remove the now-stale notes, deleting text only (no new Turkish to write):
    4. Add a ### Fixed line under ## [Unreleased] in CHANGELOG.md: the default zero2 preset no longer aborts ZeRO-2 start-up.

    Not in scope: shipping the presets in the wheel. That belongs to a Phase 16 step; please do not link it from the PR. A real ZeRO-2 run needs GPUs, which you do not need here: say in the PR that you verified the config contract on CPU.

    pytest tests/test_distributed.py --no-cov
    python3 tools/check_bilingual_parity.py --strict && python3 tools/check_bilingual_code_blocks.py --strict
    python3 tools/check_usermanual_self_contained.py --strict && python3 tools/check_tr_links_prefer_mirror.py --strict

    Open the PR against development with Fixes #410 (finding CR-A16-007).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: packaging-ciCode area: packaging-cibugSomething isn't workinggood first issueGood for newcomersseverity: highWrong behaviour or a false claim users rely onsource: review-2026-10Found by the October 2026 code and documentation reviewwave: 1Roadmap wave 1: high severity, small effort

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions