Skip to content

vllm.models.glm5next.nvidia.specialized_decode.policy

Which implementation each stage runs for a step of tokens tokens (requests x tokens per request). Every entry is a batch_table spec; token counts an entry leaves out run the stock kernels. additional_config["policy"] replaces entries by name, e.g. {"moe": "1-4:per_route,8-16:grouped"}.

Classes:

Policy

Methods:

  • __call__ –

    The implementation stage runs at tokens, None for stock.

Source code in vllm/models/glm5next/nvidia/specialized_decode/policy.py
class Policy:
    def __init__(self, overrides: Mapping[str, str] | None = None):
        overrides = dict(overrides or {})
        unknown = overrides.keys() - DEFAULT.keys()
        if unknown:
            raise ValueError(f"Unknown specialized decode policy entries: {unknown}")
        self.tables = {
            stage: batch_table(spec) for stage, spec in (DEFAULT | overrides).items()
        }

    def __call__(self, stage: str, tokens: int) -> str | None:
        """The implementation `stage` runs at `tokens`, None for stock."""
        return self.tables[stage].get(tokens)

    def enabled(self, stage: str) -> bool:
        return bool(self.tables[stage])

    def tokens(self, stage: str, choice: str) -> set[int]:
        return {m for m, c in self.tables[stage].items() if c == choice}

__call__(stage, tokens)

The implementation stage runs at tokens, None for stock.

Source code in vllm/models/glm5next/nvidia/specialized_decode/policy.py
def __call__(self, stage: str, tokens: int) -> str | None:
    """The implementation `stage` runs at `tokens`, None for stock."""
    return self.tables[stage].get(tokens)