/ Модель

Характеристики

Контекст
32 768 токенов
Параметры
7,2 млрд
Лицензия
Своя лицензия
Архитектура
mistral · dense
Опубликована
29 янв 2024

SeaLLM-7B-v2

Генерация текстаТекст → текст9 профессий

Диалоговая модель на основе Mistral-7B для генерации текста, инструкций и рассуждений на английском и языках Юго-Восточной Азии.

9 320скачиваний за 30 дней70лайковвеса обновлены24 июл 2024

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Тесты пользователейпока нет

Никто ещё не опубликовал тест этой модели. Соберите бенчмарк из своих задач — результат появится здесь.

  1. Добавьте модель в бенчмарк

    Вместе с другими моделями категории «Текст» — сравнение идёт внутри одной категории.

  2. Опишите свои задачи

    Напишите запросы, при необходимости приложите файлы и эталонные ответы.

  3. Запустите и опубликуйте

    Модели ответят на каждую задачу, судья оценит ответы. Опубликованный результат появится на этой странице.

Публичные оценки6

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

  • GPQA

    GPQA Raw · выше — лучше

    Результат

    0,2785

    Open LLM v2 · архив

    Публичная таблицадругая ревизия

  • IFEval

    IFEval Raw · выше — лучше

    Результат

    0,3671

    Open LLM v2 · архив

    Публичная таблицадругая ревизия

  • MUSR

    MUSR Raw · выше — лучше

    Результат

    0,407

    Open LLM v2 · архив

    Публичная таблицадругая ревизия

  • MATH Lvl 5

    MATH Lvl 5 Raw · выше — лучше

    Результат

    0,0853

    Open LLM v2 · архив

    Публичная таблицадругая ревизия

  • BBH

    BBH Raw · выше — лучше

    Результат

    0,4902

    Open LLM v2 · архив

    Публичная таблицадругая ревизия

  • MMLU-PRO

    MMLU-PRO Raw · выше — лучше

    Результат

    0,3083

    Open LLM v2 · архив

    Публичная таблицадругая ревизия

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

SeaLLM-7B-v2 — мультиязычная языковая модель для языков Юго-Восточной Азии, разработанная командой SeaLLMs. Модель основана на Mistral-7B: авторы продолжили предварительное обучение и настроили её с упором на рассуждения. По метаданным это плотная архитектура Mistral с 7,2 млрд параметров; она поддерживает контекст до 32 768 токенов и предназначена для диалогового текстового взаимодействия.

Модель подходит для генерации ответов и инструкций, решения математических задач, рассуждений здравого смысла и ответов на вопросы на английском, китайском, вьетнамском, индонезийском, тайском, малайском, кхмерском, лаосском, бирманском и тагальском языках. В карточке приведены результаты на мультиязычных математических и общих знаниях, включая тесты для нескольких языков региона; качество может различаться в зависимости от языка и задачи.

Возможны неточные, вводящие в заблуждение или потенциально вредные ответы, поэтому перед внедрением модель следует проверять и защищать от небезопасных сценариев. В метаданных указана лицензия other, а карточка требует соблюдать условия SeaLLMs Terms of Use.

Сценарии применения

  • ответы на вопросы и диалог на языках Юго-Восточной Азии
  • решение математических задач с пошаговыми рассуждениями
  • выполнение текстовых инструкций на нескольких языках
  • ответы на вопросы по общим знаниям на вьетнамском, тайском и других языках региона

Ограничения

Модель может выдавать неточные, вводящие в заблуждение или потенциально вредные ответы; качество зависит от языка и задачи. Перед внедрением авторы рекомендуют проводить red teaming и применять меры безопасности.

Для каких профессий подходит9

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Также подходит для

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

SeaLLM-7B-v2 - Large Language Models for Southeast Asia

BIG NEWS: SeaLLM3 is released with state-of-the-art performance of diverse tasks while specifically enhanced to be more trustworthy. Please consider using that latest model version.

