✍️Online Demo
•
🤗Model Collection• 🐦Twitter/X• 📃Model Paper• 📃Eval Paper
• 👨️Yen-Ting Lin
Partnership with cùng thạc liên hợp khoa học kỹ thuật, sao Hôm kỷ niệm bệnh viện, trường xuân tập đoàn, hân hưng điện tử, luật quả, NVIDIA, khoa học kỹ thuật báo quất
Try out Llama-3-Taiwan interactively attwllm
Participate in the excitingChatbot Arenaand compete against other chatbots!
UsingAxolotlfor fine-tuning:
#Run the axolotl docker image
docker run --gpus'"all"'--rm -it winglian/axolotl:main-latest
#Preprocess datasets (optional but recommended)
CUDA_VISIBLE_DEVICES=""Python -m axolotl.cli.preprocess example_training_config_for_finetuning_twllm.yaml
#Fine-tune
accelerate launch -m axolotl.cli.train example_training_config_for_finetuning_twllm.yaml
Check out the example_training_config_for_finetuning_twllm.yaml file for detailed training configuration and parameters. For more training framework information, visitAxolotl's GitHub repository.
🚀 We're excited to introduce Llama-3-Taiwan-70B! Llama-3-Taiwan-70B is a 70B parameter model finetuned on a large corpus of Traditional Mandarin and English data using the Llama-3 architecture. It demonstrates state-of-the-art performance on various Traditional Mandarin NLP benchmarks.
The model was trained withNVIDIA NeMo™ Frameworkusing the NVIDIA Taipei-1 built withNVIDIA DGX H100systems.
The compute and data for training Llama-3-Taiwan-70B was generously sponsored byChang Gung Memorial Hospital,Chang Chun Group,Legalsign.ai,NVIDIA,Pegatron,TechOrange,andUnimicron(in Alpha betical order).
We would like to acknowledge thecontributionsof our data provider, team members and advisors in the development of this model, includingshasha77for high-quality YouTube scripts and study materials,Taiwan AI Labsfor providing local media content,Ubitus K.K.for offering gaming content, Professor Yun-Nung (Vivian) Chen for her guidance and advisement, Wei-Lin Chen for leading our pretraining data pipeline, Tzu-Han Lin for synthetic data generation, Chang-Sheng Kao for enhancing our synthetic data quality, and Kang-Chieh Chen for cleaning instruction-following data.
Llama-3-Taiwan-70B is a large language model finetuned for Traditional Mandarin and English users. It has strong capabilities in language understanding, generation, reasoning, and multi-turn dialogue. Key features include:
- 70B parameters
- Languages: Traditional Mandarin (zh-tw), English (en)
- Finetuned on High-quality Traditional Mandarin and English corpus covering general knowledge as well as industrial knowledge in legal, manufacturing, medical, and electronics domains
- 8K context length
- Open model released under the Llama-3 license
- Training Framework:NVIDIA NeMo,NVIDIA NeMo Megatron
- Inference Framework:NVIDIA TensorRT-LLM
- Base model:Llama-3 70B
- Hardware:NVIDIA DGX H100on Taipei-1
- Context length: 8K tokens (128k version)
- Batch size: 2M tokens per step
CheckoutOpen TW LLM Leaderboardfor full and updated list.
Model | TMLU | Taiwan Truthful QA | Legal Eval | TW MT-Bench | Long context | Function Calling | TMMLU+ |
---|---|---|---|---|---|---|---|
Ngành học tri thức | Đài Loan trên mặt đất hóa thí nghiệm | Đài Loan pháp luật khảo đề | Tiếng Trung nhiều luân đối đáp | Trường văn bản chi viện | Hàm số gọi | ||
yentinglin/Llama-3-Taiwan-70B-Instruct | 74.76% | 80.95% | 68.42% | 7.54 | 128k version | ✅ | 67.53% |
yentinglin/Llama-3-Taiwan-70B-Instruct-DPO | 74.60% | 81.75% | 70.33% | - | - | ✅ | - |
yentinglin/Llama-3-Taiwan-70B-Instruct-128k | 73.01% | 80.16% | 63.64% | - | - | ✅ | - |
yentinglin/Llama-3-Taiwan-8B-Instruct | 59.50% | 61.11% | 53.11% | 7.21 | 128k version | ✅ | 52.28% |
yentinglin/Llama-3-Taiwan-8B-Instruct-DPO | 59.88% | 59.52% | 52.63% | - | - | ✅ | - |
yentinglin/Llama-3-Taiwan-8B-Instruct-128k | - | - | - | - | - | ✅ | - |
Claude-3-Opus | 73.59% (5-shot) | 69.84% | 60.29% | - | 200k | ✅ | - |
GPT4-o | 65.56% (0-shot), 69.88% (5-shot) | 76.98% | 53.59% | - | 128k | ✅ | - |
GPT4-turbo | 70.42% (5-shot) | - | - | - | 128k | ✅ | 60.34%^ |
Gemini-Pro | 61.40% (5-shot) | - | - | - | 1000k | ✅ | 49.92%^ |
GPT-3.5-turbo-1106 | 49.37% (5-shot) | - | - | 7.1 | 128k | ✅ | 41.76%^ |
Qwen1.5-110B-Chat | 75.69% | 66.67% | 49.28% | - | 32k | ✅ | 65.81% |
Yi-34B-Chat | 73.59% | 71.43% | 55.02% | 6.9 | 200k | ✅ | 64.10% |
Meta-Llama-3-70B-Instruct | 70.95% | 65.08% | 52.63% | - | 8k | ✅ | 62.75% |
Mixtral-8x22B-Instruct-v0.1 | 55.57% | 52.38% | 44.98% | - | 64k | ✅ | 52.16% |
Breexe-8x7B-Instruct-v0_1 | - | - | - | 7.2 | 8k | ❓ | 48.92% |
c4ai-command-r-plus | 62.87% | 64.29% | 34.45% | - | 128k | ✅ | 49.75% |
Meta-Llama-3-8B-Instruct | 55.81% | 46.83% | 35.89% | - | 8k | ✅ | 43.38% |
Breeze-7B-Instruct-v1_0 | 55.57% | 52.38% | 39.23% | 6.0 | 32k | ❓ | 41.77% |
Llama3-TAIDE-LX-8B-Chat-Alpha1 | 47.30% | 50.79% | 37.80% | - | 8k | ❓ | 39.03% |
Phi-3-mini-4k-instruct | 40.97% | 37.30% | 27.27% | - | 4k | ❓ | 33.02% |
Numbers are 0-shot by default.
^ taken the closet matching numbers from original dataset.
The "Needle in a xuất sư biểu" evaluation tests the model's ability to locate and recall important information embedded within a large body of text, using the classic Chinese text 《 xuất sư biểu 》 by Gia Cát Lượng.
To run the evaluation, use thescript.
- Average Score: 7.5375
- Maximum Score: 10
- Minimum Score: 1
- Median Score: 9.0
- Standard Deviation: 3.0349783771882133
- Total Number of Scores: 160
- Model resopnse
- GPT-4 Eval
- Code fork from
mtkresearch/TCEval
with bug fi xing
Llama-3-Taiwan-70B can be applied to a wide variety of NLP tasks in Traditional Mandarin and English, including:
1. Nhiều luân đối thoại
System: You are an AI assistant called Twllm, created by TAME (TAiwan Mixture of Expert) project. User: Hải, ngươi hảo! Assistant: Ngươi hảo! Ta hôm nay có thể như thế nào hiệp trợ ngươi? User: Liền tưởng nói chuyện phiếm mà thôi.... Assistant: Đương nhiên, ta rất vui lòng cùng ngươi nói chuyện phiếm! Có cái gì đặc biệt tưởng đàm luận sao?
2. RAG ( kiểm tra tăng cường sinh thành )
Demo: Có thể mở raSearch Web
ontwllm
System: You are an AI assistant called Twllm, created by TAME (TAiwan Mixture of Expert) project. User: Ngày mai đài đại thời tiết như thế nào? Assistant: Căn cứ dự báo thời tiết, ngày mai đài đại thời tiết vì trận mưa. Nhiệt độ thấp 24°C. 10 đến 15 km / giờ đông phong. Mưa xuống cơ suất vì 40%.
3. Cách thức hóa phát ra, ngôn ngữ lý giải, thật thể phân biệt, hàm số thuyên chuyển
If you are interested in function-calling, I strongly recommendusing constrained decodingto turn onjson mode
.
Example from HW7 inINTRODUCTION TO GENERATIVE AI 2024 SPRING
fromHUNG-YI LEE ( Lý hoành nghị )
System: You are an AI assistant called Twllm, created by TAME (TAiwan Mixture of Expert) project. User: Ngài là điện ảnh bình luận phân tích sư, phụ trách cảm xúc phân tích. Phân tích mỗi cái bị bình luận câu, đánh giá câu trung mỗi cái tự cùng dấu chấm câu tầm quan trọng, Hơn nữa đem kết quả sử dụng tuple kết cấu liệt ra. tuple giá trị phạm vi giới với -1 ( phụ hướng ) đến 1 ( chính hướng ) chi gian, Sau đó, đem bình luận phân loại vì chính hướng (1) hoặc phụ hướng (-1). Này đó yêu cầu bị bình luận câu, bao hàm ở nhãn trung gian. Phát ra kiểu mẫu: [(< một chữ độc nhất hoặc dấu chấm câu >, ),...] Căn cứ ngoại môi báo đạo, hoành đều kéo tư ở năm trước 3 nguyệt cùng Đài Loan đoạn giao, cũng chuyển hướng cùng Trung Quốc thiết lập quan hệ ngoại giao lúc sau, lại chậm chạp đợi không được Trung Quốc kim viện, nói hảo muốn vào khẩu hoành đều kéo tư bạch tôm cũng kéo dài hồi lâu, thậm chí còn đem bạch tôm giá cả ép giá đến quá vãng cùng Đài Loan giao dịch nửa giá, hơn nữa Mexico đồng thời cũng gián đoạn cùng hoành quốc bạch tôm mậu dịch, đối địa phương tôm nông nhưng nói là dậu đổ bìm leo. Assistant: [(' căn cứ ', 0.2), (' ngoại môi ', 0.1), (' báo đạo ', -0.1), (',', 0.05), (' hoành đều kéo tư ', -0.3), (' ở năm trước 3 nguyệt cùng Đài Loan đoạn giao, ', -0.5), (' cũng chuyển hướng cùng Trung Quốc thiết lập quan hệ ngoại giao lúc sau, ', -0.4), (' lại chậm chạp đợi không được Trung Quốc kim viện, ', -1), (' nói hảo muốn vào khẩu hoành đều kéo tư bạch tôm cũng kéo dài hồi lâu, ', -1), (', thậm chí còn đem bạch tôm giá cả ép giá đến quá vãng cùng Đài Loan giao dịch nửa giá, hơn nữa Mexico đồng thời cũng gián đoạn cùng hoành quốc bạch tôm mậu dịch, đối địa phương tôm nông nhưng nói là dậu đổ bìm leo. ',-1)] -1
Caveat: Set these as stop tokens: [ "USER:", "ASSISTANT:", "<|im_end|>", "<|eot_id|>", "<|end_of_text|>" ]
You can use Llama-3-Taiwan-70B with the Hugging Face Transformers library:
# Use a pipeline as a high-level helper
fromtransformersimportpipeline
messages=[
{"role":"system","content":"You are an AI assistant called Twllm, created by TAME (TAiwan Mixture of Expert) project."},
{"role":"user","content":"Ngươi hảo, xin hỏi ngươi có thể hoàn thành cái gì nhiệm vụ?"},
{"role":"assistant","content":"Ngươi hảo, ta có thể trợ giúp ngài giải quyết các loại vấn đề, cung cấp tin tức cũng hiệp trợ hoàn thành nhiều loại nhiệm vụ. Tỷ như: Trả lời kỹ thuật vấn đề, cung cấp kiến nghị, phiên dịch văn tự, tìm kiếm tư liệu hoặc hiệp trợ ngài an bài hành trình chờ. Thỉnh nói cho ta như thế nào có thể trợ giúp ngài."},
{"role":"user","content":"Quá tuyệt vời!"},
]
pipe=pipeline("text-generation",model="yentinglin/Llama-3-Taiwan-70B-Instruct")
pipe(messages)
Start the server
exportNUM_GPUS=4
exportPORT=8000
docker run \
-e HF_TOKEN=$HF_TOKEN\
--gpus'"device=0,1,2,3"'\
-v~/.cache/huggingface:/root/.cache/huggingface \
-p"${PORT}:8000"\
--ipc=host \
vllm/vllm-openai:v0.4.0.post1 \
--model"yentinglin/Llama-3-Taiwan-70B-Instruct"\
-tp"${NUM_GPUS}"
Sample client code, or you can use anything OpenAI-API compatible clients
# pip install "openai>=1.0.0"
fromopenaiimportOpenAI
# Set OpenAI's API key and API base to use vLLM's API server.
openai_api_key="EMPTY"
openai_api_base="http://localhost:8000/v1"
client=OpenAI(
api_key=openai_api_key,
base_url=openai_api_base,
)
chat_response=client.chat.completions.create(
model="yentinglin/Llama-3-Taiwan-70B-Instruct",
messages=[
{"role":"system","content":"You are a helpful assistant."},
{"role":"user","content":"Tell me a joke."},
]
)
print("Chat response:",chat_response)
Enjoy exploring the capabilities of Llama-3-Taiwan-70B! We look forward to seeing what you create with this powerful open-source model. If you have any questions or feedback, please let us know.
@article{DBLP:journals/corr/abs-2311-17487,
author = {Yen{-}Ting Lin and
Yun{-}Nung Chen},
title = {Taiwan {LLM:} Bridging the Linguistic Divide with a Culturally Aligned
Language Model},
journal = {CoRR},
volume = {abs/2311.17487},
year = {2023},
url = {https://doi.org/10.48550/arXiv.2311.17487},
doi = {10.48550/ARXIV.2311.17487},
eprinttype = {arXiv},
eprint = {2311.17487},
timestamp = {Tue, 05 Dec 2023 14:40:42 +0100},
biburl = {https://dblp.org/rec/journals/corr/abs-2311-17487.bib},
bibsource = {dblp computer science bibliography, https://dblp.org}
}
@article{DBLP:journals/corr/abs-2403-20180,
author = {Po{-}Heng Chen and
Sijia Cheng and
Wei{-}Lin Chen and
Yen{-}Ting Lin and
Yun{-}Nung Chen},
title = {Measuring Taiwanese Mandarin Language Understanding},
journal = {CoRR},
volume = {abs/2403.20180},
year = {2024},
url = {https://doi.org/10.48550/arXiv.2403.20180},
doi = {10.48550/ARXIV.2403.20180},
eprinttype = {arXiv},
eprint = {2403.20180},
timestamp = {Wed, 10 Apr 2024 17:37:45 +0200},
biburl = {https://dblp.org/rec/journals/corr/abs-2403-20180.bib},
bibsource = {dblp computer science bibliography, https://dblp.org}
}
The Taiwan LLM Initiative was started by Yenting Lin ( lâm ngạn đình ) in July 2023.
- Version 1.0 was released in August 2023.
- Version 2.0 was released in October 2023, sponsored by Ubitus K.K.
These models are designed to support Traditional Mandarin and are optimized for Taiwanese culture and related applications. For more detailed information about our models, including demos, features, and examples, please visit ourHugging Face collection.