/ Модель

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

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

Zamba2-7B-Instruct

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

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

6 384скачиваний за 30 дней93лайкавеса обновлены16 мая 2025

Бенчмарки

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Zamba2-7B-Instruct — диалоговая языковая модель Zyphra, дообученная на наборах данных для следования инструкциям и общения на основе Zyphra/Zamba2-7B. Это плотная гибридная архитектура, сочетающая слои пространства состояний Mamba2 с блоками внимания Transformer; общие веса внимания и LoRA-проекции помогают ограничить дополнительные параметры. В метаданных указано 16,8 млрд параметров, а базовый контекст составляет 4096 токенов.

Модель предназначена для генерации ответов в чате, выполнения инструкций, рассуждений и других задач общего назначения. В README описан экспериментальный режим контекста до 16 тысяч токенов с резким снижением качества примерно после 18 тысяч. Разработчик заявляет о низкой задержке генерации и меньших затратах памяти по сравнению с сопоставимыми трансформерными моделями, однако оптимизированные ядра Mamba2 требуют отдельной установки; без них задержка и расход памяти значительно выше. Также README предупреждает о временной реализации Hugging Face, совместимость которой с некоторыми инструментами может быть неполной. Лицензия — Apache-2.0.

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

  • ответы на инструкции в чат-боте
  • составление и редактирование текстов по запросу
  • ответы на вопросы в диалоге
  • помощь с рассуждениями и решением задач
  • генерация текста с контекстом до 16 тысяч токенов в экспериментальном режиме

Ограничения

Экспериментальный режим контекста до 16 тысяч токенов заметно теряет качество примерно после 18 тысяч; базовый контекст в метаданных — 4096 токенов. README указывает на временную реализацию Hugging Face и возможную неполную совместимость с некоторыми инструментами; без оптимизированных ядер Mamba2 возрастают задержка и расход памяти.

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

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

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

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

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

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

Открыть на Hugging Face

Model Card for Zamba2-7B-Instruct

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

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

Zamba2-7B-Instruct long-context has been extended from 4k to 16k context by adjusting the rope frequency in the attention blocks.

Quick start

Prerequisites

To use Zamba2-7B-instruct, install transformers from source:

  1. git clone https://github.com/huggingface/transformers.git
  2. cd transformers && pip install .

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")
model = AutoModelForCausalLM.from_pretrained("Zyphra/Zamba2-7B-instruct", 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("Zyphra/Zamba2-7B", device_map="cuda", torch_dtype=torch.bfloat16, use_long_context=True)

Performance

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

TaskScore
IFEval69.95
BBH33.33
MATH Lvl 513.57
GPQA10.28
MUSR8.21
MMLU-PRO32.43
Average27.96

Moreover, due to its unique hybrid SSM architecture, Zamba2-7B-Instruct 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'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 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.

Long Context

Our Zamba2-7B instruct features an experimental long-context mode which extends the context from 4k to 16k context. This was achieved by adjusting the rotation frequency of the rotary position embeddings.

In Needle-In-A-Haystack tests, we observe that Zamba2-7B-Instruct finds the needle with an extremely high success rate up to and slightly beyond 16k context with performance falling off sharply at about 18k context. In future versions we aim to extend this context length significantly.

Note: this is a temporary HuggingFace implementation of Zamba2-7B. It may not yet be fully compatible with all frameworks and tools intended to interface with HuggingFace models.

A standalone Pytorch implementation of Zamba2-7B may be found here.

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

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

GPU в ailist

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

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

Подбираем GPU…

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

0 моделей