We introduce SeaLLM-7B-v2, the state-of-the-art multilingual LLM for Southeast Asian (SEA) languages 🇬🇧 🇨🇳 🇻🇳 🇮🇩 🇹🇭 🇲🇾 🇰🇭 🇱🇦 🇲🇲 🇵🇭. It is the most significant upgrade since SeaLLM-13B, with half the size, outperforming performance across diverse multilingual tasks, from world knowledge, math reasoning, instruction following, etc.

Highlights

  • SeaLLM-7B-v2 achieves the 7B-SOTA on the Zero-shot CoT GSM8K task with 78.2 score and outperforms GPT-3.5 in many GSM8K-translated tasks in SEA languages (🇨🇳 🇻🇳 🇮🇩 🇹🇭) as well as MGSM (🇨🇳 🇹🇭). It also surpasses GPT-3.5 in MATH CoT for Thai 🇹🇭.
  • It scores competitively against GPT-3.5 in many zero-shot CoT commonsense benchmark, with 82.5, 68.3, 80.9 scores on Arc-C, Winogrande, and Hellaswag.
  • It achieves 7.54 score on the 🇬🇧 MT-bench, it ranks 3rd place on the leaderboard for 7B category and is the most outperforming multilingual model.
  • It scores 45.74 on the VMLU benchmark for Vietnamese 🇻🇳, and is the only open-source multilingual model that can be competitive to monolingual models (Vistral-7B) of similar sizes.

Release and DEMO

Disclaimer: We must note that even though the weights, codes, and demos are released in an open manner, similar to other pre-trained language models, and despite our best efforts in red teaming and safety fine-tuning and enforcement, our models come with potential risks, including but not limited to inaccurate, misleading or potentially harmful generation. Developers and stakeholders should perform their own red teaming and provide related security measures before deployment, and they must abide by and comply with local governance and regulations. In no event shall the authors be held liable for any claim, damages, or other liability arising from the use of the released weights, codes, or demos.

The logo was generated by DALL-E 3.

What's new since SeaLLM-13B-v1 and SeaLLM-7B-v1?

  • SeaLLM-7B-v2 is continue-pretrained from Mistral-7B and underwent carefully designed tuning with focus in reasoning.

Evaluation

Zero-shot CoT Multilingual Math Reasoning

SeaLLM-7B-v2 achieves with 78.2 score on the GSM8K with zero-shot CoT reasoning, making it the state of the art in the realm of 7B models. It also outperforms GPT-3.5 in the same GSM8K benchmark as translated into SEA languages (🇨🇳 🇻🇳 🇮🇩 🇹🇭). SeaLLM-7B-v2 also surpasses GPT-3.5 on the Thai-translated MATH benchmark, with 22.4 vs 18.1 scores.

fig_sea_math_side_by_side.png

ModelGSM8KenMATHenGSM8KzhMATHzhGSM8KviMATHviGSM8KidMATHidGSM8KthMATHth
GPT-3.580.834.148.221.55526.564.326.435.818.1
Qwen-14B-chat61.418.441.611.833.63.644.78.6226
Vistral-7b-chat48.212.548.73.1
Qwen1.5-7B-chat56.815.3402.737.7936.97.721.9
SeaLLM-7B-v278.227.553.717.669.923.871.524.459.622.4

Baselines were evaluated using their respective chat-template and system prompts (Qwen1.5-7B-chat, Vistral).

Zero-shot MGSM

SeaLLM-7B-v2 also outperforms GPT-3.5 and Qwen-14B on the multilingual MGSM for Zh and Th.

ModelMGSM-ZhMGSM-Th
ChatGPT (reported)61.247.2
Qwen-14B-chat59.628
SeaLLM-7B-v264.862.4

Zero-shot Commonsense Reasoning

We compare SeaLLM-7B-v2 with ChatGPT and Mistral-7B-instruct on various zero-shot commonsense benchmarks (Arc-Challenge, Winogrande and Hellaswag). We use the 2-stage technique in (Kojima et al., 2023) to grab the answer. Note that we DID NOT use "Let's think step-by-step" to invoke explicit CoT.

0-shot reasoningArc-ChallengeWinograndeHellaswag
ChatGPT (reported)84.6*66.8*72.0*
ChatGPT (reproduced)84.163.179.5
Mistral-7B-Instruct68.156.445.6
Qwen1.5-7B-chat79.359.469.3
SeaLLM-7B-v282.568.380.9

