Run this model with HF Jobs
Run btzyd/Accordion-v1.1-Instruct on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/btzyd/Accordion-v1.1-Instruct. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/btzyd/Accordion-v1.1-Instruct on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/btzyd/Accordion-v1.1-Instruct. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/btzyd/Accordion-v1.1-Instruct. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use btzyd/Accordion-v1.1-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use btzyd/Accordion-v1.1-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="btzyd/Accordion-v1.1-Instruct", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("btzyd/Accordion-v1.1-Instruct", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use btzyd/Accordion-v1.1-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "btzyd/Accordion-v1.1-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "btzyd/Accordion-v1.1-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/btzyd/Accordion-v1.1-Instruct
- SGLang
How to use btzyd/Accordion-v1.1-Instruct 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 "btzyd/Accordion-v1.1-Instruct" \ --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": "btzyd/Accordion-v1.1-Instruct", "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 "btzyd/Accordion-v1.1-Instruct" \ --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": "btzyd/Accordion-v1.1-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use btzyd/Accordion-v1.1-Instruct with Docker Model Runner:
docker model run hf.co/btzyd/Accordion-v1.1-Instruct
Accordion-v1.1-Instruct
Paper · Project page · Code · Accordion v1.1 models
Accordion is a 24-layer Mixture-of-Experts language model (≈6.0B total parameters, ≈0.54B active non-embedding parameters per token) trained so that one set of weights serves five inference compute budgets. During pre-training, each global batch samples one $k \in {0, 3, 6, 9, 12}$ and the first $k$ layers of the middle window (layers 7–18) each run a second time in place (layer looping: each layer has its own self-loop; the second pass is scaled by a zero-initialised per-channel $\tanh(g)$ gate and reuses the same router, with a separate expert-selection bias). At inference you pick $k$, i.e. 24 to 36 layer executions per token, with no change to the weights. This differs from whole-model recurrence (e.g. Ouro), which repeats the entire layer stack.
This is the v1.1 SFT model: Accordion-v1.1-Base after supervised fine-tuning on reasoning traces (<think> … </think> followed by the answer). It is the starting point of Accordion-v1.1-RL.
Model family (v1.1)
Accordion v1.1 starts from the 3T-token pre-training checkpoint of Accordion v1.0 and redoes everything after it with a larger, publicly released data mix: 1.2T tokens of mid-training, 0.6T of annealing, 0.2T of 32K long-context training, a new SFT stage and a new RL stage.
| Model | Stage | Context |
|---|---|---|
| Accordion-v1.1-Base | pre-training 3.0T + mid-training 1.2T + annealing 0.6T + 32K long-context 0.2T tokens (5.0T total) | 32K |
| Accordion-v1.1-Instruct | Base + supervised fine-tuning (reasoning traces) | 32K |
| Accordion-v1.1-RL | Instruct + RL (math / code / instruction-following / RLHF experts → grouped merge → 10 steps of multi-teacher on-policy distillation) | 32K |
All three keep the five budgets: every training stage mixes $k \in {0,3,6,9,12}$.
Architecture
| Layers | 24 (layers 7–18 loopable) |
| Hidden size | 1536 |
| Attention | GQA, 12 query / 4 KV heads, head dim 128, QK-RMSNorm, RoPE θ = 500,000 |
| MoE | 128 routed experts, top-8 (sigmoid scores, aux-loss-free bias for selection) + 1 shared expert, expert FFN 384 |
| Vocabulary | 128,000 (DeepSeek-V3 tokenizer) |
| Budgets | $k$ ∈ {0, 3, 6, 9, 12} (Low / Medium / High / XHigh / Ultra) → 24 / 27 / 30 / 33 / 36 layer executions |
| Weights | bf16; expert_bias* buffers kept in fp32 |
Each layer execution keeps its own KV cache, so the KV cache grows with $k$ (×1.5 at $k$=12).
Usage
The modeling code ships with the checkpoint (trust_remote_code=True). Tested with transformers 5.9 and torch 2.11.
The budget is chosen per call with loop_k (default: config.loop_k = 0).
Generation uses the model's own
loop_generate(greedy or nucleus sampling, left-padded batches).model.generate()is not supported, because every layer execution needs its own KV-cache slot.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "btzyd/Accordion-v1.1-Instruct"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, trust_remote_code=True, dtype=torch.bfloat16).cuda().eval()
messages = [{"role": "user", "content": "Solve the following math problem. Make sure to put the answer "
"(and only answer) inside \\boxed{}.\n\nWhat is the sum of the first 10 positive odd numbers?"}]
ids = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt", return_dict=True)["input_ids"].cuda()
out = model.loop_generate(ids, max_new_tokens=8192, loop_k=12, do_sample=True, temperature=0.6, top_p=0.95,
stop_token_ids=(tok.eos_token_id,))
print(tok.decode(out[0], skip_special_tokens=True)) # "<think>\n...\n</think>\n\n... \boxed{100}"
Prompt format. There are no role tokens. The chat template renders
<|end▁of▁sentence|> + user text + "\n\n"; the model answers with <think>\n…\n</think>\n\n followed by
the final answer and ends the turn with <|end▁of▁sentence|>. A system message is rendered like a user turn,
and earlier assistant turns are appended verbatim, each followed by <|end▁of▁sentence|>. Our evaluations used
temperature 0.6 / top-p 0.95 and up to 30K new tokens. Reasoning can be long, so allow a generous max_new_tokens.
vLLM. The accordion-vllm plugin serves this model with one budget per engine, set by LOOPMOE_K:
pip install vllm==0.24.0 "git+https://github.com/btzyd/Accordion-Loop#subdirectory=vllm_plugin"
LOOPMOE_K=12 vllm serve btzyd/Accordion-v1.1-Instruct --trust-remote-code --dtype bfloat16 --max-model-len 32768
Notes:
- The tokenizer has only three special tokens:
<|begin▁of▁sentence|>(0, never seen in training — do not add it),<|end▁of▁sentence|>(1, document separator / end of turn) and<|▁pad▁|>(2). Every document in training was preceded by token 1, so prefix inputs with it, as the examples do. - Budgets other than the five trained ones (e.g. $k$=5, or looping an arbitrary set of layers via
loop_layers_active) run, but were never trained and are generally worse.
Evaluation
Same weights, five budgets. Chat-format evaluation with vLLM (bf16), temperature 0.6, top-p 0.95, one sample per problem (16 for AIME), up to 30K new tokens; answers are taken after </think>.
| $k$=0 | 3 | 6 | 9 | 12 | |
|---|---|---|---|---|---|
| Layer executions | 24 | 27 | 30 | 33 | 36 |
| GSM8K | 91.51 | 92.87 | 93.71 | 93.78 | 93.48 |
| MATH500 | 89.60 | 91.60 | 92.80 | 92.40 | 92.00 |
| AIME24 (avg@16) | 63.12 | 67.92 | 69.38 | 68.75 | 69.79 |
| AIME25 (avg@16) | 50.21 | 56.25 | 57.50 | 64.38 | 60.62 |
| HumanEval+ | 87.20 | 85.98 | 89.63 | 84.76 | 90.24 |
| MBPP+ | 73.81 | 76.19 | 76.98 | 73.81 | 75.66 |
| LiveCodeBench (454) | 41.63 | 45.37 | 48.68 | 46.92 | 49.78 |
| IFEval (prompt, strict) | 67.28 | 64.33 | 68.58 | 67.10 | 67.47 |
| IFBench | 31.67 | 31.67 | 31.00 | 28.00 | 29.00 |
| MMLU-Redux | 75.72 | 78.12 | 78.71 | 79.32 | 79.19 |
Scripts to reproduce this table are in Accordion-Loop (eval/chat).
Limitations
- A research model at small scale (0.5B active parameters); it is not safety-tuned beyond the RLHF stage of the RL model and can produce wrong, biased or harmful text.
- Mostly English, with some code and math; other languages were not a training target.
- Only the HF reference implementation and the vLLM plugin in Accordion-Loop support layer looping; standard inference engines will not load this architecture.
- Single training run, single seed.
License
CC BY-NC 4.0. Part of the training data is released under non-commercial terms, so these weights are for research and other non-commercial use only.
Citation
@misc{zhang2026accordionelasticdepthinferencefixedprefix,
title={Accordion: Elastic-Depth Inference via Fixed-Prefix Layer Looping},
author={Yudong Zhang and Wei Ding and Kaili Zheng and Yuchen Ding and Zhenyu Zhang},
year={2026},
eprint={2610.32492},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/2610.32492},
}
- Downloads last month
- 6
