CoolFace
Modelpublic

GeneZC/MiniChat-2-3B

sourceHugging Faceapache-2.0updated 2y agoView on Hugging Face
24likes657downloads
Model Card

MiniChat-2-3B

๐Ÿ“‘ arXiv | ๐Ÿ‘ป GitHub | ๐Ÿค— HuggingFace-MiniMA | ๐Ÿค— HuggingFace-MiniChat | ๐Ÿค– ModelScope-MiniMA | ๐Ÿค– ModelScope-MiniChat | ๐Ÿค— HuggingFace-MiniChat-1.5 | ๐Ÿค— HuggingFace-MiniMA-2 | ๐Ÿค— HuggingFace-MiniChat-2

๐Ÿ†• Updates from MiniChat-3B:

  • โ€”better base model MiniMA-2-3B;
  • โ€”better data mixture;
  • โ€”use of NEFTune;
  • โ€”use of DPO.

โ— Must comply with LICENSE of LLaMA2 since it is derived from LLaMA2.

A language model continued from MiniMA-3B and finetuned on both instruction and preference data.

Surpassing Vicuna-7B and approximating LLaMA-2-Chat-7B on MT-Bench.

<img src="./teaserb.jpg" alt="teaserb" width="687" />

Standard Benchmarks

MethodTFLOPsMMLU (5-shot)CEval (5-shot)DROP (3-shot)HumanEval (0-shot)BBH (3-shot)GSM8K (8-shot)
Mamba-2.8B4.6E925.5824.7415.727.3229.373.49
ShearedLLaMA-2.7B0.8E926.9722.8819.984.8830.483.56
BTLM-3B11.3E927.2026.0017.8410.9830.874.55
StableLM-3B72.0E944.7531.0522.3515.8532.5910.99
Qwen-1.8B23.8E944.0554.7512.9714.0230.8022.97
Phi-2-2.8B159.9E956.7434.0330.7446.9544.1355.42
LLaMA-2-7B84.0E946.0034.4031.5712.8032.0214.10
MiniMA-3B4.0E928.5128.2322.5010.9831.618.11
MiniChat-3B4.0E938.4036.4822.5818.2931.3629.72
MiniMA-2-3B13.4E940.1444.6523.1014.6331.438.87
MiniChat-2-3B13.4E946.1743.9130.2622.5634.9538.13

Instruction-following Benchmarks

MethodAlpacaEvalMT-BenchMT-Bench-ZH
GPT-495.289.188.96
Zephyr-7B-Beta90.607.346.27<sup>#</sup>
Vicuna-7B76.846.175.22<sup>#</sup>
LLaMA-2-Chat-7B71.376.275.43<sup>#</sup>
Qwen-Chat-7B--6.24
Phi-2-DPO81.37-1.59<sup>#</sup><sup>$</sup>
StableLM-Zephyr-3B76.006.644.31<sup>#</sup>
Rocket-3B79.756.564.07<sup>#</sup>
Qwen-Chat-1.8B--5.65
MiniChat-3B48.82--
MiniChat-2-3B77.306.236.04

<sup>#</sup> specialized mainly for English.

<sup>$</sup> finetuned without multi-turn instruction data.

The following is an example code snippet to use MiniChat-2-3B:

python
import torch

from transformers import AutoModelForCausalLM, AutoTokenizer

from conversation import get_default_conv_template

# MiniChat
tokenizer = AutoTokenizer.from_pretrained("GeneZC/MiniChat-2-3B", use_fast=False)
# GPU.
model = AutoModelForCausalLM.from_pretrained("GeneZC/MiniChat-2-3B", use_cache=True, device_map="auto", torch_dtype=torch.float16).eval()
# CPU.
# model = AutoModelForCausalLM.from_pretrained("GeneZC/MiniChat-2-3B", use_cache=True, device_map="cpu", torch_dtype=torch.float16).eval()

conv = get_default_conv_template("minichat")

question = "Implement a program to find the common elements in two arrays without using any extra data structures."
conv.append_message(conv.roles[0], question)
conv.append_message(conv.roles[1], None)
prompt = conv.get_prompt()
input_ids = tokenizer([prompt]).input_ids
output_ids = model.generate(
    torch.as_tensor(input_ids).cuda(),
    do_sample=True,
    temperature=0.7,
    max_new_tokens=1024,
)
output_ids = output_ids[0][len(input_ids[0]):]
output = tokenizer.decode(output_ids, skip_special_tokens=True).strip()
# 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"
# Multiturn conversation could be realized by continuously appending questions to `conv`.

Bibtex

bibtex
@article{zhang2023law,
    title={Towards the Law of Capacity Gap in Distilling Language Models},
    author={Zhang, Chen and Song, Dawei and Ye, Zheyu and Gao, Yan},
    year={2023},
    url={https://arxiv.org/abs/2311.07052}
}

Open LLM Leaderboard Evaluation Results

Detailed results can be found here

MetricValue
Avg.51.49
AI2 Reasoning Challenge (25-Shot)44.88
HellaSwag (10-Shot)67.69
MMLU (5-Shot)47.59
TruthfulQA (0-shot)49.64
Winogrande (5-shot)66.46
GSM8k (5-shot)32.68