返回资讯中心
外部精选
软件工程
#开发者实时流

Qwen 在 Hugging Face 发布 Qwen4-35B-A3B 模型,可通过 HF Jobs 运行

来源标题:Qwen4-35B-A3B

Qwen 在 Hugging Face 上线了 Qwen4-35B-A3B 模型,用户可通过 Hugging Face 托管计算平台 HF Jobs 直接运行该模型,并监控进度、获取结果。该模型采用 qwen4_moe 架构,支持图文输入,采用 Apache-2.0 许可。页面还提供了微调、批量推理、基准评测和量化等 HF Jobs 使用提示。

Hacker News 最新Philpax2026/12/4 · 今天30 分钟阅读

以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。

Like 179

Follow

Qwen 119k

Image-Text-to-Text

Transformers

Safetensors

qwen4_moe

License: apache-2.0

Model card Files Files and versions xet

Community 6

More actions

Deploy

Run this model with HF Jobs

Run Qwen/Qwen4-35B-A3B 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:

Use HF Jobs and TRL to fine-tune https://huggingface.co/Qwen/Qwen4-35B-A3B. 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/Qwen/Qwen4-35B-A3B 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/Qwen/Qwen4-35B-A3B. 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/Qwen/Qwen4-35B-A3B. 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.

Copy to bucket

Use this model Instructions to use Qwen/Qwen4-35B-A3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.

Libraries

Transformers How to use Qwen/Qwen4-35B-A3B with Transformers:

Use a pipeline as a high-level helper

from transformers import pipeline

pipe = pipeline("image-text-to-text", model="Qwen/Qwen4-35B-A3B")

pip install -U transformers accelerate

Load model directly

from transformers import AutoProcessor, AutoModelForMultimodalLM

processor = AutoProcessor.from_pretrained("Qwen/Qwen4-35B-A3B") model = AutoModelForMultimodalLM.from_pretrained("Qwen/Qwen4-35B-A3B", device_map="auto")

Notebooks

Google Colab

Kaggle

Local Apps Settings

vLLM How to use Qwen/Qwen4-35B-A3B with vLLM:

Install vLLM from pip:

pip install vllm

Start the vLLM server:

vllm serve "Qwen/Qwen4-35B-A3B"

Call the server using curl (OpenAI-compatible API):

curl -X POST "http://localhost:8000/v1/completions"
-H "Content-Type: application/json"
--data '{ "model": "Qwen/Qwen4-35B-A3B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'

Use Docker

docker model run hf.co/Qwen/Qwen4-35B-A3B

SGLang How to use Qwen/Qwen4-35B-A3B with SGLang:

Install SGLang from pip:

pip install sglang

Start the SGLang server:

python3 -m sglang.launch_server
--model-path "Qwen/Qwen4-35B-A3B"
--host 0.0.0.0
--port 30000

Call the server using curl (OpenAI-compatible API):

curl -X POST "http://localhost:30000/v1/completions"
-H "Content-Type: application/json"
--data '{ "model": "Qwen/Qwen4-35B-A3B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'

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 "Qwen/Qwen4-35B-A3B"
--host 0.0.0.0
--port 30000

Call the server using curl (OpenAI-compatible API):

curl -X POST "http://localhost:30000/v1/completions"
-H "Content-Type: application/json"
--data '{ "model": "Qwen/Qwen4-35B-A3B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'

Docker Model Runner How to use Qwen/Qwen4-35B-A3B with Docker Model Runner:

docker model run hf.co/Qwen/Qwen4-35B-A3B

Browse Quantizations to use this model in llama.cpp, Ollama, LM Studio, or any compatible app.

Qwen4-35B-A3B Qwen4 Highlights

Model Overview

Benchmark Results

Quickstart Serving Qwen4-35B-A3B

API Usage

Best Practices

Citation

Qwen4-35B-A3B

This repository contains model weights and configuration files for the post-trained model in the Hugging Face Transformers format.

These artifacts are compatible with Hugging Face Transformers, vLLM, SGLang, TokenSpeed, etc.

For users seeking managed, scalable inference without infrastructure maintenance, the official Qwen API service is provided by Qwen Cloud.

In particular, Qwen4-35B-A3B is served under the model name qwen4-35b-a3b, with more production features, e.g., official built-in tools. The APIs will be avaible at Qwen Cloud soon.

Since the release of Qwen3.8-Flash-Next, the community has embraced the Qwen4 architecture with remarkable creativity. Built for efficient inference, the Qwen4 architecture has already found its way into a wide range of new use cases through community-driven work, especially in local, self-hosted deployment.

Meanwhile, we've been pushing hard to unlock the full potential of this next-generation architecture, culminating in Qwen4-Max, the flagship of the Qwen4 series: an ultra-sparse model designed for long-horizon agentic applications, with cost-effectiveness optimized across the board.

Building on the same architecture and training techniques, the Qwen4 open model series is now on its way, making the latest advances in Qwen's frontier AI available to an ever-wider community.

Qwen4 Highlights

Qwen4 features the following enhancement:

Efficient model architecture design: Built on a hybrid of linear attention and sparse attention, the Qwen4 architecture delivers outstanding efficiency in long-sequence scenarios — with faster inference and a drastically reduced cache footprint, enabling a native 1,000,000-token context window. Combined with n-gram embeddings, the architecture improves model quality without extra compute or accelerator memory overhead.

