/ Модель

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

Контекст
4 096 токенов
Параметры
16,8 млрд
Размер весов
15,1 ГБ
Лицензия
Apache 2.0
Архитектура
zamba2 · dense
Базовая модель
Zamba2-7B
Библиотека
transformers
Опубликована
11 фев 2025

Zamba2-7B-Instruct-v2

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

Zamba2-7B-Instruct-v2 — дообученная диалоговая языковая модель Zyphra для следования инструкциям, генерации ответов и общих задач рассуждения.

217скачиваний за 30 дней5лайковвеса обновлены18 мар 2025

Бенчмарки

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

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

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

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

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

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

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

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

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

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

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

В подключённых источниках результатов для этой модели пока нет.

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

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

Zamba2-7B-Instruct-v2 — диалоговая языковая модель Zyphra, полученная дообучением Zamba2-7B на наборах инструкций и чатов. Она предназначена для генерации ответов, следования инструкциям и решения общих задач, включая рассуждения и математику.

Модель использует гибридную архитектуру: слои Mamba2 чередуются с разделяемыми слоями внимания Transformer. В README указан размер 7,36 млрд параметров, а метаданные каталога — 16,8 млрд; источники расходятся, поэтому точный размер не приводится. Базовый контекст — 4096 токенов; в README описано расширение до 16 тысяч токенов через настройку частоты RoPE. Модель принимает текст и генерирует текст. README заявляет высокую скорость генерации и меньшие требования к памяти по сравнению с сопоставимыми трансформерными моделями, однако оптимизированные ядра Mamba2 нужны для снижения задержки и расхода памяти. Поддерживаемые естественные языки в источниках не перечислены.

Для запуска рекомендуется Transformers с зависимостями mamba-ssm и causal-conv1d; без оптимизированных ядер ожидаются более высокая задержка и расход памяти. Лицензия — Apache-2.0.

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

  • ответы на пользовательские запросы в чате
  • выполнение инструкций на естественном языке
  • решение задач на рассуждение
  • решение математических задач
  • генерация связного текста

Ограничения

Оптимизированные ядра Mamba2 требуют дополнительных зависимостей; без них заметно возрастают задержка и расход памяти. README приводит базовый контекст 4K токенов и описывает расширение до 16K с настройкой RoPE.

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

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

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

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

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

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

Открыть на Hugging Face

Model Card for Zamba2-7B-Instruct-v2

Zamba2-7B-Instruct-v2 is obtained from Zamba2-7B by fine-tuning on instruction-following and chat datasets.

Zamba2-7B-Instruct-v2 is a hybrid model composed of state-space (Mamba2) and transformer blocks.

The context window can be extended from 4k to 16k long-context by adjusting the rope frequency in the attention blocks (as described below).

Quick start

Prerequisites

To use Zamba2-7B-Instruct-v2, install transformers:

pip install transformers -U

To install dependencies necessary to run Mamba2 kernels, install mamba-ssm from source (due to compatibility issues with PyTorch) as well as causal-conv1d:

  1. git clone https://github.com/state-spaces/mamba.git
  2. cd mamba && git checkout v2.1.0 && pip install .
  3. pip install causal-conv1d

You can run the model without using the optimized Mamba2 kernels, but it is not recommended as it will result in significantly higher latency and memory usage.

Inference

from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

# Instantiate model and tokenizer
tokenizer = AutoTokenizer.from_pretrained("Zyphra/Zamba2-7B-Instruct-v2")
model = AutoModelForCausalLM.from_pretrained("Zyphra/Zamba2-7B-Instruct-v2", device_map="cuda", torch_dtype=torch.bfloat16)

