Instructions to use Nanbeige/Nanbeige4.2-3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Nanbeige/Nanbeige4.2-3B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Nanbeige/Nanbeige4.2-3B", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Nanbeige/Nanbeige4.2-3B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Nanbeige/Nanbeige4.2-3B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Nanbeige/Nanbeige4.2-3B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Nanbeige/Nanbeige4.2-3B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Nanbeige/Nanbeige4.2-3B
- SGLang
How to use Nanbeige/Nanbeige4.2-3B 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 "Nanbeige/Nanbeige4.2-3B" \ --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": "Nanbeige/Nanbeige4.2-3B", "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 "Nanbeige/Nanbeige4.2-3B" \ --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": "Nanbeige/Nanbeige4.2-3B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Nanbeige/Nanbeige4.2-3B with Docker Model Runner:
docker model run hf.co/Nanbeige/Nanbeige4.2-3B
Q on the model
- Can you 4-bit quantize this model but still endure its quality isn't bad
- Will there be bigger models using the looped architecture
- Would you make MoE and/or linear attention and/or SWA models next
- What is your stance on LFM and other newer architectures
- Will there be DFlash or Eagele3 or MTP for this model
The main purpose of the looped architecture is to improve model capacity without increasing the parameter count. We believe this tradeoff is particularly well suited to the deployment and application scenarios of smaller models.
We are also actively exploring MoE and linear/sparse attention architectures. Related releases are planned not long after the ongoing Nanbeige4.5. 😊
@leran1995 what are the major acceleration methods on the roadmap that makes both parameter efficiency and compute efficiency (and interpretability with J-Lens) possible?
@TomLucidor just in case, for dflash or eagle, you don't need the model to already have a native feature (as you need for mtp). vllm have full tutos and notebooks for each of the methods, if you are interested https://docs.vllm.ai/projects/speculators/en/latest/user_guide/tutorials/ and have enough ram ;) personnaly I don't even have enough ram to COMPILE vllm (the Nanbeige custom one) xDD
@leran1995 just to write more on the matter, is it even possible to distill regular models like Qwen3.5 and Gemma4 directly into Nanbeige (compaction and compute-minimization)?