{"id":27776266,"url":"https://github.com/QwenLM/Qwen3","last_synced_at":"2025-04-30T05:04:00.415Z","repository":{"id":221013081,"uuid":"752925682","full_name":"QwenLM/Qwen3","owner":"QwenLM","description":"Qwen3 is the large language model series developed by Qwen team, Alibaba Cloud.","archived":false,"fork":false,"pushed_at":"2025-04-29T02:57:39.000Z","size":3241,"stargazers_count":17943,"open_issues_count":38,"forks_count":1218,"subscribers_count":118,"default_branch":"main","last_synced_at":"2025-04-29T03:46:16.629Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/QwenLM.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-02-05T05:45:08.000Z","updated_at":"2025-04-29T03:45:29.000Z","dependencies_parsed_at":"2024-03-31T16:23:25.703Z","dependency_job_id":"bfa70f8d-aa78-45b1-a398-48a8ae2764c4","html_url":"https://github.com/QwenLM/Qwen3","commit_stats":{"total_commits":175,"total_committers":31,"mean_commits":5.645161290322581,"dds":0.6514285714285715,"last_synced_commit":"b6c9f8a9767b02abd883b2a3b42708957264e61a"},"previous_names":["qwenlm/qwen1.5","qwenlm/qwen2","qwenlm/qwen2.5","qwenlm/qwen3"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QwenLM%2FQwen3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QwenLM%2FQwen3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QwenLM%2FQwen3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QwenLM%2FQwen3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/QwenLM","download_url":"https://codeload.github.com/QwenLM/Qwen3/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251644841,"owners_count":21620632,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-30T05:02:10.945Z","updated_at":"2025-04-30T05:04:00.408Z","avatar_url":"https://github.com/QwenLM.png","language":"Shell","funding_links":[],"categories":["精选文章","Summary","NLP","Python","🔓 Open Source Models","1. 经典的Reasoning Model","Open-source","🧠 Open-Source Models for Agents","Project List","Repos","🇨🇳 Leading Chinese AI Models","NLP per Language","2. Model Codebases \u0026 Model Families","Multilingual Models","🏭 Industrial / Production Model Reports"],"sub_categories":["开源大语言模型","3. Pretraining","Qwen (Alibaba)","Models","Benchmarks","\u003cspan id=\"tool\"\u003eLLM (LLM \u0026 Tool)\u003c/span\u003e","Qwen","Models and Embeddings","🔁 Iterative Self-Bootstrapping"],"readme":"# Qwen3\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://qianwen-res.oss-accelerate-overseas.aliyuncs.com/logo_qwen3.png\" width=\"400\"/\u003e\n\u003cp\u003e\n\n\u003cp align=\"center\"\u003e\n          💜 \u003ca href=\"https://chat.qwen.ai/\"\u003e\u003cb\u003eQwen Chat\u003c/b\u003e\u003c/a\u003e\u0026nbsp\u0026nbsp | \u0026nbsp\u0026nbsp🤗 \u003ca href=\"https://huggingface.co/Qwen\"\u003eHugging Face\u003c/a\u003e\u0026nbsp\u0026nbsp | \u0026nbsp\u0026nbsp🤖 \u003ca href=\"https://modelscope.cn/organization/qwen\"\u003eModelScope\u003c/a\u003e\u0026nbsp\u0026nbsp | \u0026nbsp\u0026nbsp 📑 Paper \u0026nbsp\u0026nbsp | \u0026nbsp\u0026nbsp 📑 \u003ca href=\"https://qwenlm.github.io/blog/qwen3/\"\u003eBlog\u003c/a\u003e \u0026nbsp\u0026nbsp ｜ \u0026nbsp\u0026nbsp📖 \u003ca href=\"https://qwen.readthedocs.io/\"\u003eDocumentation\u003c/a\u003e\n\u003cbr\u003e\n🖥️ \u003ca href=\"https://huggingface.co/spaces/Qwen/Qwen3-Demo\"\u003eDemo\u003c/a\u003e\u0026nbsp\u0026nbsp | \u0026nbsp\u0026nbsp💬 \u003ca href=\"https://github.com/QwenLM/Qwen/blob/main/assets/wechat.png\"\u003eWeChat (微信)\u003c/a\u003e\u0026nbsp\u0026nbsp | \u0026nbsp\u0026nbsp🫨 \u003ca href=\"https://discord.gg/CV4E9rpNSD\"\u003eDiscord\u003c/a\u003e\u0026nbsp\u0026nbsp\n\u003c/p\u003e\n\n\nVisit our Hugging Face or ModelScope organization (click links above), search checkpoints with names starting with `Qwen3-` or visit the [Qwen3 collection](https://huggingface.co/collections/Qwen/qwen3-67dd247413f0e2e4f653967f), and you will find all you need! Enjoy!\n\nTo learn more about Qwen3, feel free to read our documentation \\[[EN](https://qwen.readthedocs.io/en/latest/)|[ZH](https://qwen.readthedocs.io/zh-cn/latest/)\\]. Our documentation consists of the following sections:\n\n- Quickstart: the basic usages and demonstrations;\n- Inference: the guidance for the inference with Transformers, including batch inference, streaming, etc.;\n- Run Locally: the instructions for running LLM locally on CPU and GPU, with frameworks like llama.cpp and Ollama;\n- Deployment: the demonstration of how to deploy Qwen for large-scale inference with frameworks like SGLang, vLLM, TGI, etc.;\n- Quantization: the practice of quantizing LLMs with GPTQ, AWQ, as well as the guidance for how to make high-quality quantized GGUF files;\n- Training: the instructions for post-training, including SFT and RLHF (TODO) with frameworks like Axolotl, LLaMA-Factory, etc.\n- Framework: the usage of Qwen with frameworks for application, e.g., RAG, Agent, etc.\n\n## Introduction\n\nWe are excited to announce the release of Qwen3, the latest addition to the Qwen family of large language models.\nThese models represent our most advanced and intelligent systems to date, improving from our experience in building QwQ and Qwen2.5.\nWe are making the weights of Qwen3 available to the public, including both dense and Mixture-of-Expert (MoE) models. \n\nThe highlights from Qwen3 include:\n- **Dense and Mixture-of-Experts (MoE) models of various sizes**, available in 0.6B, 1.7B, 4B, 8B, 14B, 32B and 30B-A3B, 235B-A22B.\n- **Seamless switching between thinking mode** (for complex logical reasoning, math, and coding) and **non-thinking mode** (for efficient, general-purpose chat), ensuring optimal performance across various scenarios.\n- **Significantly enhancement in reasoning capabilities**, surpassing previous QwQ (in thinking mode) and Qwen2.5 instruct models (in non-thinking mode) on mathematics, code generation, and commonsense logical reasoning.\n- **Superior human preference alignment**, excelling in creative writing, role-playing, multi-turn dialogues, and instruction following, to deliver a more natural, engaging, and immersive conversational experience.\n- **Expertise in agent capabilities**, enabling precise integration with external tools in both thinking and unthinking modes and achieving leading performance among open-source models in complex agent-based tasks.\n- **Support of 100+ languages and dialects** with strong capabilities for **multilingual instruction following** and **translation**.\n\n\u003e [!IMPORTANT]\n\u003e Qwen3 models adopt a different naming scheme.\n\u003e\n\u003e The post-trained models do not use the \"-Instruct\" suffix anymore. For example, Qwen3-32B is the newer version of Qwen2.5-32B-Instruct.\n\u003e\n\u003e The base models now have names ending with \"-Base\".\n\n\n## News\n\n- 2025.04.29: We released the Qwen3 series. Check our [blog](https://qwenlm.github.io/blog/qwen3) for more details!\n- 2024.09.19: We released the Qwen2.5 series. This time there are 3 extra model sizes: 3B, 14B, and 32B for more possibilities. Check our [blog](https://qwenlm.github.io/blog/qwen2.5) for more!\n- 2024.06.06: We released the Qwen2 series. Check our [blog](https://qwenlm.github.io/blog/qwen2/)!\n- 2024.03.28: We released the first MoE model of Qwen: Qwen1.5-MoE-A2.7B! Temporarily, only HF transformers and vLLM support the model. We will soon add the support of llama.cpp, mlx-lm, etc. Check our [blog](https://qwenlm.github.io/blog/qwen-moe/) for more information!\n- 2024.02.05: We released the Qwen1.5 series.\n\n## Performance\n\nDetailed evaluation results are reported in this [📑 blog](https://qwenlm.github.io/blog/qwen3/).\n\nFor requirements on GPU memory and the respective throughput, see results [here](https://qwen.readthedocs.io/en/latest/getting_started/speed_benchmark.html).\n\n## Run Qwen3\n\n### 🤗 Transformers\n\nTransformers is a library of pretrained natural language processing for inference and training. \nThe latest version of `transformers` is recommended and `transformers\u003e=4.51.0` is required.\n\nThe following contains a code snippet illustrating how to use the model generate content based on given inputs. \n```python\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\nmodel_name = \"Qwen/Qwen3-8B\"\n\n# load the tokenizer and the model\ntokenizer = AutoTokenizer.from_pretrained(model_name)\nmodel = AutoModelForCausalLM.from_pretrained(\n    model_name,\n    torch_dtype=\"auto\",\n    device_map=\"auto\"\n)\n\n# prepare the model input\nprompt = \"Give me a short introduction to large language models.\"\nmessages = [\n    {\"role\": \"user\", \"content\": prompt}\n]\ntext = tokenizer.apply_chat_template(\n    messages,\n    tokenize=False,\n    add_generation_prompt=True,\n    enable_thinking=True # Switches between thinking and non-thinking modes. Default is True.\n)\nmodel_inputs = tokenizer([text], return_tensors=\"pt\").to(model.device)\n\n# conduct text completion\ngenerated_ids = model.generate(\n    **model_inputs,\n    max_new_tokens=32768\n)\noutput_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist() \n\n# the result will begin with thinking content in \u003cthink\u003e\u003c/think\u003e tags, followed by the actual response\nprint(tokenizer.decode(output_ids, skip_special_tokens=True))\n```\n\nBy default, Qwen3 models will think before response.\nThis could be controlled by\n- `enable_thinking=False`: Passing `enable_thinking=False` to `tokenizer.apply_chat_template` will strictly prevent the model from generating thinking content.\n- `/think` and `/nothink` instructions: Use those words in the system or user message to signify whether Qwen3 should think. In multi-turn conversations, the latest instruction is followed.\n\n\n\n### ModelScope\n\nWe strongly advise users especially those in mainland China to use ModelScope. \nModelScope adopts a Python API similar to Transformers.\nThe CLI tool `modelscope download` can help you solve issues concerning downloading checkpoints.\n\n\n### llama.cpp\n\n[`llama.cpp`](https://github.com/ggml-org/llama.cpp) enables LLM inference with minimal setup and state-of-the-art performance on a wide range of hardware.\n`llama.cpp\u003e=b5092` is required.\n\nTo use the CLI, run the following in a terminal:\n```shell\n./llama-cli -hf Qwen/Qwen3-8B-GGUF:Q8_0 --jinja --color -ngl 99 -fa -sm row --temp 0.6 --top-k 20 --top-p 0.95 --min-p 0 -c 40960 -n 32768 --no-context-shift\n# CTRL+C to exit\n```\n\nTo use the API server, run the following in a terminal:\n```shell\n./llama-server -hf Qwen/Qwen3-8B-GGUF:Q8_0 --jinja --reasoning-format deepseek -ngl 99 -fa -sm row --temp 0.6 --top-k 20 --top-p 0.95 --min-p 0 -c 40960 -n 32768 --no-context-shift --port 8080\n```\nA simple web front end will be at `http://localhost:8080` and an OpenAI-compatible API will be at `http://localhost:8080/v1`.\n\nFor additional guides, please refer to [our documentation](https://qwen.readthedocs.io/en/latest/run_locally/llama.cpp.html).\n\n\u003e [!TIP]\n\u003e llama.cpp adopts \"rotating context management\" and infinite generation is made possible by evicting earlier tokens.\n\u003e It could configured by parameters and the commands above effectively disable it.\n\u003e For more details, please refer to [our documentation](https://qwen.readthedocs.io/en/latest/run_locally/llama.cpp.html#llama-cli).\n\n\u003e [!IMPORTANT]\n\u003e The chat template uses features that are not supported by the template engine used by llama.cpp.\n\u003e As a result, you may encounter the following errors if the original chat template is used:\n\u003e ```\n\u003e common_chat_templates_init: failed to parse chat template (defaulting to chatml)\n\u003e ```\n\u003e We are working on a proper fix.\n\n### Ollama\n\nAfter [installing Ollama](https://ollama.com/), you can initiate the Ollama service with the following command (Ollama v0.6.6 or higher is required):\n```shell\nollama serve\n# You need to keep this service running whenever you are using ollama\n```\n\nTo pull a model checkpoint and run the model, use the `ollama run` command. You can specify a model size by adding a suffix to `qwen3`, such as `:8b` or `:30b-a3b`:\n```shell\nollama run qwen3:8b\n# Setting parameters, type \"/set parameter num_ctx 40960\" and \"/set parameter num_predict 32768\"\n# To exit, type \"/bye\" and press ENTER\n```\n\nYou can also access the Ollama service via its OpenAI-compatible API. \nPlease note that you need to (1) keep `ollama serve` running while using the API, and (2) execute `ollama run qwen3:8b` before utilizing this API to ensure that the model checkpoint is prepared.\nThe API is at `http://localhost:11434/v1/` by default.\n\nFor additional details, please visit [ollama.ai](https://ollama.com/).\n\n\u003e [!TIP]\n\u003e Ollama adopts the same \"rotating context management\" with llama.cpp.\n\u003e However, its default settings (`num_ctx` 2048 and `num_predict` -1), suggesting infinite generation with a 2048-token context,\n\u003e could lead to trouble for Qwen3 models.\n\u003e We recommend setting `num_ctx` and `num_predict` properly.\n\n### LMStudio\n\nQwen3 has already been supported by [lmstudio.ai](https://lmstudio.ai/). You can directly use LMStudio with our GGUF files.\n\n### MLX LM\n\nIf you are running on Apple Silicon, [`mlx-lm`](https://github.com/ml-explore/mlx-lm) also supports Qwen3 (`mlx-lm\u003e=0.24.0`). \nLook for models ending with MLX on Hugging Face Hub.\n\n\n\u003c!-- ### OpenVINO\n\nQwen2.5 has already been supported by [OpenVINO toolkit](https://github.com/openvinotoolkit). You can install and run this [chatbot example](https://github.com/OpenVINO-dev-contest/Qwen2.openvino) with Intel CPU, integrated GPU or discrete GPU.  --\u003e\n\n\n\u003c!-- ### Text generation web UI\n\nYou can directly use [`text-generation-webui`](https://github.com/oobabooga/text-generation-webui) for creating a web UI demo. If you use GGUF, remember to install the latest wheel of `llama.cpp` with the support of Qwen2.5. --\u003e\n\n\n\u003c!-- ### llamafile\n\nClone [`llamafile`](https://github.com/Mozilla-Ocho/llamafile), run source install, and then create your own llamafile with the GGUF file following the guide [here](https://github.com/Mozilla-Ocho/llamafile?tab=readme-ov-file#creating-llamafiles). You are able to run one line of command, say `./qwen.llamafile`, to create a demo. --\u003e\n\n\n## Deploy Qwen3\n\nQwen3 is supported by multiple inference frameworks. \nHere we demonstrate the usage of `SGLang` and `vLLM`.\nYou can also find Qwen3 models from various inference providers, e.g., [Alibaba Cloud Model Studio](https://www.alibabacloud.com/en/product/modelstudio).\n\n### SGLang\n\n[SGLang](https://github.com/sgl-project/sglang) is a fast serving framework for large language models and vision language models.\nSGLang could be used to launch a server with OpenAI-compatible API service. \n`sglang\u003e=0.4.6.post1` is required.\nIt is as easy as\n```shell\npython -m sglang.launch_server --model-path Qwen/Qwen3-8B --port 30000 --reasoning-parser qwen3\n```\nAn OpenAI-compatible API will be available at `http://localhost:30000/v1`.\n\n### vLLM\n\n[vLLM](https://github.com/vllm-project/vllm) is a high-throughput and memory-efficient inference and serving engine for LLMs.\n`vllm\u003e=0.8.5` is recommended.\n\n```shell\nvllm serve Qwen/Qwen3-8B --port 8000 --enable-reasoning --reasoning-parser deepseek_r1\n```\nAn OpenAI-compatible API will be available at `http://localhost:8000/v1`.\n\n### MindIE\n\nFor deployment on Ascend NPUs, please visit [Modelers](https://modelers.cn/) and search for Qwen3.\n\n\u003c!-- \n### OpenLLM\n\n[OpenLLM](https://github.com/bentoml/OpenLLM) allows you to easily run Qwen2.5 as OpenAI-compatible APIs. You can start a model server using `openllm serve`. For example:\n\n```bash\nopenllm serve qwen2.5:7b\n```\n\nThe server is active at `http://localhost:3000/`, providing OpenAI-compatible APIs. You can create an OpenAI client to call its chat API. For more information, refer to [our documentation](https://qwen.readthedocs.io/en/latest/deployment/openllm.html). --\u003e\n\n\n## Build with Qwen3\n\n### Tool Use\n\nFor tool use capabilities, we recommend taking a look at [Qwen-Agent](https://github.com/QwenLM/Qwen-Agent), which provides a wrapper around these APIs to support tool use or function calling with MCP support.\nTool use with Qwen3 can also be conducted with SGLang, vLLM, Transformers, llama.cpp, Ollama, etc.\nFollow guides in our documentation to see how to enable the support.\n\n\n### Finetuning\n\nWe advise you to use training frameworks, including [Axolotl](https://github.com/OpenAccess-AI-Collective/axolotl), [UnSloth](https://github.com/unslothai/unsloth), [Swift](https://github.com/modelscope/swift), [Llama-Factory](https://github.com/hiyouga/LLaMA-Factory), etc., to finetune your models with SFT, DPO, GRPO, etc.\n\n\n## License Agreement\n\nAll our open-source models are licensed under Apache 2.0. \nYou can find the license files in the respective Hugging Face repositories.\n\n## Citation\n\nIf you find our work helpful, feel free to give us a cite.\n\n```bibtex\n@article{qwen2.5,\n    title   = {Qwen2.5 Technical Report}, \n    author  = {An Yang and Baosong Yang and Beichen Zhang and Binyuan Hui and Bo Zheng and Bowen Yu and Chengyuan Li and Dayiheng Liu and Fei Huang and Haoran Wei and Huan Lin and Jian Yang and Jianhong Tu and Jianwei Zhang and Jianxin Yang and Jiaxi Yang and Jingren Zhou and Junyang Lin and Kai Dang and Keming Lu and Keqin Bao and Kexin Yang and Le Yu and Mei Li and Mingfeng Xue and Pei Zhang and Qin Zhu and Rui Men and Runji Lin and Tianhao Li and Tingyu Xia and Xingzhang Ren and Xuancheng Ren and Yang Fan and Yang Su and Yichang Zhang and Yu Wan and Yuqiong Liu and Zeyu Cui and Zhenru Zhang and Zihan Qiu},\n    journal = {arXiv preprint arXiv:2412.15115},\n    year    = {2024}\n}\n\n@article{qwen2,\n    title   = {Qwen2 Technical Report}, \n    author  = {An Yang and Baosong Yang and Binyuan Hui and Bo Zheng and Bowen Yu and Chang Zhou and Chengpeng Li and Chengyuan Li and Dayiheng Liu and Fei Huang and Guanting Dong and Haoran Wei and Huan Lin and Jialong Tang and Jialin Wang and Jian Yang and Jianhong Tu and Jianwei Zhang and Jianxin Ma and Jin Xu and Jingren Zhou and Jinze Bai and Jinzheng He and Junyang Lin and Kai Dang and Keming Lu and Keqin Chen and Kexin Yang and Mei Li and Mingfeng Xue and Na Ni and Pei Zhang and Peng Wang and Ru Peng and Rui Men and Ruize Gao and Runji Lin and Shijie Wang and Shuai Bai and Sinan Tan and Tianhang Zhu and Tianhao Li and Tianyu Liu and Wenbin Ge and Xiaodong Deng and Xiaohuan Zhou and Xingzhang Ren and Xinyu Zhang and Xipin Wei and Xuancheng Ren and Yang Fan and Yang Yao and Yichang Zhang and Yu Wan and Yunfei Chu and Yuqiong Liu and Zeyu Cui and Zhenru Zhang and Zhihao Fan},\n    journal = {arXiv preprint arXiv:2407.10671},\n    year    = {2024}\n}\n```\n\n## Contact Us\nIf you are interested to leave a message to either our research team or product team, join our [Discord](https://discord.gg/z3GAxXZ9Ce) or [WeChat groups](assets/wechat.png)!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FQwenLM%2FQwen3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FQwenLM%2FQwen3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FQwenLM%2FQwen3/lists"}