Significantly enhanced long-horizon agentic capabilities: Real-world productivity spans virtually every industry and profession. Throughout Qwen4's development, we went deep into the workflows of knowledge work, continually expanding the model's knowledge and capability boundaries, and achieved substantial progress in scenarios that demand sustained, long-term task delivery, with the goal of becoming a truly capable work assistant. Qwen4 also delivers stronger performance in coding for visual and creative deliverables, such as frontend development, 3D modeling, and game development with professional software & tools.

Improved token efficiency: Qwen4 substantially lowers the overall cost of task completion. Tasks require fewer interaction rounds, and within each round, thinking is markedly more concise across all effort levels, with the levels now clearly better separated. Paired with the architectural gains in inference efficiency, tasks complete faster and at lower cost.

Model Overview

Type: Causal Language Model with Vision Encoder

Training Stage: Pre-training & Post-training

Language Model Number of Parameters: 35B with 3B activated, plus 20B n-gram embedding and 2B MTP

Hidden Dimension: 2048

Token Embedding: 248320 (Padded)

N-gram Embedding: 10,000,000 (bigrams/trigrams at layer 2)

Number of Layers: 40

Hidden Layout: 10 × (3 × (Gated DeltaNet → MoE) → 1 × (Qwen Sparse Attention → MoE))

Gated DeltaNet: Number of Linear Attention Heads: 32 for V and 16 for QK

Head Dimension: 128

Qwen Sparse Attention: Number of Attention Heads: 16 for Q and 2 for KV

Head Dimension: 256

Rotary Position Embedding Dimension: 64

Indexer Structure: MQA with 4 Query Heads and 1 Shared Key Head

Indexer Head Dimension: 128

Budget: 512 blocks or 2048 tokens

Mixture Of Experts Number of Experts: 256

Number of Activated Experts: 8 Routed + 1 Shared

Expert Intermediate Dimension: 512

Gated Residual: Number of Branches: 4

Bottleneck Rank: 256

LM Output: 248320 (Padded)

MTP: 1 layer, trained with multi-steps

Context Length: 1,048,576 natively.

Benchmark Results

  1. Terminal Bench 4.1, FrontierCode-AA 2.0, AA-Briefcase v1.1 and AutomationBench-AA: Scores are cited from Artificial Analysis.

  2. APEX-Agents v1.1: Scores are cited from the Mercor leaderboard.

  3. Work360: Our built-in benchmark for evaluating models' capabilities across industrial and professional workflows.

  4. ChartoGraphy: The scores of our models were obtained with min_pixels set to 4096×32×32.

Quickstart

For streamlined integration, we recommend using Qwen4-35B-A3B via APIs.

Serving Qwen4-35B-A3B

Inference efficiency and throughput vary significantly across frameworks. We recommend using the latest framework versions to ensure optimal performance and compatibility. For production workloads or high-throughput scenarios, dedicated serving engines such as SGLang, vLLM, and TokenSpeed are strongly recommended.

Qwen4-35B-A3B can be deployed with popular inference frameworks for production-level serving, e.g.:

For local deployment, model repositories in compatible formats can be found in the model tree on the right. The Qwen4 architecture is supported by general-purpose inference engines such as llama.cpp, ollama, unsloth, mlx-vlm, and LiteRT-LM as well as by specialized inference engines for Qwen4.

Qwen4 Tokenizer

Along with the model weights, we release a reference implementation of the Qwen4 Tokenizer/Processor. It ships with the original BPE vocabulary and provides methods for formatting messages into token sequences and parsing messages from generated token sequences. The implementation additionally depends on tiktoken, and trust_remote_code=True is required when creating the tokenizer instance. We recommend using this implementation.

For ecosystems that rely on Jinja chat templates, we include one in tokenizer-compat/ for backward compatibility only. Please note that although it produces the same formatted text, the resulting token IDs can be different, since the reference implementation distinguishes control tokens from regular tokens at the ID level.

API Usage

We recommend using the following sets of sampling parameters for generation:

Please note that the support for sampling parameters varies according to inference frameworks.

Thinking Control

Qwen4 supports controlling thinking behavior via reasoning_effort and preserve_thinking. By default, Qwen4 operates in thinking mode reasoning_effort="high" and preserve_thinking enabled.

The supported reasoning effort levels are:

The enable_thinking switch can still be used and enable_thinking=False is equivalent to reasoning_effort="off". Please also note that the model may judge a task simple enough to answer directly without thinking, even at non-off reasoning effort levels.

In multi-turn agentic tasks, lower reasoning effort does not always reduce overall task completion time. Although it may produce faster per-turn responses, it can also lead to insufficient analysis, more failures, and repeated retries, which may increase total latency and token consumption.

Chat Completions API

The Chat Completions API is available in most inference frameworks, as well as on Qwen Cloud. You can call the API directly from your application, or connect it to agentic tools such as Qoder CLI and Qwen Code.

Below we show an example of calling the API directly. For connecting agentic applications, please refer to the respective guides for each tool.

Before starting, make sure it is installed and the API key and the API base URL is configured, e.g.:

pip install -U openai

Set the following accordingly

export OPENAI_BASE_URL="http://localhost:8000/v1" export OPENAI_API_KEY="EMPTY"

from openai import OpenAI

Configured by environment variables

client = OpenAI()

Text-only Input

messages = [ {"role": "user", "content": "Write a Python function to merge two sorted linked lists."}, ]

Image Input

messages = [

{

"role": "user",

"content": [

{

"type": "image_url",

"image_url": {

"url": "https://qianwe

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →