/ Модель

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

Контекст
33 792 токена
Параметры
7,5 млрд
Размер весов
16,1 ГБ
Лицензия
Своя лицензия
Архитектура
cbllama · dense
Опубликована
26 фев 2025

Llama-3-CBHybridL-8B

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

Гибридная версия Llama 3.1 от Cerebras для генерации текста и диалогов с длинным контекстом и сниженным расходом памяти KV-кэша.

218скачиваний за 30 дней0лайковвеса обновлены26 мар 2025

Бенчмарки

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

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

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

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

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

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

Cerebras Llama-3-CBHybridL-8B — языковая модель Cerebras, созданная на базе Llama-3.1-8B-Instruct для работы с длинным контекстом. Это вариант с гибридным плотным и разреженным вниманием: 25 из 32 слоёв внимания дообучены для разреженного lambda-mask attention. По данным авторов, такой подход уменьшает память KV-кэша в 1,6–1,7 раза при сохранении большей части качества на задачах с длинным контекстом.

Модель предназначена для генерации текста и диалогов, включая ответы на вопросы по длинным документам и работу с несколькими источниками. Метаданные указывают 7,5 млрд параметров и контекст до 33 792 токенов; поддерживается интерфейс вызова инструментов. В README приведены результаты на LongBench и HELMET: качество зависит от задачи и может снижаться относительно исходной модели. Для улучшения работы с длинным контекстом авторы предлагают вставлять вспомогательные токены памяти; их добавление требует соответствующей обработки входа.

Модель распространяется в формате safetensors под лицензией other; конкретные условия лицензии следует уточнить на странице репозитория. Карточка описывает её как эксперимент Cerebras на основе инструкционной модели Llama 3.1, а не как универсальную замену исходной модели.

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

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

Ограничения

Качество на отдельных задачах длинного контекста ниже, чем у исходной Llama-3.1-8B-Instruct; эффект зависит от задачи. Для улучшения результатов авторы рекомендуют вставлять вспомогательные токены памяти через специальный метод токенизатора.

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

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

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

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

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

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

Открыть на Hugging Face

Llama-3-CBHybridL-8B: Model Information

We are excited to release the Cerebras hybrid dense/sparse attention versions of Llama-3.1-8B-Instruct models optimized for long-context performance. This series includes two models: Llama3.1-CBHybridL-8B (model with 25 sparse attention layers out of 32) and Llama3.1-CBHybridM-8B (28 sparse attention layers out of 32).

This model – Cerebras Llama3.1-CBHybridL-8B – was built on top of Llama-3.1-8B-Instruct using sparse attention training features available in Cerebras Model Zoo Release 2.4. We created hybrid versions of Llama-3.1-8B-Instruct with most of the self-attention layers fine-tuned to perform sparse lambda-mask attention which reduces KV cache memory usage by 1.6-1.7x while largely maintaining long-context performance.

You can find more information about Cerebras hybrid Llama models at the following locations:

Results

Our hybrid models retain most of their performance in long-context despite requiring much less memory for KV cache:

HELMET result

LongBench suiteLlama-3.1-8B-InstructLlama-3-CBHybridM-8BLlama-3-CBHybridL-8B
KV cache memory*, GB2.1471.2751.376
Single-doc QA54.19754.50756.187
Multi-doc QA41.45541.02243.082
Summarization26.127525.60725.357
Few-shot learning63.407564.4265.183
Synthetic97.2996.7598.0
Code completion59.74566.86566.49
Macro-mean (EN & ZH)57.03758.19559.05
Macro-mean (EN)58.60660.48560.937
HELMET suite (seq. len. 16K)Llama-3.1-8B-InstructLlama-3-CBHybridM-8BLlama-3-CBHybridL-8B
KV cache memory, GB2.1471.2751.376
Recall99.687587.562595.1875
Rerank52.667142.787945.5175
RAG69.041768.62569.4583
LongdocQA32.06134.41935.2879
ICL7681.682.2
Summarization26.27822.435323.7324
Macro-mean59.289256.238258.564

* we include KV cache memory usage numbers at a representative sequence length of 16K, however note that samples across LongBench tasks have variable length, with ~14.5K being the 75th percentile of the sample length distribution.

Example Usage

from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

model_id = "cerebras/Llama-3-CBHybridL-8B"

tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    torch_dtype=torch.bfloat16,
    device_map="auto",
    trust_remote_code=True
)

messages = [
    {"role": "system", "content": "You are a wafer-scale chatbot who always responds in wafer speak!"},
    {"role": "user", "content": "Who are you?"},
]

input_ids = tokenizer.apply_chat_template(
    messages,
    add_generation_prompt=True,
    return_tensors="pt"
).to(model.device)

outputs = model.generate(
    input_ids,
    max_new_tokens=256,
)
response = outputs[0][input_ids.shape[-1]:]
print(tokenizer.decode(response, skip_special_tokens=True))

Adding memory tokens for enhanced long-context performance

We found that adding auxiliary memory tokens to input sequences at regular intervals improves long-context performance. These tokens can be inserted into the input sequence using a helper tokenizer.insert_memory_tokens() method as shown below:

from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

model_id = "cerebras/Llama-3-CBHybridL-8B"

tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    torch_dtype=torch.bfloat16,
    device_map="auto",
    trust_remote_code=True
)

messages = [
    {"role": "system", "content": "You are a wafer-scale chatbot who always responds in wafer speak!"},
    {"role": "user", "content": "Who are you?"},
]

input_ids = tokenizer.apply_chat_template(
    messages,
    add_generation_prompt=True,
    return_tensors="pt"
).to(model.device)

# Inserting 8 memory tokens per 256 tokens of original input:
input_ids = tokenizer.insert_memory_tokens(
    input_ids,
    episode_length=256,
    num_memory_tokens_per_episode=8
)

outputs = model.generate(
    input_ids,
    max_new_tokens=256,
)
response = outputs[0][input_ids.shape[-1]:]
print(tokenizer.decode(response, skip_special_tokens=True))

In our ablations, inserting 8 memory tokens after every 256 tokens of original input resulted in best accuracy. See out blog post for mode details.

License

Built with Llama3. Llama 3.1 is licensed under the Llama 3.1 Community License, Copyright © Meta Platforms, Inc. All Rights Reserved.

Llama3.1 Community License

Acceptable Use Policy

Acknowledgements

Our models are fine-tuned versions of Meta-Llama-3.1-8B-Instruct. The sparse attention mechanism used in the Llama-3-CBHybrid model series is from the LM-Infinite work of Han et al. See our blog post for the full list of references.

Citing this work

@misc{cerebras2025cb-hybrid-llama,
  author       = {Lazarevich, Ivan and Hassanpour, Mohammad and Venkatesh, Ganesh},
  title        = {Compressing KV cache memory by half with sparse attention},
  month        = {March},
  year         = {2025},
  howpublished = {\url{https://www.cerebras.ai/blog/compressing-kv-cache-memory-by-half-with-sparse-attention}}
}​​​​

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

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

GPU в ailist

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

Нельзя запустить

Модели нужен код из репозитория; автор пока не в списке доверенных организаций.

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

0 моделей