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": 29979236, | |
| "effective_router_decisions": 239833888, | |
| "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": 108470984, | |
| "total_decisions": 239833888, | |
| "sparsity": 0.45227546826076553, | |
| "full_attention_usage": 0.5477245317392345, | |
| "per_layer": { | |
| "0": { | |
| "sparse_decisions": 0, | |
| "total_decisions": 8565496, | |
| "sparsity": 0.0 | |
| }, | |
| "1": { | |
| "sparse_decisions": 0, | |
| "total_decisions": 8565496, | |
| "sparsity": 0.0 | |
| }, | |
| "2": { | |
| "sparse_decisions": 0, | |
| "total_decisions": 8565496, | |
| "sparsity": 0.0 | |
| }, | |
| "3": { | |
| "sparse_decisions": 0, | |
| "total_decisions": 8565496, | |
| "sparsity": 0.0 | |
| }, | |
| "4": { | |
| "sparse_decisions": 0, | |
| "total_decisions": 8565496, | |
| "sparsity": 0.0 | |
| }, | |
| "5": { | |
| "sparse_decisions": 0, | |
| "total_decisions": 8565496, | |
| "sparsity": 0.0 | |
| }, | |
| "6": { | |
| "sparse_decisions": 0, | |
| "total_decisions": 8565496, | |
| "sparsity": 0.0 | |
| }, | |
| "7": { | |
| "sparse_decisions": 0, | |
| "total_decisions": 8565496, | |
| "sparsity": 0.0 | |
| }, | |
| "8": { | |
| "sparse_decisions": 0, | |
| "total_decisions": 8565496, | |
| "sparsity": 0.0 | |
| }, | |
| "9": { | |
| "sparse_decisions": 1870304, | |
| "total_decisions": 8565496, | |
| "sparsity": 0.21835326290503201 | |
| }, | |
| "10": { | |
| "sparse_decisions": 57880, | |
| "total_decisions": 8565496, | |
| "sparsity": 0.00675734364945124 | |
| }, | |
| "11": { | |
| "sparse_decisions": 1415536, | |
| "total_decisions": 8565496, | |
| "sparsity": 0.16526024879353163 | |
| }, | |
| "12": { | |
| "sparse_decisions": 569168, | |
| "total_decisions": 8565496, | |
| "sparsity": 0.06644892484918562 | |
| }, | |
| "13": { | |
| "sparse_decisions": 3463144, | |
| "total_decisions": 8565496, | |
| "sparsity": 0.40431330538243204 | |
| }, | |
| "14": { | |
| "sparse_decisions": 4293288, | |
| "total_decisions": 8565496, | |
| "sparsity": 0.5012305183494336 | |
| }, | |
| "15": { | |
| "sparse_decisions": 7064912, | |
| "total_decisions": 8565496, | |
| "sparsity": 0.8248106122517599 | |
| }, | |
| "16": { | |
| "sparse_decisions": 4284136, | |
| "total_decisions": 8565496, | |
| "sparsity": 0.5001620454904188 | |
| }, | |
| "17": { | |
| "sparse_decisions": 7138128, | |
| "total_decisions": 8565496, | |
| "sparsity": 0.8333583951238784 | |
| }, | |
| "18": { | |
| "sparse_decisions": 6157656, | |
| "total_decisions": 8565496, | |
| "sparsity": 0.718890768263741 | |
| }, | |
| "19": { | |
| "sparse_decisions": 7274328, | |
| "total_decisions": 8565496, | |
| "sparsity": 0.8492594007398988 | |
| }, | |
| "20": { | |
| "sparse_decisions": 8217096, | |
| "total_decisions": 8565496, | |
| "sparsity": 0.9593251809352313 | |
| }, | |
| "21": { | |
| "sparse_decisions": 7756416, | |
| "total_decisions": 8565496, | |
| "sparsity": 0.9055419557723219 | |
| }, | |
| "22": { | |
| "sparse_decisions": 8463664, | |
| "total_decisions": 8565496, | |
| "sparsity": 0.9881113714839164 | |
| }, | |
| "23": { | |
| "sparse_decisions": 8402408, | |
| "total_decisions": 8565496, | |
| "sparsity": 0.9809598883707377 | |
| }, | |
| "24": { | |
| "sparse_decisions": 8333704, | |
| "total_decisions": 8565496, | |
| "sparsity": 0.9729388700899516 | |
| }, | |
| "25": { | |
| "sparse_decisions": 8448408, | |
| "total_decisions": 8565496, | |
| "sparsity": 0.9863302720589677 | |
| }, | |
| "26": { | |
| "sparse_decisions": 6696432, | |
| "total_decisions": 8565496, | |
| "sparsity": 0.7817915039596073 | |
| }, | |
| "27": { | |
| "sparse_decisions": 8564376, | |
| "total_decisions": 8565496, | |
| "sparsity": 0.9998692428319388 | |
| } | |
| }, | |
| "by_phase": { | |
| "decode": { | |
| "sparse_decisions": 1402064, | |
| "total_decisions": 2764160, | |
| "sparsity": 0.5072296827969437, | |
| "full_attention_usage": 0.4927703172030563 | |
| }, | |
| "prefill": { | |
| "sparse_decisions": 107068920, | |
| "total_decisions": 237069728, | |
| "sparsity": 0.4516347190477225, | |
| "full_attention_usage": 0.5483652809522774 | |
| } | |
| } | |
| } | |