Views
No views yet
WARNING (Security): This model requirestrust_remote_code=True, which executes Python code from this repository. Review the code before running in sensitive environments.
1import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM
3
4tokenizer = AutoTokenizer.from_pretrained(
5 "concavity-ai/superlinear-exp-v0.1",
6 trust_remote_code=True
7)
8
9model = AutoModelForCausalLM.from_pretrained(
10 "concavity-ai/superlinear-exp-v0.1",
11 torch_dtype=torch.float16,
12 device_map="cuda",
13 trust_remote_code=True,
14)
15
16messages = [{"role": "user", "content": "Explain the Transformer architecture."}]
17inputs = tokenizer.apply_chat_template(messages, return_tensors="pt", add_generation_prompt=True).to("cuda")
18
19output = model.generate(inputs, max_new_tokens=1000, do_sample=True, temperature=0.1, top_p=0.99)
20print(tokenizer.decode(output[0], skip_special_tokens=True))trust_remote_code=True) and CUDA extensions.mamba-ssm[causal-conv1d] from source to avoid wheel/ABI mismatches):1conda env create -f environment.yml \
2 && conda run -n superlinear pip install torch --index-url https://download.pytorch.org/whl/cu128 \
3 && conda run -n superlinear pip install -e ".[server,model]" \
4 && conda run -n superlinear bash -lc 'CUDA_HOME="$CONDA_PREFIX" pip install "mamba-ssm[causal-conv1d]" --no-build-isolation --no-cache-dir --no-binary :all:'mamba-ssm already works in your env)python -c "import mamba_ssm, causal_conv1d" already succeeds in the environment you’ll run inference in, you already have a working PyTorch/CUDA pairing for the extension in that environment — you should not need to reinstall PyTorch.1pip install -U "transformers<5" accelerate safetensors
2pip install -U vllm triton
3
4# Superlinear kernels (span-attention)
5pip install -U git+https://github.com/concavity-ai/superlinear.gitmamba-ssm from source (only if needed)mamba-ssm[causal-conv1d] yourself, you need a CUDA toolkit with nvcc and CUDA_HOME pointing at it (example: /usr/local/cuda):1CUDA_HOME=/usr/local/cuda \
2 pip install -U "mamba-ssm[causal-conv1d]" \
3 --no-build-isolation --no-cache-dir --no-binary :all:1model = AutoModelForCausalLM.from_pretrained(
2 "concavity-ai/superlinear-exp-v0.1",
3 # Attention implementation
4 _attn_implementation='block-span-gqa',
5 decode_kernel='staged-gqa',
6
7 # Performance optimizations
8 enable_cuda_graph=True,
9 enable_shared_fused_moe=True,
10
11 # Superlinear attention hyperparameters
12 span_attention_sw_index=65, # Local window boundary index
13 span_attention_num_spans=3, # Top-k spans per query
14 span_attention_backward_factor=3, # Backward span extent multiplier
15 span_attention_forward_factor=1, # Forward span extent multiplier
16 span_attention_search_power=0.55, # Search exponent (controls anchor budget)
17 span_attention_span_power=0.55, # Span exponent (controls span scale)
18
19 torch_dtype=torch.float16,
20 device_map="cuda",
21 trust_remote_code=True,
22)| Parameter | Description | Typical Value |
|---|---|---|
span_attention_num_spans | Number of routed spans selected per query (top-k) | 2 or 3 |
span_attention_backward_factor | Backward extent of each span relative to base scale | 2–4 |
span_attention_forward_factor | Forward extent of each span relative to base scale | 0–2 |
span_attention_search_power | Exponent controlling the number of candidate anchors | 0.5–0.667 |
span_attention_span_power | Exponent controlling span length scaling | 0.5–0.667 |
span_attention_sw_index: Internally, the kernels compute the sliding-window length as:window_len = floor((sw_index + 1) ** (1 / search_power)) - 1sw_index (a stride/stripe index) rather than specifying window_len directly. This keeps the sliding-window boundary aligned with the same index space used by span search, so span-search begins immediately after the sliding-window region and avoids gaps between local attention and routed spans.search_power=0.55 and sw_index=65,window_len = floor(66 ** (1 / 0.55)) - 1 = 2032| Context Length | Prefill (tok/s) | Decode (tok/s) |
|---|---|---|
| 1M tokens | ~20,202 | ~109 |
| 10M tokens | ~5,576 | ~76 |
├── config.json # Model configuration
├── generation_config.json # Default generation settings
├── tokenizer.json # Tokenizer
├── tokenizer_config.json
├── special_tokens_map.json
├── chat_template.jinja # Chat template
├── configuration_superlinear_exp.py # Custom config class
├── modeling_superlinear_exp.py # Custom model implementation
├── moe.py # MoE components
├── model-*.safetensors # Model weights (16 shards)
├── model.safetensors.index.json # Weight index
├── LICENSE # NVIDIA Open Model License
├── NOTICE # Required attribution
└── README.md # This file1@article{huang2026superlinear,
2 title={Superlinear Multi-Step Attention},
3 author={Huang, Yufeng},
4 journal={arXiv preprint arXiv:2601.18401},
5 year={2026}
6}