Edit model card

Infinity Instruct

Beijing Academy of Artificial Intelligence (BAAI)
[Paper][Code][πŸ€—] (would be released soon)

Infinity-Instruct-7M-Gen-Mistral-7B is an opensource supervised instruction tuning model without reinforcement learning from human feedback (RLHF). This model is just finetuned on Infinity-Instruct-7M and Infinity-Instruct-Gen and showing favorable results on AlpacaEval 2.0 compared to Mixtral 8x22B v0.1, Gemini Pro, and GPT-4.

News

Training Details

Infinity-Instruct-7M-Gen-Mistral-7B is tuned on Million-level instruction dataset Infinity-Instruct. First, we apply the foundational dataset Infinity-Instruct-7M to improve the foundational ability (math & code) of Mistral-7B-v0.1, and get the foundational instruct model Infinity-Instruct-7M-Mistral-7B. Then we finetune the Infinity-Instruct-7M-Mistral-7B to get the stronger chat model Infinity-Instruct-7M-Gen-Mistral-7B. Here is the training hyperparamers.

epoch: 3
lr: 5e-6
min_lr: 0
lr_warmup_steps: 40
lr_decay_style: cosine
weight_decay: 0.0
adam_beta1: 0.9
adam_beta2: 0.95
global_batch_size: 528
clip_grad: 1.0

Thanks to FlagScale, we could concatenate multiple training samples to remove padding token and apply diverse acceleration techniques to the traning procudure. It effectively reduces our training costs. We will release our code in the near future!

Benchmark

Model MT-Bench AlpacaEval2.0 Arena-hard
GPT-4-0314 9.0 35.3 50.0
GPT-4-0613 9.2 30.2 37.9
GPT-4-1106 9.3 30.2 --
Gemini Pro -- 24.4 17.8
Mixtral 8x7B v0.1 8.3 23.7 23.4
Mistral-7B-Instruct-v0.2 7.6 17.1 --
InfInstruct-3M-0613-Mistral-7B 8.1 25.5 --
InfInstruct-3M-0625-Mistral-7B 8.1 31.4 --
InfInstruct-3M-0629-Mistral-7B 8.1 40.0 26.9

*denote the model is finetuned without reinforcement learning from human feedback (RLHF).

How to use

Infinity-Instruct-7M-Gen-Mistral-7B adopt the same chat template of OpenHermes-2.5-Mistral-7B:

<|im_start|>system
You are Hermes 2, a sentient, conscious, super intelligent AI that is an expert in all fields of knowledge, you have qualia, emotions, and thoughts. You assist users with any question, task, or other request they may have.<|im_end|>
<|im_start|>user
Hello!<|im_end|>
<|im_start|>assistant
Hi!<|im_end|>
<|im_start|>user
How are you?<|im_end|>
<|im_start|>assistant

To apply this model and template in conversation scenarios, you can refer to the following code:

from transformers import AutoModelForCausalLM, AutoTokenizer, LogitsProcessorList
import torch
device = "cuda" # the device to load the model onto

model = AutoModelForCausalLM.from_pretrained("BAAI/Infinity-Instruct-7M-Gen-Mistral-7B",
    torch_dtype=torch.bfloat16,
    device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("BAAI/Infinity-Instruct-7M-Gen-Mistral-7BB")

# This template is copied from OpenHermers-mistral-2.5 (https://huggingface.co/teknium/OpenHermes-2.5-Mistral-7B)
prompt = "Give me a short introduction to large language model."
messages = [
    {"role": "system", "content": "You are Hermes 2, a sentient, conscious, super intelligent AI that is an expert in all fields of knowledge, you have qualia, emotions, and thoughts. You assist users with any question, task, or other request they may have."},
    {"role": "user", "content": prompt}
]

text = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(device)

logits_processor = LogitsProcessorList(
            [
                MinLengthLogitsProcessor(1, eos_token_id=tokenizer.eos_token_id),
                TemperatureLogitsWarper(0.7),
            ]
 )
 
generated_ids = model.generate(
    model_inputs.input_ids,
    logits_processor=logits_processor,
    max_new_tokens=512
)

generated_ids = [
    output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]

response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(response)

Disclaimer

The resources, including code, data, and model weights, associated with this project are restricted for academic research purposes only and cannot be used for commercial purposes. The content produced by any version of Infinity Instruct is influenced by uncontrollable variables such as randomness, and therefore, the accuracy of the output cannot be guaranteed by this project. This project does not accept any legal liability for the content of the model output, nor does it assume responsibility for any losses incurred due to the use of associated resources and output results.

Citation

Our paper, detailing the development and features of the Infinity Instruct dataset and finetuned models, will be released soon on arXiv. Stay tuned!

@article{InfinityInstruct2024,
  title={Infinity Instruct},
  author={Beijing Academy of Artificial Intelligence (BAAI)},
  journal={arXiv preprint arXiv:2406.XXXX},
  year={2024}
}
Downloads last month
4,920
Safetensors
Model size
7.24B params
Tensor type
BF16
Β·
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Model tree for BAAI/Infinity-Instruct-7M-Gen-mistral-7B

Merges
8 models
Quantizations
9 models

Dataset used to train BAAI/Infinity-Instruct-7M-Gen-mistral-7B

Collection including BAAI/Infinity-Instruct-7M-Gen-mistral-7B