Skip to content

Deprecate unused DeepSpeed features - #8490

Merged
pengdurice merged 5 commits into
masterfrom
deprecate-unused-features
Sep 12, 2026
Merged

pengdurice merged 5 commits into
masterfrom
deprecate-unused-features

Conversation

@sfc-gh-truwase

Copy link
Copy Markdown
Collaborator

Summary

  • Remove unused / unmaintained features: Nebula checkpointing, the deepspeed.compression library, 1-bit Adam, 1-bit Lamb, 0/1 Adam, and MiCS ZeRO-3 sharding.
  • Keep remaining runtime intact: move recursive_getattr / recursive_setattr into deepspeed/utils/module_utils.py after the compression helper was deleted.
  • Tracking: Deprecate unused DeepSpeed features #8489

Test plan

  • GPU import probe: editable DeepSpeed from this checkout; MiCS_Init and mics_* config fields absent
  • tests/unit/runtime/zero/test_zero_context.py (gathered params / partition)
  • tests/unit/v1/zero/test_zero.py::TestZero3RepeatForwardLoop
  • tests/unit/v1/moe/test_autoep_unit.py::TestAutoEPConfig ZeRO-3 compatibility gates
  • CI unit / accelerator workflows on this PR

Made with Cursor

- Nebula
- Compression
- 1bit Adam
- 1bit Lamb

Signed-off-by: Olatunji Ruwase <[email protected]>
Signed-off-by: Olatunji Ruwase <[email protected]>
Signed-off-by: Olatunji Ruwase <[email protected]>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 55fe3ee9a3

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines 530 to +533
def get_eigenvalue_config(param_dict):
if get_quantize_enabled(param_dict):
quantize_training_params = param_dict.get('quantize_training')
if quantize_training_params is None:
return (
EIGENVALUE_ENABLED_DEFAULT,
EIGENVALUE_VERBOSE_DEFAULT,
EIGENVALUE_MAX_ITER_DEFAULT,
EIGENVALUE_TOL_DEFAULT,
EIGENVALUE_STABILITY_DEFAULT,
EIGENVALUE_GAS_BOUNDARY_RESOLUTION_DEFAULT,
EIGENVALUE_LAYER_NAME_DEFAULT,
EIGENVALUE_LAYER_NUM_DEFAULT,
)

