{"data":{"slug":"ymcui-chinese-llama-alpaca-2","name":"Chinese-LLaMA-Alpaca-2","tagline":"Chinese LLaMA-2 & Alpaca-2 models with extended context lengths","github_url":"https://github.com/ymcui/Chinese-LLaMA-Alpaca-2","owner":"ymcui","repo":"Chinese-LLaMA-Alpaca-2","owner_avatar_url":"https://avatars.githubusercontent.com/u/16095339?v=4","primary_language":"Python","stars":7124,"forks":562,"topics":["64k","alpaca","alpaca-2","alpaca2","flash-attention","large-language-models","llama","llama-2","llama2","llm","nlp","rlhf","yarn"],"archived":false,"github_pushed_at":"2026-04-19T00:58:50+00:00","maintenance_label":"Slowing","stars_delta_30d":-8,"url":"https://www.graphcanon.com/tools/ymcui-chinese-llama-alpaca-2","markdown_url":"https://www.graphcanon.com/tools/ymcui-chinese-llama-alpaca-2.md","api_url":"https://www.graphcanon.com/api/graphcanon/tools/ymcui-chinese-llama-alpaca-2","graph_url":"https://www.graphcanon.com/api/graphcanon/graph?tool=ymcui-chinese-llama-alpaca-2","description":"中文LLaMA-2 & Alpaca-2大模型二期项目 + 64K超长上下文模型 (Chinese LLaMA-2 & Alpaca-2 LLMs with 64K long context models)","homepage_url":null,"license":"Apache-2.0","open_issues":6,"watchers":73,"ai_summary":"This repository contains Chinese versions of the LLaMA-2 and Alpaca-2 large language models, including both base models and instruction fine-tuned variants. Models are equipped to support longer contextual understanding up to 64K tokens.","readme_excerpt":"# [Chinese-LLaMA-Alpaca-3](https://github.com/ymcui/Chinese-LLaMA-Alpaca-3)项目启动！\n\n[**🇨🇳中文**](./README.md) | [**🌐English**](./README_EN.md) | [**📖文档/Docs**](https://github.com/ymcui/Chinese-LLaMA-Alpaca-2/wiki) | [**❓提问/Issues**](https://github.com/ymcui/Chinese-LLaMA-Alpaca-2/issues) | [**💬讨论/Discussions**](https://github.com/ymcui/Chinese-LLaMA-Alpaca-2/discussions) | [**⚔️竞技场/Arena**](http://llm-arena.ymcui.com/)\n\n<p align=\"center\">\n    <br>\n    <img src=\"./pics/banner.png\" width=\"800\"/>\n    <br>\n</p>\n<p align=\"center\">\n    <img alt=\"GitHub\" src=\"https://img.shields.io/github/license/ymcui/Chinese-LLaMA-Alpaca-2.svg?color=blue&style=flat-square\">\n    <img alt=\"GitHub release (latest by date)\" src=\"https://img.shields.io/github/v/release/ymcui/Chinese-LLaMA-Alpaca-2\">\n    <img alt=\"GitHub top language\" src=\"https://img.shields.io/github/languages/top/ymcui/Chinese-LLaMA-Alpaca-2\">\n    <a href=\"https://app.codacy.com/gh/ymcui/Chinese-LLaMA-Alpaca-2/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade\"><img src=\"https://app.codacy.com/project/badge/Grade/1710faac5e634acaabfc26b0a778cdde\"/></a>\n</p>\n\n\n本项目基于Meta发布的可商用大模型[Llama-2](https://github.com/facebookresearch/llama)开发，是[中文LLaMA&Alpaca大模型](https://github.com/ymcui/Chinese-LLaMA-Alpaca)的第二期项目，开源了**中文LLaMA-2基座模型和Alpaca-2指令精调大模型**。这些模型**在原版Llama-2的基础上扩充并优化了中文词表**，使用了大规模中文数据进行增量预训练，进一步提升了中文基础语义和指令理解能力，相比一代相关模型获得了显著性能提升。相关模型**支持FlashAttention-2训练**。标准版模型支持4K上下文长度，**长上下文版模型支持16K、64k上下文长度**。**RLHF系列模型**为标准版模型基础上进行人类偏好对齐精调，相比标准版模型在**正确价值观体现**方面获得了显著性能提升。\n\n#### 本项目主要内容\n\n- 🚀 针对Llama-2模型扩充了**新版中文词表**，开源了中文LLaMA-2和Alpaca-2大模型\n- 🚀 开源了预训练脚本、指令精调脚本，用户可根据需要进一步训练模型\n- 🚀 使用个人电脑的CPU/GPU快速在本地进行大模型量化和部署体验\n- 🚀 支持[🤗transformers](https://github.com/huggingface/transformers), [llama.cpp](https://github.com/ggerganov/llama.cpp), [text-generation-webui](https://github.com/oobabooga/text-generation-webui), [LangChain](https://github.com/hwchase17/langchain), [privateGPT](https://github.com/imartinez/privateGPT), [vLLM](https://github.com/vllm-project/vllm)等LLaMA生态\n\n#### 已开源的模型\n\n\n- 基座模型（4K上下文）：Chinese-LLaMA-2 (1.3B, 7B, 13B)\n- 聊天模型（4K上下文）：Chinese-Alpaca-2 (1.3B, 7B, 13B)\n- 长上下文模型（16K/64K）：\n  - Chinese-LLaMA-2-16K (7B, 13B) 、Chinese-Alpaca-2-16K (7B, 13B) \n  - Chinese-LLaMA-2-64K (7B)、Chinese-Alpaca-2-64K (7B)\n- 偏好对齐模型：Chinese-Alpaca-2-RLHF (1.3B, 7B)\n\n\n\n\n----\n\n[中文LLaMA&Alpaca大模型](https://github.com/ymcui/Chinese-LLaMA-Alpaca) | [多模态中文LLaMA&Alpaca大模型](https://github.com/airaria/Visual-Chinese-LLaMA-Alpaca) | [多模态VLE](https://github.com/iflytek/VLE) | [中文MiniRBT](https://github.com/iflytek/MiniRBT) | [中文LERT](https://github.com/ymcui/LERT) | [中英文PERT](https://github.com/ymcui/PERT) | [中文MacBERT](https://github.com/ymcui/MacBERT) | [中文ELECTRA](https://github.com/ymcui/Chinese-ELECTRA) | [中文XLNet](https://github.com/ymcui/Chinese-XLNet) | [中文BERT](https://github.com/ymcui/Chinese-BERT-wwm) | [知识蒸馏工具TextBrewer](https://github.com/airaria/TextBrewer) | [模型裁剪工具TextPruner](https://github.com/airaria/TextPruner) | [蒸馏裁剪一体化GRAIN](https://github.com/airaria/GRAIN)\n\n\n## 新闻\n\n**[2024/04/30] Chinese-LLaMA-Alpaca-3 已正式发布，开源基于Llama-3的Llama-3-Chinese-8B和Llama-3-Chinese-8B-Instruct，推荐所有一期、二期项目用户升级至三代模型，请参阅：https://github.com/ymcui/Chinese-LLaMA-Alpaca-3**\n\n[2024/03/27] 本项目已入驻机器之心SOTA!模型平台，欢迎关注：https://sota.jiqizhixin.com/project/chinese-llama-alpaca-2\n\n[2024/01/23] 添加新版GGUF模型（imatrix量化）、AWQ量化模型，支持vLLM下加载YaRN长上下文模型。详情查看[📚 v4.1版本发布日志](https://github.com/ymcui/Chinese-LLaMA-Alpaca-2/releases/tag/v4.1)\n\n[2023/12/29] 发布长上下文模型Chinese-LLaMA-2-7B-64K和Chinese-Alpaca-2-7B-64K，同时发布经过人类偏好对齐（RLHF）的Chinese-Alpaca-2-RLHF（1.3B/7B）。详情查看[📚 v4.0版本发布日志](https://github.com/ymcui/Chinese-LLaMA-Alpaca-2/releases/tag/v4.0)\n\n[2023/09/01] 发布长上下文模型Chinese-Alpaca-2-7B-16K和Chinese-Alpaca-2-13B-16K，该模型可直接应用于下游任务，例如privateGPT等。详情查看[📚 v3.1版本发布日志](https://github.com/ymcui/Chinese-LLaMA-Alpaca-2/releases/tag/v3.1)\n\n[2023/08/25] 发布长上下文模型Chinese-LLaMA-2-7B-16K和Chinese-LLaMA-2-13B-16K，支持16K上下文，并可通过NTK方法进一步扩展至24K+。详情查看","github_created_at":"2023-07-18T23:09:10+00:00","created_at":"2026-07-07T17:34:30.307476+00:00","updated_at":"2026-08-17T12:00:54.029671+00:00","categories":[{"slug":"llm-frameworks","name":"LLM Frameworks","url":"https://www.graphcanon.com/categories/llm-frameworks","markdown_url":"https://www.graphcanon.com/categories/llm-frameworks.md","api_url":"https://www.graphcanon.com/api/graphcanon/categories/llm-frameworks"}],"tags":[{"slug":"chinese","name":"chinese"},{"slug":"flash-attention","name":"flash-attention"},{"slug":"large-language-model-llm","name":"large language model (llm)"},{"slug":"long-context-models","name":"long context models"},{"slug":"nlp","name":"nlp"}],"trust":{"provenance":{"is_fork":false,"github_id":668052031,"owner_type":"User","methodology":"github_public_v1","parent_repo":null,"near_duplicate_slugs":[]},"computed_at":"2026-08-17T12:00:53.194Z","maintenance":{"label":"Slowing","score":36,"methodology":"github_public_v1","releases_90d":0,"days_since_push":120,"last_release_at":"2024-01-23T05:51:47Z","stars_delta_30d":-8,"open_issues_delta_30d":0},"security_summary":{"status":"findings","scanner":"osv@v1","low_count":73,"high_count":0,"last_scan_at":"2026-07-11T11:03:30.156Z","medium_count":0,"scan_profile":"deps","critical_count":0}},"capability_facts":{"scan":{"source":"repo_scan","observed_at":"2026-08-17T12:00:53.691Z"},"languages":{"value":["python"],"source":"github.language","observed_at":"2026-08-17T12:00:53.691Z"},"license_spdx":{"value":"Apache-2.0","source":"github.license","observed_at":"2026-08-17T12:00:53.691Z"}},"decision_facts":{"hosting":null,"pricing":null,"requirements":null,"constraints":null,"when_to_use":["When you need advanced models specifically tailored for the Chinese language, offering better performance compared to generic models","For projects that require handling very long text contexts up to 64K tokens, suitable for extensive document summarization or detailed dialogue analysis"],"when_not_to_use":["If your project requires support for languages other than Chinese, as the focus is on refining Chinese text understanding and generation","In scenarios where shorter context lengths (less than 16K tokens) are sufficient, as the extended models may be overkill in terms of resource usage"],"source":"enrich:decision_facts","observed_at":"2026-07-12T17:24:03.526Z"},"constraint_facets":null,"decision_summary":[{"label":"Adopt for","value":"Chinese-LLaMA-Alpaca-2 provides Chinese-specific versions of LLaMA-2 and Alpaca-2 with extended context lengths up to 64K tokens."}]}}