Baselines were evaluated using their respective chat-template and system prompts (Qwen1.5-7B-chat, Mistral).

Multilingual World Knowledge

We evaluate models on 3 benchmarks following the recommended default setups: 5-shot MMLU for En, 3-shot M3Exam (M3e) for En, Zh, Vi, Id, Th, and zero-shot VMLU for Vi.

ModelLangsEnMMLUEnM3eZhM3eViM3eViVMLUIdM3eThM3e
GPT-3.5Multi68.9075.4660.2058.6446.3249.2737.41
Vistral-7B-chatMono56.8667.0044.5654.3350.0336.4925.27
Qwen1.5-7B-chatMulti61.0052.0781.9643.3845.0224.2920.25
SeaLLM-7B-v2Multi61.8970.9155.4351.1545.7442.2535.52

VMLU reproduce script here. Lm-eval was used to evaluate MMLU. 0-shot VMLU scores for baselines were evaluated using their respective chat-template and system prompts (Qwen1.5-7B-chat).

MT-Bench

On the English MT-bench metric, SeaLLM-7B-v2 achieves 7.54 score on the MT-bench (3rd place on the leaderboard for 7B category), outperforms many 70B models and is arguably the only one that handles 10 SEA languages.

Refer to mt_bench/seallm_7b_v2.jsonl for the MT-bench predictions of SeaLLM-7B-v2, and here to reproduce it.

ModelAccessLangsMT-Bench
GPT-4-turboclosedmulti9.32
GPT-4-0613closedmulti9.18
Mixtral-8x7b (46B)openmulti8.3
Starling-LM-7B-alphaopenmono (en)8.0
OpenChat-3.5-7Bopenmono (en)7.81
SeaLLM-7B-v2openmulti (10+)7.54
Qwen-14Bopenmulti6.96
Llama-2-70Bopenmono (en)6.86
Mistral-7B-instuctopenmono (en)6.84

Sea-Bench

Similar to MT-Bench, Sea-bench is a set of categorized instruction test sets to measure models' ability as an assistant that is specifically focused on 9 SEA languages, including non-Latin low-resource languages.

As shown, the huge improvements come from math-reasoning, reaching GPT-3.5 level of performance.

fig_sea_bench_side_by_side.png

Refer to sea_bench/seallm_7b_v2.jsonl for the Sea-bench predictions of SeaLLM-7B-v2.

Usage

Instruction format

prompt = """<|im_start|>system
You are a helpful assistant.</s><|im_start|>user
Hello world</s><|im_start|>assistant
Hi there, how can I help?</s>"""

# NOTE: previous commit has \n between </s> and <|im_start|>, that was incorrect!
# <|im_start|> is not a special token.
# Transformers chat_template should be consistent with vLLM format below.

# ! ENSURE 1 and only 1 bos `<s>` at the beginning of sequence
print(tokenizer.convert_ids_to_tokens(tokenizer.encode(prompt)))