# Format the input as a chat template
user_turn_1 = "In one season a flower blooms three times. In one year, there is one blooming season. How many times do two flowers bloom in two years? Please include your logic."
assistant_turn_1 = "In one season, a flower blooms three times. In one year, there is one blooming season. Therefore, in two years, there are two blooming seasons. Since each flower blooms three times in one season, in two blooming seasons, each flower will bloom six times. Since there are two flowers, the total number of times they will bloom in two years is 12."
user_turn_2 = "How many times do the two flowers blossom in three years?"
sample = [{'role': 'user', 'content': user_turn_1}, {'role': 'assistant', 'content': assistant_turn_1}, {'role': 'user', 'content': user_turn_2}]
chat_sample = tokenizer.apply_chat_template(sample, tokenize=False)

# Tokenize input and generate output
input_ids = tokenizer(chat_sample, return_tensors='pt', add_special_tokens=False).to("cuda")
outputs = model.generate(**input_ids, max_new_tokens=150, return_dict_in_generate=False, output_scores=False, use_cache=True, num_beams=1, do_sample=False)
print((tokenizer.decode(outputs[0])))

To use the context-extended version of Zamba, please load the model with use_long_context=True, i.e.:

model = AutoModelForCausalLM.from_pretrained("Zamba2-7B-Instruct-v2", device_map="cuda", torch_dtype=torch.bfloat16, use_long_context=True)

Performance

Zamba2-7B-Instruct-v2 punches above its weight, achieving extremely strong instruction-following benchmark scores.

ModelSize (B)IFEvalBBHGPQAMATH (Hard)MMLU ProMUSRAggregate
Zamba2-7B-Instruct-v27.3681.6336.728.6017.7634.5111.9431.78
Zamba2-7B-Instruct7.3669.8936.188.8113.0232.819.2028.32
Granite-3.1-8B-Instruct8.1772.2038.688.2319.9135.2217.3631.93
Llama-3.1-8B-Instruct8.0378.0734.682.7417.1037.838.1329.76
Mistral-NeMo-Minitron-8B-Instruct8.0058.5131.503.915.8132.8710.9323.92
Gemma2-9B-it9.2474.3546.4613.380.1238.739.6630.45
Ministral-8B-Instruct-24108.0252.0238.456.1211.1539.878.0625.95
Qwen2.5-7B-Instruct7.6275.3039.826.0248.9142.958.7736.96

Moreover, due to its unique hybrid SSM architecture, Zamba2-7B-Instruct-v2 achieves extremely low inference latency and rapid generation with a significantly smaller memory footprint than comparable transformer-based models.

Time to First Token (TTFT)Output Generation
image/pngimage/png

And memory overhead

Zamba2-7B-Instruct-v2's high performance, strong instruction-following and reasoning capabilities for its size makes it an ideal generalist small model for a wide range of applications.

Model Details

Zamba2-7B-Instruct-v2 utilizes and extends our original Zamba hybrid SSM-attention architecture. The core Zamba architecture consists of a backbone of Mamba2 layers interleaved with one or more shared attention layers. This attention has shared weights to minimize the parameter cost of the model. We find that concatenating the original model embeddings to the input to this attention block improves performance, likely due to better maintenance of information across depth. The Zamba2 architecture also applies LoRA projection matrices to the shared MLP to gain some additional expressivity in each block and allow each shared block to specialize slightly to its own unique position while keeping the additional parameter overhead small.

Training Recipe

Zamba2-7B-Instruct-v2 was trained on a mix of publicly available dataset including instruction-following and chat data. We experimented with various training approaches and found that the best recipe was as follows:

  1. SFT for one epoch on core chat, reasoning and math datasets such as HuggingFaceTB/smoltalk and nvidia/OpenMathInstruct-2
  2. DPO for 3 epochs on core alignment datasets including a subset of allenai/llama-3.1-tulu-3-70b-preference-mixture
  3. DPO on very high quality preference datasets such as jondurbin/truthy-dpo-v0.1 and jondurbin/gutenberg-dpo-v0.1

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

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

GPU в ailist

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

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

Подбираем GPU…

Класс архитектуры
Zamba2ForCausalLM
Ревизия весов
54438e6

0 моделей