CoolFace
Modelpublic

GeneZC/MiniChat-2-3B

sourceHugging Faceapache-2.0updated 2y agoView on Hugging Face
24likes657downloads
README.md228 linesDownload Raw Back to root
1---2language:3- en4- zh5license: apache-2.06library_name: transformers7widget:8- text: <s> [|User|] Hi ๐Ÿ‘‹  </s>[|Assistant|]9model-index:10- name: MiniChat-2-3B11  results:12  - task:13      type: text-generation14      name: Text Generation15    dataset:16      name: AI2 Reasoning Challenge (25-Shot)17      type: ai2_arc18      config: ARC-Challenge19      split: test20      args:21        num_few_shot: 2522    metrics:23    - type: acc_norm24      value: 44.8825      name: normalized accuracy26    source:27      url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=GeneZC/MiniChat-2-3B28      name: Open LLM Leaderboard29  - task:30      type: text-generation31      name: Text Generation32    dataset:33      name: HellaSwag (10-Shot)34      type: hellaswag35      split: validation36      args:37        num_few_shot: 1038    metrics:39    - type: acc_norm40      value: 67.6941      name: normalized accuracy42    source:43      url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=GeneZC/MiniChat-2-3B44      name: Open LLM Leaderboard45  - task:46      type: text-generation47      name: Text Generation48    dataset:49      name: MMLU (5-Shot)50      type: cais/mmlu51      config: all52      split: test53      args:54        num_few_shot: 555    metrics:56    - type: acc57      value: 47.5958      name: accuracy59    source:60      url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=GeneZC/MiniChat-2-3B61      name: Open LLM Leaderboard62  - task:63      type: text-generation64      name: Text Generation65    dataset:66      name: TruthfulQA (0-shot)67      type: truthful_qa68      config: multiple_choice69      split: validation70      args:71        num_few_shot: 072    metrics:73    - type: mc274      value: 49.6475    source:76      url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=GeneZC/MiniChat-2-3B77      name: Open LLM Leaderboard78  - task:79      type: text-generation80      name: Text Generation81    dataset:82      name: Winogrande (5-shot)83      type: winogrande84      config: winogrande_xl85      split: validation86      args:87        num_few_shot: 588    metrics:89    - type: acc90      value: 66.4691      name: accuracy92    source:93      url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=GeneZC/MiniChat-2-3B94      name: Open LLM Leaderboard95  - task:96      type: text-generation97      name: Text Generation98    dataset:99      name: GSM8k (5-shot)100      type: gsm8k101      config: main102      split: test103      args:104        num_few_shot: 5105    metrics:106    - type: acc107      value: 32.68108      name: accuracy109    source:110      url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=GeneZC/MiniChat-2-3B111      name: Open LLM Leaderboard112---113 114## MiniChat-2-3B115 116๐Ÿ“‘ [arXiv](https://arxiv.org/abs/2311.07052) | ๐Ÿ‘ป [GitHub](https://github.com/GeneZC/MiniMA) | ๐Ÿค— [HuggingFace-MiniMA](https://huggingface.co/GeneZC/MiniMA-3B) | ๐Ÿค— [HuggingFace-MiniChat](https://huggingface.co/GeneZC/MiniChat-3B) | ๐Ÿค– [ModelScope-MiniMA](https://modelscope.cn/models/GeneZC/MiniMA-3B) | ๐Ÿค– [ModelScope-MiniChat](https://modelscope.cn/models/GeneZC/MiniChat-3B) | ๐Ÿค— [HuggingFace-MiniChat-1.5](https://huggingface.co/GeneZC/MiniChat-1.5-3B) | ๐Ÿค— [HuggingFace-MiniMA-2](https://huggingface.co/GeneZC/MiniMA-2-3B) | ๐Ÿค— [HuggingFace-MiniChat-2](https://huggingface.co/GeneZC/MiniChat-2-3B)117 118๐Ÿ†• **Updates from MiniChat-3B**: 119- better base model MiniMA-2-3B;120- better data mixture;121- use of [NEFTune](https://arxiv.org/abs/2310.05914);122- use of [DPO](https://arxiv.org/abs/2305.18290).123 124โ— Must comply with LICENSE of LLaMA2 since it is derived from LLaMA2.125 126A language model continued from MiniMA-3B and finetuned on both instruction and preference data.127 128Surpassing Vicuna-7B and approximating LLaMA-2-Chat-7B on MT-Bench.129 130<img src="./teaser_b.jpg" alt="teaser_b" width="687" />131 132**Standard Benchmarks**133 134|Method|TFLOPs|MMLU (5-shot)|CEval (5-shot)|DROP (3-shot)|HumanEval (0-shot)|BBH (3-shot)|GSM8K (8-shot)|135|--|--|--|--|--|--|--|--|136|Mamba-2.8B|4.6E9|25.58|24.74|15.72|7.32|29.37|3.49|137|ShearedLLaMA-2.7B|0.8E9|26.97|22.88|19.98|4.88|30.48|3.56|138|BTLM-3B|11.3E9|27.20|26.00|17.84|10.98|30.87|4.55|139|StableLM-3B|72.0E9|44.75|31.05|22.35|15.85|32.59|10.99|140|Qwen-1.8B|23.8E9|44.05|54.75|12.97|14.02|30.80|22.97|141|Phi-2-2.8B|159.9E9|56.74|34.03|30.74|46.95|44.13|55.42|142|LLaMA-2-7B|84.0E9|46.00|34.40|31.57|12.80|32.02|14.10|143||144|MiniMA-3B|4.0E9|28.51|28.23|22.50|10.98|31.61|8.11|145|MiniChat-3B|4.0E9|38.40|36.48|22.58|18.29|31.36|29.72|146|MiniMA-2-3B|13.4E9|40.14|44.65|23.10|14.63|31.43|8.87|147|MiniChat-2-3B|13.4E9|46.17|43.91|30.26|22.56|34.95|38.13|148 149**Instruction-following Benchmarks**150 151|Method|AlpacaEval|MT-Bench|MT-Bench-ZH|152|--|--|--|--|153|GPT-4|95.28|9.18|8.96|154|Zephyr-7B-Beta|90.60|7.34|6.27<sup>#</sup>|155|Vicuna-7B|76.84|6.17|5.22<sup>#</sup>|156|LLaMA-2-Chat-7B|71.37|6.27|5.43<sup>#</sup>|157|Qwen-Chat-7B|-|-|6.24|158|Phi-2-DPO|81.37|-|1.59<sup>#</sup><sup>$</sup>|159|StableLM-Zephyr-3B|76.00|6.64|4.31<sup>#</sup>|160|Rocket-3B|79.75|6.56|4.07<sup>#</sup>|161|Qwen-Chat-1.8B|-|-|5.65|162||163|MiniChat-3B|48.82|-|-|164|MiniChat-2-3B|77.30|6.23|6.04|165 166<sup>#</sup> specialized mainly for English.167 168<sup>$</sup> finetuned without multi-turn instruction data.169 170The following is an example code snippet to use MiniChat-2-3B:171 172```python173import torch174 175from transformers import AutoModelForCausalLM, AutoTokenizer176 177from conversation import get_default_conv_template178 179# MiniChat180tokenizer = AutoTokenizer.from_pretrained("GeneZC/MiniChat-2-3B", use_fast=False)181# GPU.182model = AutoModelForCausalLM.from_pretrained("GeneZC/MiniChat-2-3B", use_cache=True, device_map="auto", torch_dtype=torch.float16).eval()183# CPU.184# model = AutoModelForCausalLM.from_pretrained("GeneZC/MiniChat-2-3B", use_cache=True, device_map="cpu", torch_dtype=torch.float16).eval()185 186conv = get_default_conv_template("minichat")187 188question = "Implement a program to find the common elements in two arrays without using any extra data structures."189conv.append_message(conv.roles[0], question)190conv.append_message(conv.roles[1], None)191prompt = conv.get_prompt()192input_ids = tokenizer([prompt]).input_ids193output_ids = model.generate(194    torch.as_tensor(input_ids).cuda(),195    do_sample=True,196    temperature=0.7,197    max_new_tokens=1024,198)199output_ids = output_ids[0][len(input_ids[0]):]200output = tokenizer.decode(output_ids, skip_special_tokens=True).strip()201# output: "def common_elements(arr1, arr2):\n    if len(arr1) == 0:\n        return []\n    if len(arr2) == 0:\n        return arr1\n\n    common_elements = []\n    for element in arr1:\n        if element in arr2:\n            common_elements.append(element)\n\n    return common_elements"202# Multiturn conversation could be realized by continuously appending questions to `conv`.203```204 205## Bibtex206 207```bibtex208@article{zhang2023law,209    title={Towards the Law of Capacity Gap in Distilling Language Models},210    author={Zhang, Chen and Song, Dawei and Ye, Zheyu and Gao, Yan},211    year={2023},212    url={https://arxiv.org/abs/2311.07052}213}214```215# [Open LLM Leaderboard Evaluation Results](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard)216Detailed results can be found [here](https://huggingface.co/datasets/open-llm-leaderboard/details_GeneZC__MiniChat-2-3B)217 218|             Metric              |Value|219|---------------------------------|----:|220|Avg.                             |51.49|221|AI2 Reasoning Challenge (25-Shot)|44.88|222|HellaSwag (10-Shot)              |67.69|223|MMLU (5-Shot)                    |47.59|224|TruthfulQA (0-shot)              |49.64|225|Winogrande (5-shot)              |66.46|226|GSM8k (5-shot)                   |32.68|227 228