'<s>', '▁<', '|', 'im', '_', 'start', '|', '>', 'system', '<0x0A>', 'You', '▁are', '▁a', '▁helpful', '▁assistant', '.', '</s>', '▁<', '|', 'im', '_', 'start', '|', '>', 'user', '<0x0A>', 'Hello', '▁world', '</s>', '▁<', '|', 'im', '_', 'start', '|', '>', 'ass', 'istant', '<0x0A>', 'Hi', '▁there', ',', '▁how', '▁can', '▁I', '▁help', '?', '</s>']
"""

Using transformers's chat_template


from transformers import AutoModelForCausalLM, AutoTokenizer

device = "cuda" # the device to load the model onto

# use bfloat16 to ensure the best performance.
model = AutoModelForCausalLM.from_pretrained("SeaLLMs/SeaLLM-7B-v2", torch_dtype=torch.bfloat16, device_map=device)
tokenizer = AutoTokenizer.from_pretrained("SeaLLMs/SeaLLM-7B-v2")

messages = [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "Hello world"},
    {"role": "assistant", "content": "Hi there, how can I help you today?"},
    {"role": "user", "content": "Explain general relativity in details."}
]

encodeds = tokenizer.apply_chat_template(messages, return_tensors="pt", add_generation_prompt=True)
print(tokenizer.convert_ids_to_tokens(encodeds[0]))
# ['<s>', '▁<', '|', 'im', '_', 'start', '|', '>', 'system', '<0x0A>', 'You', '▁are', '▁a', '▁helpful', '▁assistant', '.', '</s>', '▁<', '|', 'im', '_', 'start', '|', '>', 'user', '<0x0A>', 'Hello', '▁world', '</s>', '▁<', '|', 'im', '_', 'start', '|', '>', 'ass', 'istant', '<0x0A>', 'Hi', '▁there', ',', '▁how', '▁can', '▁I', '▁help', '▁you', '▁today', '?', '</s>', '▁<', '|', 'im', '_', 'start', '|', '>', 'user', '<0x0A>', 'Ex', 'plain', '▁general', '▁rel', 'ativity', '▁in', '▁details', '.', '</s>', '▁<', '|', 'im', '_', 'start', '|', '>', 'ass', 'istant', '<0x0A>']

model_inputs = encodeds.to(device)
model.to(device)

generated_ids = model.generate(model_inputs, max_new_tokens=1000, do_sample=True, pad_token_id=tokenizer.pad_token_id)
decoded = tokenizer.batch_decode(generated_ids)
print(decoded[0])

Using vLLM

from vllm import LLM, SamplingParams
TURN_TEMPLATE = "<|im_start|>{role}\n{content}</s>"
TURN_PREFIX = "<|im_start|>{role}\n"

# There is no \n between </s> and <|im_start|>.

def seallm_chat_convo_format(conversations, add_assistant_prefix: bool, system_prompt=None):
    # conversations: list of dict with key `role` and `content` (openai format)
    if conversations[0]['role'] != 'system' and system_prompt is not None:
        conversations = [{"role": "system", "content": system_prompt}] + conversations
    text = ''
    for turn_id, turn in enumerate(conversations):
        prompt = TURN_TEMPLATE.format(role=turn['role'], content=turn['content'])
        text += prompt
    if add_assistant_prefix:
        prompt = TURN_PREFIX.format(role='assistant')
        text += prompt    
    return text

sparams = SamplingParams(temperature=0.1, max_tokens=1024, stop=['</s>', '<|im_start|>'])
llm = LLM("SeaLLMs/SeaLLM-7B-v2", dtype="bfloat16")

message = "Explain general relativity in details."
prompt = seallm_chat_convo_format(message, True)
gen = llm.generate(prompt, sampling_params)

print(gen[0].outputs[0].text)

Fine-tuning SeaLLM-7B-v2

Should follow the chat format and accurately mask out source tokens. Here is an example.

conversations = [
    {"role": "system", "content": "You are helful assistant."},
    {"role": "user", "content": "Hello world."},
    {"role": "assistant", "content": "Hi there, how can I help?"},
    {"role": "user", "content": "Tell me a joke."},
    {"role": "assistant", "content": "Why don't scientists trust atoms? Because they make up everything."},
]
def seallm_7b_v2_tokenize_multi_turns(tokenizer, conversations, add_assistant_prefix=False):
    """
    Inputs:
        conversations: list of dict following openai format, eg
            conversations = [
                {"role": "system", "content": "You are helful assistant."},
                {"role": "user", "content": "Hello world."},
                {"role": "assistant", "content": "Hi there, how can I help?"},
                {"role": "user", "content": "Tell me a joke."},
                {"role": "assistant", "content": "Why don't scientists trust atoms? Because they make up everything."},
            ]
        add_assistant_prefix: whether to add assistant_prefix, only for inference decoding
    Outputs:
        tokenize_output_sample, {
            "input_ids": ...
            "token_type_ids": 1 if train and 0 if masked out (not train)
        }
    During training, need to create a labels, with masked-out tokens = -100 to avoid loss computations.
        labels = sample['input_ids'].clone()
        labels[sample['token_type_ids'] == 0] = -100
    """
    TURN_TEMPLATE = "<|im_start|>{role}\n{content}</s>"
    TURN_PREFIX = "<|im_start|>{role}\n"
    sample = None
    assistant_prefix_len = None
    for turn_id, turn in enumerate(conversations):
        prompt = TURN_TEMPLATE.format(role=turn['role'], content=turn['content'])
        turn_sample = tokenizer(
            prompt, padding=False, truncation=False, verbose=False, add_special_tokens=False,
            return_token_type_ids=True, 
        )
        if turn['role'] == 'assistant':
            if assistant_prefix_len is None:
                assistant_prefix_len = len(tokenizer.encode(TURN_PREFIX.format(role=turn['role']), add_special_tokens=False))
            turn_sample['token_type_ids'][assistant_prefix_len:] = [1] * (len(turn_sample['input_ids']) - assistant_prefix_len)
        if sample is None:
            sample = turn_sample
        else:
            for k in turn_sample.keys():
                sample[k].extend(turn_sample[k])
    if add_assistant_prefix:
        assistant_prefix_sample = tokenizer(
            TURN_PREFIX.format(role="assistant"), padding=False, truncation=False, verbose=False, add_special_tokens=False,
            return_token_type_ids=True, 
        )
        for k in sample.keys():
            sample[k].extend(assistant_prefix_sample[k])
    if tokenizer.add_bos_token:
        sample['input_ids'] = [tokenizer.bos_token_id] + sample['input_ids']
        sample['attention_mask'] = [1] + sample['attention_mask']
        sample['token_type_ids'] = [sample['token_type_ids'][0]] + sample['token_type_ids']
    return sample

# ! testing
sample = seallm_7b_v2_tokenize_multi_turns(tokenizer, conversations)
print(tokenizer.convert_ids_to_tokens(sample['input_ids']))
print(sample['token_type_ids'])
# ['<s>', '▁<', '|', 'im', '_', 'start', '|', '>', 'system', '<0x0A>', 'You', '▁are', '▁hel', 'ful', '▁assistant', '.', '</s>', '▁<', '|', 'im', '_', 'start', '|', '>', 'user', '<0x0A>', 'Hello', '▁world', '.', '</s>', '▁<', '|', 'im', '_', 'start', '|', '>', 'ass', 'istant', '<0x0A>', 'Hi', '▁there', ',', '▁how', '▁can', '▁I', '▁help', '?', '</s>', '▁<', '|', 'im', '_', 'start', '|', '>', 'user', '<0x0A>', 'Tell', '▁me', '▁a', '▁joke', '.', '</s>', '▁<', '|', 'im', '_', 'start', '|', '>', 'ass', 'istant', '<0x0A>', 'Why', '▁don', "'", 't', '▁scientists', '▁trust', '▁atoms', '?', '▁Because', '▁they', '▁make', '▁up', '▁everything', '.', '</s>']
# [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]



Acknowledgement to Our Linguists

We would like to express our special thanks to our professional and native linguists, Tantong Champaiboon, Nguyen Ngoc Yen Nhi and Tara Devina Putri, who helped build, evaluate, and fact-check our sampled pretraining and SFT dataset as well as evaluating our models across different aspects, especially safety.

Citation

If you find our project useful, we hope you would kindly star our repo and cite our work as follows: Corresponding Author: l.bing@alibaba-inc.com

Author list and order will change!

  • * and ^ are equal contributions.
@article{damonlpsg2023seallm,
  author = {Xuan-Phi Nguyen*, Wenxuan Zhang*, Xin Li*, Mahani Aljunied*,
            Zhiqiang Hu, Chenhui Shen^, Yew Ken Chia^, Xingxuan Li, Jianyu Wang,
            Qingyu Tan, Liying Cheng, Guanzheng Chen, Yue Deng, Sen Yang,
            Chaoqun Liu, Hang Zhang, Lidong Bing},
  title = {SeaLLMs - Large Language Models for Southeast Asia},
  year = 2023,
  Eprint = {arXiv:2312.00738},
}

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм

Можно запустить

Подбираем GPU…

Класс архитектуры
MistralForCausalLM
Ревизия весов
04d5d61

0 моделей