{"record":{"id":"a8fd84aa8fe31065","repo":"sgl-project/sglang","slug":"lightning-seg-la-linear-attention-backend-does-n","errorCode":null,"errorMessage":"Lightning (seg_la) linear-attention backend does not support speculative decoding with topk > 1 (got topk={self.topk}); seg_la verifies a draft tree as a chain. Use --speculative-eagle-topk 1.","messagePattern":"Lightning \\(seg_la\\) linear-attention backend does not support speculative decoding with topk > 1 \\(got topk=(.+?)\\); seg_la verifies a draft tree as a chain\\. Use --speculative-eagle-topk 1\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/layers/attention/linear/lightning_backend.py","lineNumber":49,"sourceCode":"    - If spec decoding\n        - FlashAttentionBackend will be init once for the target worker\n        - FlashAttentionMultiStepBackend will be once for the draft worker\n            - It will spawn num_steps FlashAttentionBackend for the draft worker\n\n    Note about CUDA Graph:\n    - We only support CUDA Graph for Decode (Normal Decode and Draft Decode) and Target Verify.\n    - We don't support CUDA Graph for Extend and Draft Extend.\n    - When server init, init_cuda_graph_state will be called first and then init_cuda_graph_capture will be called.\n    - For each forward batch, init_replay_cuda_graph will be called first and then replay the graph.\n    \"\"\"\n\n    def __init__(self, model_runner: ModelRunner):\n        super().__init__(model_runner)\n        # seg_la processes draft tokens as a chain -- it has no parent-indices\n        # plumbing for tree-shaped drafts, so spec v2 tree verify (topk > 1) would\n        # commit wrong mamba states silently. Fail fast instead of mis-decoding.\n        if self.topk > 1:\n            raise NotImplementedError(\n                \"Lightning (seg_la) linear-attention backend does not support \"\n                f\"speculative decoding with topk > 1 (got topk={self.topk}); \"\n                \"seg_la verifies a draft tree as a chain. Use \"\n                \"--speculative-eagle-topk 1.\"\n            )\n        # lightning attn does not need conv cache, but to keep the interface for mamba cache\n        self.conv_states_shape = (\n            model_runner.req_to_token_pool.mamba_pool.mamba_cache.conv[0].shape\n        )\n\n        assert not (\n            model_runner.sliding_window_size is not None\n            and model_runner.model_config.is_encoder_decoder\n        ), \"Sliding window and cross attention are not supported together\"\n\n        # extra metadata for handling speculative decoding topk > 1, extended draft decode and verify\n        self.max_context_len = model_runner.model_config.context_len\n        self.device = model_runner.device","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/layers/attention/linear/lightning_backend.py#L31-L67","documentation":"The Lightning (seg_la) linear-attention backend verifies EAGLE draft tokens as a chain and has no parent-indices plumbing for tree drafts; with topk > 1 it would silently commit wrong mamba states, so __init__ fails fast with NotImplementedError and suggests --speculative-eagle-topk 1.","triggerScenarios":"Constructing the Lightning linear-attention backend while ModelRunner's speculative config has topk > 1 (e.g. --speculative-eagle-topk 4 on a hybrid linear-attention model).","commonSituations":"Copying an EAGLE3 topk>1 config onto a Mamba/GDN/KDA hybrid model served with the seg_la backend; upgrading spec config without checking backend constraints.","solutions":["Set --speculative-eagle-topk 1","Use a linear-attention backend that supports tree verify if topk>1 is required","Disable speculative decoding for this model"],"exampleFix":"# before\n--speculative-eagle-topk 4 --linear-attn-backend lightning\n# after\n--speculative-eagle-topk 1 --linear-attn-backend lightning","handlingStrategy":"validation","validationCode":"topk = server_args.speculative_eagle_topk or 1\nif linear_attn_backend == 'lightning' and topk > 1:\n    raise SystemExit('seg_la requires --speculative-eagle-topk 1; got %d' % topk)","typeGuard":"null","tryCatchPattern":null,"preventionTips":["Default --speculative-eagle-topk to 1 for hybrid linear-attention models","Add a startup config validator pairing backend and spec settings"],"tags":["sglang","lightning","seg-la","speculative-decoding","topk","linear-attention"],"backgroundTag":"unsupported-operation","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}