Text Generation
Transformers
Safetensors
English
qwen3
long-context
sparse-attention
aha
l2a-style
reproducibility
conversational
text-generation-inference
Instructions to use keepsloading/icml_repro_scratch with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use keepsloading/icml_repro_scratch with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="keepsloading/icml_repro_scratch") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("keepsloading/icml_repro_scratch") model = AutoModelForCausalLM.from_pretrained("keepsloading/icml_repro_scratch", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use keepsloading/icml_repro_scratch with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "keepsloading/icml_repro_scratch" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "keepsloading/icml_repro_scratch", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/keepsloading/icml_repro_scratch
- SGLang
How to use keepsloading/icml_repro_scratch with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "keepsloading/icml_repro_scratch" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "keepsloading/icml_repro_scratch", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "keepsloading/icml_repro_scratch" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "keepsloading/icml_repro_scratch", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use keepsloading/icml_repro_scratch with Docker Model Runner:
docker model run hf.co/keepsloading/icml_repro_scratch
File size: 4,238 Bytes
1ade3b4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | {
"definition": "hard AHA gate zeros / all token x KV-head x layer decisions, token-weighted over prefill and decode",
"router_granularity": "token",
"native_router_decisions": 53161864,
"effective_router_decisions": 425294912,
"native_router_note": "Native decisions count learned gate logits before broadcast; effective decisions always use token x KV-head x layer for matched sparsity.",
"sparse_decisions": 24280016,
"total_decisions": 425294912,
"sparsity": 0.057089834171352605,
"full_attention_usage": 0.9429101658286474,
"per_layer": {
"0": {
"sparse_decisions": 0,
"total_decisions": 15189104,
"sparsity": 0.0
},
"1": {
"sparse_decisions": 0,
"total_decisions": 15189104,
"sparsity": 0.0
},
"2": {
"sparse_decisions": 0,
"total_decisions": 15189104,
"sparsity": 0.0
},
"3": {
"sparse_decisions": 0,
"total_decisions": 15189104,
"sparsity": 0.0
},
"4": {
"sparse_decisions": 0,
"total_decisions": 15189104,
"sparsity": 0.0
},
"5": {
"sparse_decisions": 0,
"total_decisions": 15189104,
"sparsity": 0.0
},
"6": {
"sparse_decisions": 0,
"total_decisions": 15189104,
"sparsity": 0.0
},
"7": {
"sparse_decisions": 0,
"total_decisions": 15189104,
"sparsity": 0.0
},
"8": {
"sparse_decisions": 0,
"total_decisions": 15189104,
"sparsity": 0.0
},
"9": {
"sparse_decisions": 0,
"total_decisions": 15189104,
"sparsity": 0.0
},
"10": {
"sparse_decisions": 0,
"total_decisions": 15189104,
"sparsity": 0.0
},
"11": {
"sparse_decisions": 32,
"total_decisions": 15189104,
"sparsity": 2.106773381761031e-06
},
"12": {
"sparse_decisions": 32,
"total_decisions": 15189104,
"sparsity": 2.106773381761031e-06
},
"13": {
"sparse_decisions": 2704,
"total_decisions": 15189104,
"sparsity": 0.0001780223507588071
},
"14": {
"sparse_decisions": 1744,
"total_decisions": 15189104,
"sparsity": 0.00011481914930597618
},
"15": {
"sparse_decisions": 515936,
"total_decisions": 15189104,
"sparsity": 0.0339675072341331
},
"16": {
"sparse_decisions": 504,
"total_decisions": 15189104,
"sparsity": 3.3181680762736235e-05
},
"17": {
"sparse_decisions": 41672,
"total_decisions": 15189104,
"sparsity": 0.0027435456363983026
},
"18": {
"sparse_decisions": 3176,
"total_decisions": 15189104,
"sparsity": 0.0002090972581397823
},
"19": {
"sparse_decisions": 5448,
"total_decisions": 15189104,
"sparsity": 0.0003586781682448155
},
"20": {
"sparse_decisions": 22504,
"total_decisions": 15189104,
"sparsity": 0.001481588380723445
},
"21": {
"sparse_decisions": 66592,
"total_decisions": 15189104,
"sparsity": 0.004384195407444705
},
"22": {
"sparse_decisions": 1687440,
"total_decisions": 15189104,
"sparsity": 0.11109542735371356
},
"23": {
"sparse_decisions": 4707840,
"total_decisions": 15189104,
"sparsity": 0.3099484999246829
},
"24": {
"sparse_decisions": 1144760,
"total_decisions": 15189104,
"sparsity": 0.07536718426577367
},
"25": {
"sparse_decisions": 708656,
"total_decisions": 15189104,
"sparsity": 0.04665554992578891
},
"26": {
"sparse_decisions": 183888,
"total_decisions": 15189104,
"sparsity": 0.012106573238289764
},
"27": {
"sparse_decisions": 15187088,
"total_decisions": 15189104,
"sparsity": 0.999867273276949
}
},
"by_phase": {
"decode": {
"sparse_decisions": 35696,
"total_decisions": 840000,
"sparsity": 0.04249523809523809,
"full_attention_usage": 0.9575047619047619
},
"prefill": {
"sparse_decisions": 24244320,
"total_decisions": 424454912,
"sparsity": 0.057118717005211615,
"full_attention_usage": 0.9428812829947884
}
}
}
|