/ Модель

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

Контекст
131 072 токена
Параметры
1,5 млрд
Лицензия
Apache 2.0
Архитектура
qwen2 · dense
Опубликована
10 июл 2024

BRAG-Qwen2-1.5b-v0.1

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

Компактная модель Qwen2, дообученная для ответов на вопросы по тексту и таблицам в сценариях RAG и диалогового поиска.

17скачиваний за 30 дней5лайковвеса обновлены5 авг 2024

Бенчмарки

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

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

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

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

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

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

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

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

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

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

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

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

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

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

BRAG-Qwen2-1.5b-v0.1 — компактная языковая модель серии BRAG, разработанная Pratik Bhavasar и Ravi Theja на базе архитектуры Qwen2 и дообученная для генерации ответов с использованием найденного контекста (RAG). Модель предназначена для работы с текстом и таблицами, а также для диалоговых сценариев RAG: она отвечает на вопросы по переданному контексту и должна сообщать, если ответа в нём нет.

Модель содержит 1,5 млрд параметров, использует архитектуру Qwen2ForCausalLM и поддерживает контекст до 131 072 токенов по метаданным. В README указана поддержка до 32 тыс. токенов и отмечено, что модель обучалась и оценивалась на английском языке, хотя базовая модель обладает многоязычными возможностями. Репозиторий содержит веса PyTorch; лицензия — Apache-2.0.

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

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

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

Ограничения

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

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

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

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

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

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

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

Открыть на Hugging Face

BRAG-Qwen2-1.5b-v0.1 Model Card

Model Description

BRAG-Qwen2-1.5b-v0.1 is part of the BRAG series of SLMs (Small Language Models), specifically trained for RAG (Retrieval-Augmented Generation) tasks, including:

1.	RAG with tables and text.
2.	RAG with conversational chat.

Authors: Pratik Bhavasar, Ravi Theja

Key Features

  • Capabilities: RAG tasks with both tables and text, as well as conversational chat.
  • Model Size: 1.5 billion parameters
  • Context Length: Supports up to 32k tokens
  • Language: Trained and evaluated for English, but the base model has multi-lingual capabilities.

Other Resources

BRAG-v0.1 Model Collection | Blog

Performance

Model TypeModel NameModel SizeContext LengthChatRAG-Bench (all)
LLMCommand-R-Plus--128k50.93
LLMGPT-4-Turbo-2024-04-09--128k54.03
SLMChatQA-1.5-8B8b8k55.17
BRAG SLMBRAG-Qwen2-7b-v0.17b128k53.23
BRAG SLMBRAG-Llama-3.1-8b-v0.18b128k52.29
BRAG SLMBRAG-Llama-3-8b-v0.18b8k51.70
BRAG Ultra SLMBRAG-Qwen2-1.5b-v0.11.5b32k46.43

Usage

Prompt Format

Below is the message prompt format required for using the model.

messages = [
    {"role": "system", "content": "You are an assistant who gives helpful, detailed, and polite answers to the user's questions based on the context with appropriate reasoning as required. Indicate when the answer cannot be found in the context."},
    {"role": "user", "content": """Context: <CONTEXT INFORMATION> \n\n <USER QUERY>"""},
]

Running with the pipeline API

import transformers
import torch

model_id = "maximalists/BRAG-Qwen2-1.5b-v0.1"

pipeline = transformers.pipeline(
    "text-generation",
    model=model_id,
    model_kwargs={"torch_dtype": torch.bfloat16},
    device_map="auto",
)

messages = [
    {"role": "system", "content": "You are an assistant who gives helpful, detailed, and polite answers to the user's questions based on the context with appropriate reasoning as required. Indicate when the answer cannot be found in the context."},
    {"role": "user", "content": """Context:\nArchitecturally, the school has a Catholic character. Atop the Main Building\'s gold dome is a golden statue of the Virgin Mary. Immediately in front of the Main Building and facing it, is a copper statue of Christ with arms upraised with the legend "Venite Ad Me Omnes". Next to the Main Building is the Basilica of the Sacred Heart. Immediately behind the basilica is the Grotto, a Marian place of prayer and reflection. It is a replica of the grotto at Lourdes, France where the Virgin Mary reputedly appeared to Saint Bernadette Soubirous in 1858. At the end of the main drive (and in a direct line that connects through 3 statues and the Gold Dome), is a simple, modern stone statue of Mary.\n\nTo whom did the Virgin Mary allegedly appear in 1858 in Lourdes France?"""},
]

outputs = pipeline(
    messages,
    max_new_tokens=256,
)

print(outputs[0]["generated_text"][-1])

Running the model on a single / multi GPU

# pip install accelerate
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

model_id = "maximalists/BRAG-Qwen2-1.5b-v0.1"

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    device_map="auto",
)

messages = [
    {"role": "system", "content": "You are an assistant who gives helpful, detailed, and polite answers to the user's questions based on the context with appropriate reasoning as required. Indicate when the answer cannot be found in the context."},
    {"role": "user", "content": """Context:\nArchitecturally, the school has a Catholic character. Atop the Main Building\'s gold dome is a golden statue of the Virgin Mary. Immediately in front of the Main Building and facing it, is a copper statue of Christ with arms upraised with the legend "Venite Ad Me Omnes". Next to the Main Building is the Basilica of the Sacred Heart. Immediately behind the basilica is the Grotto, a Marian place of prayer and reflection. It is a replica of the grotto at Lourdes, France where the Virgin Mary reputedly appeared to Saint Bernadette Soubirous in 1858. At the end of the main drive (and in a direct line that connects through 3 statues and the Gold Dome), is a simple, modern stone statue of Mary.\n\nTo whom did the Virgin Mary allegedly appear in 1858 in Lourdes France?"""},
]

text = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True
)

model_inputs = tokenizer([text], return_tensors="pt").to("cuda")

generated_ids = model.generate(
    model_inputs.input_ids,
    max_new_tokens=256
)
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)

Limitations

The model is specifically trained for short contexts and may not perform well with longer ones. It has been fine-tuned on an English dataset. To avoid underperformance and the potential for hallucinations, please use the system prompt mentioned above.

Citation

To cite this model, please use the following:

@misc{BRAG-Qwen2-1.5b-v0.1,
  title = {BRAG-Qwen2-1.5b-v0.1},
  year = {2024},
  publisher = {HuggingFace},
  url = {https://huggingface.co/maximalists/BRAG-Qwen2-1.5b-v0.1},
  author = {Pratik Bhavsar and Ravi Theja}
}

Additional Information

For more details on the BRAG series and updates, please refer to the official blog.

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

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

GPU в ailist

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

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

Подбираем GPU…

Класс архитектуры
Qwen2ForCausalLM
Ревизия весов
498001b

0 моделей