sgl-project/sglang · warning · DeprecationWarning
sglang.srt.layers.attention.nsa is deprecated; use sglang.sr
Error message
sglang.srt.layers.attention.nsa is deprecated; use sglang.srt.layers.attention.dsa instead.
What it means
Importing sglang.srt.layers.attention.nsa raises a DeprecationWarning at import time because the package is now a thin re-export shim over sglang.srt.layers.attention.dsa. All symbols still resolve via star-import, so code works, but the shim will be deleted.
Source
Thrown at python/sglang/srt/layers/attention/nsa/__init__.py:5
# [Deprecated] attention/nsa/ is a thin re-export shim for backward compatibility.
# Use attention/dsa/ instead. This directory will be removed in a future release.
import warnings
warnings.warn(
"sglang.srt.layers.attention.nsa is deprecated; "
"use sglang.srt.layers.attention.dsa instead.",
DeprecationWarning,
stacklevel=2,
)
from sglang.srt.layers.attention.dsa import * # noqa: F401, F403
View on GitHub (pinned to 0132848349)
Solutions
- Rewrite imports to use sglang.srt.layers.attention.dsa
- Grep the codebase for 'attention.nsa' and update all matches
- Run with -W error::DeprecationWarning in CI to surface latent imports
Example fix
# before from sglang.srt.layers.attention.nsa import NativeSparseAttnBackend # after from sglang.srt.layers.attention.dsa import NativeSparseAttnBackend
Defensive patterns
Strategy: validation
Validate before calling
import importlib, warnings
with warnings.catch_warnings():
warnings.simplefilter("error", DeprecationWarning)
importlib.import_module("my_pkg") # surfaces legacy nsa imports Type guard
def uses_deprecated_nsa(module_source: str) -> bool:
return "attention.nsa" in module_source Prevention
- Grep for attention.nsa after upgrades
- Import-time DeprecationWarning-as-error in CI
When it happens
Trigger: Any 'import sglang.srt.layers.attention.nsa' or 'from sglang.srt.layers.attention.nsa import ...' statement, including transitive imports from third-party patches or old code.
Common situations: Custom model files or monkey-patches importing from the old nsa path; upgrading sglang in a repo with vendored attention code.
Related errors
- attention-backend='nsa' is deprecated; use 'dsa' instead. Th
- sglang.srt.layers.attention.nsa.dequant_k_cache is deprecate
- sglang.srt.layers.attention.nsa.index_buf_accessor is deprec
- sglang.srt.layers.attention.nsa.transform_index is deprecate
- sglang.srt.layers.attention.nsa.nsa_backend_mtp_precompute i
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/ad5e965f660d930b.
Report an issue: GitHub.