Instructions to use develoco/Qwen3-4B-LayerBoost with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use develoco/Qwen3-4B-LayerBoost with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="develoco/Qwen3-4B-LayerBoost", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("develoco/Qwen3-4B-LayerBoost", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("develoco/Qwen3-4B-LayerBoost", trust_remote_code=True) 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 develoco/Qwen3-4B-LayerBoost with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "develoco/Qwen3-4B-LayerBoost" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "develoco/Qwen3-4B-LayerBoost", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/develoco/Qwen3-4B-LayerBoost
- SGLang
How to use develoco/Qwen3-4B-LayerBoost 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 "develoco/Qwen3-4B-LayerBoost" \ --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": "develoco/Qwen3-4B-LayerBoost", "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 "develoco/Qwen3-4B-LayerBoost" \ --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": "develoco/Qwen3-4B-LayerBoost", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use develoco/Qwen3-4B-LayerBoost with Docker Model Runner:
docker model run hf.co/develoco/Qwen3-4B-LayerBoost
metadata
library_name: transformers
Qwen3-4B-hybrid-OC
A hybrid model developed by Openchip by applying proprietary linearization approach LayerBoost to the Qwen3-4B, reducing latency and increasing token throughtput by 68%.
Details about LayerBoost approach are available on arXiv: https://arxiv.org/pdf/2604.22050v2
Setup
Before using this model, install the following system dependencies:
apt-get update
apt-get install -y --no-install-recommends \
build-essential
After that, install the requirements
transformers==4.56.2
accelerate==1.11.0
peft==0.18.0
torch==2.10
flash-attn @ https://github.com/mjun0812/flash-attention-prebuild-wheels/releases/download/v0.7.12/flash_attn-2.8.3+cu128torch2.10-cp312-cp312-linux_x86_64.whl
Example Usage
Login to Huggigface
hf auth login
Use the model
from transformers import AutoModelForCausalLM, AutoTokenizer, AutoConfig
import torch
model_id = "openchip-sw/Qwen3-4B-LayerBoost"
device = "cuda" if torch.cuda.is_available() else "cpu"
config = AutoConfig.from_pretrained(model_id)
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
trust_remote_code=True,
)
model.eval()
model.to(device)
prompt = "give me the list of European countrie accompanied with the capitals"
eval_inputs = tokenizer(prompt, return_tensors="pt")
eval_inputs = {k: v.to(device) for k, v in eval_inputs.items()}
eval_tokens = model.generate(
**eval_inputs,
max_new_tokens=512,
do_sample=False,
use_cache=True,
return_dict_in_generate=True,
)
out_text = tokenizer.decode(eval_tokens.sequences[0], skip_special_tokens=True)
print("Generated text:", out_text)