assert not get_eigenvalue_enabled(quantize_training_params), "Eigenvalue based MoQ is temporarily disabled"
return (
get_eigenvalue_enabled(quantize_training_params),
get_eigenvalue_verbose(quantize_training_params),
get_eigenvalue_max_iter(quantize_training_params),
get_eigenvalue_tol(quantize_training_params),
get_eigenvalue_stability(quantize_training_params),
get_eigenvalue_gas_boundary_resolution(quantize_training_params),
get_eigenvalue_layer_name(quantize_training_params),
get_eigenvalue_layer_num(quantize_training_params),
)
else:
return (
EIGENVALUE_ENABLED_DEFAULT,
EIGENVALUE_VERBOSE_DEFAULT,
EIGENVALUE_MAX_ITER_DEFAULT,
EIGENVALUE_TOL_DEFAULT,
EIGENVALUE_STABILITY_DEFAULT,
EIGENVALUE_GAS_BOUNDARY_RESOLUTION_DEFAULT,
EIGENVALUE_LAYER_NAME_DEFAULT,
EIGENVALUE_LAYER_NUM_DEFAULT,
)
return (
EIGENVALUE_ENABLED_DEFAULT,
EIGENVALUE_VERBOSE_DEFAULT,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Reject removed MoQ configurations instead of silently disabling them

When an existing configuration contains quantize_training or compression_training, this unconditional default now allows initialization to proceed with eigenvalue scheduling and compression disabled, so users following the still-published docs/_tutorials/MoQ-tutorial.md can run an entire experiment without the requested quantization. The remaining runtime tests also continue to accept these configuration keys; either reject the removed keys explicitly or remove the obsolete documentation and tests so this cannot silently change experimental results.

AGENTS.md reference: AGENTS.md:L21-L21

Useful? React with 👍 / 👎.

Comment thread CODEOWNERS
/deepspeed/checkpoint/ @tjruwase
/deepspeed/comm/ @guanhuawang
/deepspeed/compression/ @tjruwase

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add the required sign-off to this commit

Commit 6bf6ee9878a78783ff6b0506dc6366a8be6f8d45 is a non-merge commit, but its message contains no Signed-off-by trailer, so it does not satisfy the repository's mandatory DCO-style commit requirement.

AGENTS.md reference: AGENTS.md:L8-L8

Useful? React with 👍 / 👎.

Comment thread docs/code-docs/source/optimizers.rst Outdated
@@ -15,14 +15,3 @@ FusedLamb (GPU)
----------------------------
.. autoclass:: deepspeed.ops.lamb.FusedLamb

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Remove the extra newline that fails pre-commit

This file ends with two newline characters; git diff --check 6bf6ee9^ 6bf6ee9 reports docs/code-docs/source/optimizers.rst:17: new blank line at EOF, and the configured end-of-file-fixer hook would modify it. The changed files therefore cannot have passed the required pre-commit invocation in their committed form.

AGENTS.md reference: AGENTS.md:L9-L10

Useful? React with 👍 / 👎.

sfc-gh-truwase and others added 2 commits September 11, 2026 21:24
MiCS is no longer a supported path; drop the optimizer, config fields, and tests so the deprecation matches the other retired features.

Signed-off-by: Olatunji Ruwase <[email protected]>
Raise at parse time for nebula, compression, and MiCS keys so they are not silently ignored, and keep a compression.helper import shim for DeepSpeed-Chat.

Signed-off-by: Olatunji Ruwase <[email protected]>
Co-authored-by: Cursor <[email protected]>
@sfc-gh-truwase
sfc-gh-truwase force-pushed the deprecate-unused-features branch from 55fe3ee to 1efd402 Compare September 11, 2026 21:24
@pengdurice
pengdurice added this pull request to the merge queue Sep 11, 2026
Merged via the queue into master with commit 71d316d Sep 12, 2026
13 checks passed
@pengdurice
pengdurice deleted the deprecate-unused-features branch September 12, 2026 00:01
@sfc-gh-truwase sfc-gh-truwase mentioned this pull request Sep 12, 2026
10 of 25 tasks
@pengdurice pengdurice mentioned this pull request Sep 13, 2026
4 tasks
pengdurice pushed a commit to pengdurice/DeepSpeed that referenced this pull request Sep 17, 2026
Follow up deepspeedai#8490 with further cleanup of the compression-related
leftovers tracked in deepspeedai#8489:

• Remove legacy 1-bit communication backends, CuPy compression helpers,
and XPU packbits support, along with associated tests, setup extras,
dependencies, and CI references.
• Remove MoQ/eigenvalue runtime modules and engine/config wiring.
Explicitly reject legacy  eigenvalue  blocks alongside the existing
 quantize_training  rejection.
• Remove the orphaned fake-quantization Python API, CUDA
kernels/bindings, SUPA wrappers, and build dependencies. Preserve
quantization used by ZeRO++ and inference, and update SUPA compatibility
detection to use the retained  quantize  operator.
• Clean up stale tutorials, navigation entries, monitoring
documentation, image assets, the compression issue template, and
CODEOWNERS references.

---------

Signed-off-by: Hongwei Chen <[email protected]>
pull Bot pushed a commit to dumpmemory/DeepSpeed that referenced this pull request Sep 17, 2026
Remove the `sparse_gradients` flag
Tracking: deepspeedai#8489

## Summary

- Remove the `sparse_gradients` config flag, which compressed **dense**
`torch.nn.Embedding` / `EmbeddingBag` gradients into DeepSpeed's sparse
reduction path.
- Reject the removed key in `_REMOVED_TOP_LEVEL_CONFIG_KEYS` so a
leftover
`sparse_gradients` entry raises `DeepSpeedConfigError` instead of being
silently ignored.
- Drop the `sparse_tensor_module_names` bookkeeping and its checkpoint
field, which existed
  only to serve that flag.
- Sweep the leftover docs, tutorial output, and tests.
- Tracking: deepspeedai#8489

### What the flag did, and why it goes

The flag's entire contribution was the dense-input branch of
`SparseTensor.__init__`:

```python
result = torch.sum(dense_tensor, dim=1)
self.indices = result.nonzero().flatten()
self.values = dense_tensor[self.indices]
```

It selected rows whose values **sum** to something non-zero, so a row
like `[1.0, -1.0]`
was discarded as empty even though it carries a real gradient. That
silently dropped updates.

`config-json.md` has described the feature as "essentially deprecated as
we don't see use
cases for it as much anymore" since deepspeedai#1418 (Sept 2021), and
`deepspeed/runtime/zero/` contains no
sparse handling at all, so the flag never worked together with ZeRO.

### What is deliberately NOT removed

**Sparse gradient reduction still works at ZeRO stage 0.** A model that
builds
`torch.nn.Embedding(..., sparse=True)` itself produces a natively sparse
gradient, and that
still reaches the full DeepSpeed sparse path.

Byte-identical in this PR:

- `split_half_float_double_sparse`
- `sparse_allreduce`, `sparse_allreduce_bucket`, `sparse_all_gather`
- the `if grad_data.is_sparse:` guard and the `SparseTensor(param.grad)`
call itself

Simplified, but behavior-preserving for a sparse gradient:

- `sparse_allreduce_no_retain` drops an `else` branch that densified and
copied back. A
`SparseTensor` is now only ever built from an already-sparse gradient,
so `is_sparse` is
  always true and that branch was unreachable.
- `SparseTensor.__init__` drops its dense-input branch in favor of an
assertion, and
`to_dense()` goes with it, since that removed `else` branch was its only
caller.

Both remaining sparse tests are kept and still cover that path. They
already built
`EmbeddingBag(..., sparse=True)`, so the only change to them is dropping
the now-rejected
`"sparse_gradients": true` line from their config.

The single construction site is `engine.py`:

```python
grad_data = param.grad.data
if grad_data.is_sparse:
    grad_data = SparseTensor(param.grad)
```

Reached through `backward()` or `step()` → `allreduce_gradients()` →
`buffered_allreduce_fallback()` → `_get_gradients_for_reduction()`. All
of the gates in
`allreduce_gradients` must pass, which in practice means: DeepCompile
inactive, ZeRO stage 0,
and a gradient accumulation boundary. ZeRO stages 1, 2, and 3 all divert
to the ZeRO optimizer
before that line.

**Open question for review.** Because it only works at ZeRO stage 0,
that whole path is a
candidate for deprecation too. Doing so would remove `sparse_tensor.py`,
`split_half_float_double_sparse`, the four `sparse_allreduce*` methods,
`sparse_all_gather`,
and the two remaining sparse tests. This PR deliberately leaves that
decision open rather
than bundling it.

Three `SparseTensor` members now have no caller anywhere: `add()`,
`sparse_size()`, and
`type()`. They are independent of the removed flag and are left for a
separate dead-code pass.

### Behavior changes

| Before | After |
|---|---|
| `"sparse_gradients": true` compressed dense embedding gradients |
raises `DeepSpeedConfigError` |
| `"sparse_gradients": false` parsed and did nothing | raises
`DeepSpeedConfigError` |
| `Embedding(sparse=True)` reduced sparsely at ZeRO stage 0 | unchanged
|
| checkpoints carried a `sparse_tensor_module_names` field | no longer
written |

Presence of the key raises regardless of its value, matching how deepspeedai#8490
treats
`mics_hierarchical_params_gather`, also a boolean whose default is
`False`.

A checkpoint written by an older release still loads. Its leftover
`sparse_tensor_module_names` key is no longer recognized, so it now
appears in the
`client_state` returned by `load_checkpoint` rather than being filtered
out.

## Test plan

Run with `slurm_scripts/test_deprecate_sparse_gradients.slurm` (1 node,
2 GPUs). The job
asserts that the branch under test is the tree actually imported before
running anything.

- [ ] `tests/unit/runtime/test_ds_config_dict.py` — the new
`test_sparse_gradients_config_is_rejected`, plus the four existing
removed-key tests
      as a regression check on `config.py`
- [ ] `tests/unit/runtime/sparse_tensor/` — sparse reduction at ZeRO
stage 0 still correct
      with the config key gone
- [ ] `tests/unit/checkpoint/test_latest_checkpoint.py`,
      `tests/unit/checkpoint/test_lr_scheduler.py` — cover the edited
      `tests/unit/checkpoint/common.py` helper
- [ ] CI unit / accelerator workflows on this PR

## Diffstat

```
 deepspeed/runtime/config.py                            | 10 +--
 deepspeed/runtime/constants.py                         |  4 -
 deepspeed/runtime/engine.py                            | 55 ++-----------
 deepspeed/runtime/sparse_tensor.py                     | 20 ++---
 deepspeed/runtime/utils.py                             |  5 +-
 docs/_pages/config-json.md                             |  6 --
 docs/_tutorials/cifar-10.md                            |  1 -
 tests/unit/checkpoint/common.py                        |  1 -
 tests/unit/checkpoint/test_sparse.py                   | 88 ----------------
 tests/unit/runtime/sparse_tensor/test_csr.py           | 55 -------------
 .../sparse_tensor/test_averaging_sparse_gradients.py   |  4 +-
 tests/unit/runtime/sparse_tensor/test_sparse_grads.py  |  4 +-
 tests/unit/runtime/test_ds_config_dict.py              | 10 +++
 13 files changed, 34 insertions(+), 229 deletions(-)
```

Two deleted test files asserted only on removed members:
`test_sparse.py` on
`sparse_tensor_module_names`, and `test_csr.py` on the dense constructor
and `to_dense()`.

Signed-off-by: pengdurice <[email protected]>
Chroma01 pushed a commit to Chroma01/DeepSpeed that referenced this pull request Sep 22, 2026
As part of deepspeedai#8489, this PR removes the stale `test_compression.py` entry
from the HPU Gaudi2 unit-test list. The legacy compression test was
removed in deepspeedai#8490, but the workflow still referenced it. This keeps the
CI selection aligned with the current repository contents without
changing runtime code.

@sfc-gh-truwase, could you please review when convenient? Thank you.

Signed-off-by: nathon-lee <[email protected]>
@auto-pr-labeler-with-jev auto-pr-labeler-with-jev Bot added the skip-gpu-test Requires positive evidence that every changed behavior can be validated without a GPU. label Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-gpu-test Requires positive evidence that every changed behavior can be validated without a GPU.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants