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": 25272464, | |
| "effective_router_decisions": 202179712, | |
| "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": 86334664, | |
| "total_decisions": 202179712, | |
| "sparsity": 0.42701942319514236, | |
| "full_attention_usage": 0.5729805768048577, | |
| "per_layer": { | |
| "0": { | |
| "sparse_decisions": 0, | |
| "total_decisions": 7220704, | |
| "sparsity": 0.0 | |
| }, | |
| "1": { | |
| "sparse_decisions": 0, | |
| "total_decisions": 7220704, | |
| "sparsity": 0.0 | |
| }, | |
| "2": { | |
| "sparse_decisions": 0, | |
| "total_decisions": 7220704, | |
| "sparsity": 0.0 | |
| }, | |
| "3": { | |
| "sparse_decisions": 0, | |
| "total_decisions": 7220704, | |
| "sparsity": 0.0 | |
| }, | |
| "4": { | |
| "sparse_decisions": 0, | |
| "total_decisions": 7220704, | |
| "sparsity": 0.0 | |
| }, | |
| "5": { | |
| "sparse_decisions": 0, | |
| "total_decisions": 7220704, | |
| "sparsity": 0.0 | |
| }, | |
| "6": { | |
| "sparse_decisions": 0, | |
| "total_decisions": 7220704, | |
| "sparsity": 0.0 | |
| }, | |
| "7": { | |
| "sparse_decisions": 0, | |
| "total_decisions": 7220704, | |
| "sparsity": 0.0 | |
| }, | |
| "8": { | |
| "sparse_decisions": 0, | |
| "total_decisions": 7220704, | |
| "sparsity": 0.0 | |
| }, | |
| "9": { | |
| "sparse_decisions": 79160, | |
| "total_decisions": 7220704, | |
| "sparsity": 0.010962919959051085 | |
| }, | |
| "10": { | |
| "sparse_decisions": 5720, | |
| "total_decisions": 7220704, | |
| "sparsity": 0.0007921665255908565 | |
| }, | |
| "11": { | |
| "sparse_decisions": 130720, | |
| "total_decisions": 7220704, | |
| "sparsity": 0.01810349794147496 | |
| }, | |
| "12": { | |
| "sparse_decisions": 276416, | |
| "total_decisions": 7220704, | |
| "sparsity": 0.03828103187722416 | |
| }, | |
| "13": { | |
| "sparse_decisions": 1201008, | |
| "total_decisions": 7220704, | |
| "sparsity": 0.16632838016902507 | |
| }, | |
| "14": { | |
| "sparse_decisions": 3219680, | |
| "total_decisions": 7220704, | |
| "sparsity": 0.4458955802647498 | |
| }, | |
| "15": { | |
| "sparse_decisions": 5586712, | |
| "total_decisions": 7220704, | |
| "sparsity": 0.7737073836567736 | |
| }, | |
| "16": { | |
| "sparse_decisions": 3334448, | |
| "total_decisions": 7220704, | |
| "sparsity": 0.4617898753362553 | |
| }, | |
| "17": { | |
| "sparse_decisions": 5915808, | |
| "total_decisions": 7220704, | |
| "sparsity": 0.819284103045908 | |
| }, | |
| "18": { | |
| "sparse_decisions": 5246040, | |
| "total_decisions": 7220704, | |
| "sparsity": 0.7265274964878771 | |
| }, | |
| "19": { | |
| "sparse_decisions": 6154752, | |
| "total_decisions": 7220704, | |
| "sparsity": 0.852375613236604 | |
| }, | |
| "20": { | |
| "sparse_decisions": 6963304, | |
| "total_decisions": 7220704, | |
| "sparsity": 0.9643525063484114 | |
| }, | |
| "21": { | |
| "sparse_decisions": 6725584, | |
| "total_decisions": 7220704, | |
| "sparsity": 0.9314305087149397 | |
| }, | |
| "22": { | |
| "sparse_decisions": 7069864, | |
| "total_decisions": 7220704, | |
| "sparsity": 0.9791100701538243 | |
| }, | |
| "23": { | |
| "sparse_decisions": 6992128, | |
| "total_decisions": 7220704, | |
| "sparsity": 0.968344360882263 | |
| }, | |
| "24": { | |
| "sparse_decisions": 7047448, | |
| "total_decisions": 7220704, | |
| "sparsity": 0.9760056637136767 | |
| }, | |
| "25": { | |
| "sparse_decisions": 7035632, | |
| "total_decisions": 7220704, | |
| "sparsity": 0.974369258177596 | |
| }, | |
| "26": { | |
| "sparse_decisions": 6130496, | |
| "total_decisions": 7220704, | |
| "sparsity": 0.8490163839980146 | |
| }, | |
| "27": { | |
| "sparse_decisions": 7219744, | |
| "total_decisions": 7220704, | |
| "sparsity": 0.999867048974726 | |
| } | |
| }, | |
| "by_phase": { | |
| "decode": { | |
| "sparse_decisions": 1527584, | |
| "total_decisions": 2947840, | |
| "sparsity": 0.5182045158488927, | |
| "full_attention_usage": 0.4817954841511073 | |
| }, | |
| "prefill": { | |
| "sparse_decisions": 84807080, | |
| "total_decisions": 199231872, | |
| "sparsity": 0.42567024617426674, | |
| "full_attention_usage": 0.5743297538257333 | |
| } | |
| } | |
| } | |