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
| { | |
| "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": 174318504, | |
| "total_decisions": 425294912, | |
| "sparsity": 0.4098767680531292, | |
| "full_attention_usage": 0.5901232319468708, | |
| "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": 198656, | |
| "total_decisions": 15189104, | |
| "sparsity": 0.013078849153972479 | |
| }, | |
| "10": { | |
| "sparse_decisions": 6688, | |
| "total_decisions": 15189104, | |
| "sparsity": 0.00044031563678805543 | |
| }, | |
| "11": { | |
| "sparse_decisions": 366520, | |
| "total_decisions": 15189104, | |
| "sparsity": 0.024130455621345408 | |
| }, | |
| "12": { | |
| "sparse_decisions": 778896, | |
| "total_decisions": 15189104, | |
| "sparsity": 0.05127991749875437 | |
| }, | |
| "13": { | |
| "sparse_decisions": 2585024, | |
| "total_decisions": 15189104, | |
| "sparsity": 0.1701893673254196 | |
| }, | |
| "14": { | |
| "sparse_decisions": 6056200, | |
| "total_decisions": 15189104, | |
| "sparsity": 0.39872002983191107 | |
| }, | |
| "15": { | |
| "sparse_decisions": 11935840, | |
| "total_decisions": 15189104, | |
| "sparsity": 0.7858159375299557 | |
| }, | |
| "16": { | |
| "sparse_decisions": 5208592, | |
| "total_decisions": 15189104, | |
| "sparsity": 0.34291634318917036 | |
| }, | |
| "17": { | |
| "sparse_decisions": 13174960, | |
| "total_decisions": 15189104, | |
| "sparsity": 0.8673954698051972 | |
| }, | |
| "18": { | |
| "sparse_decisions": 12118600, | |
| "total_decisions": 15189104, | |
| "sparsity": 0.7978482470065383 | |
| }, | |
| "19": { | |
| "sparse_decisions": 11068656, | |
| "total_decisions": 15189104, | |
| "sparsity": 0.7287234322709226 | |
| }, | |
| "20": { | |
| "sparse_decisions": 12698176, | |
| "total_decisions": 15189104, | |
| "sparsity": 0.8360055998036487 | |
| }, | |
| "21": { | |
| "sparse_decisions": 13380232, | |
| "total_decisions": 15189104, | |
| "sparsity": 0.8809098943558488 | |
| }, | |
| "22": { | |
| "sparse_decisions": 14965704, | |
| "total_decisions": 15189104, | |
| "sparsity": 0.9852920883285808 | |
| }, | |
| "23": { | |
| "sparse_decisions": 14819656, | |
| "total_decisions": 15189104, | |
| "sparsity": 0.9756767746142234 | |
| }, | |
| "24": { | |
| "sparse_decisions": 14733136, | |
| "total_decisions": 15189104, | |
| "sparsity": 0.9699805860832871 | |
| }, | |
| "25": { | |
| "sparse_decisions": 14539256, | |
| "total_decisions": 15189104, | |
| "sparsity": 0.9572161728565425 | |
| }, | |
| "26": { | |
| "sparse_decisions": 10496608, | |
| "total_decisions": 15189104, | |
| "sparsity": 0.6910616979118716 | |
| }, | |
| "27": { | |
| "sparse_decisions": 15187104, | |
| "total_decisions": 15189104, | |
| "sparsity": 0.9998683266636399 | |
| } | |
| }, | |
| "by_phase": { | |
| "decode": { | |
| "sparse_decisions": 326256, | |
| "total_decisions": 840000, | |
| "sparsity": 0.3884, | |
| "full_attention_usage": 0.6115999999999999 | |
| }, | |
| "prefill": { | |
| "sparse_decisions": 173992248, | |
| "total_decisions": 424454912, | |
| "sparsity": 0.4099192707657957, | |
| "full_attention_usage": 0.5900807292342043 | |
| } | |
| } | |
| } | |