/ Модель

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

Контекст
131 072 токена
Параметры
69,5 млрд
Размер весов
141 ГБ
Архитектура
llama · dense
Опубликована
26 авг 2024

Llama3-ChatQA-2-70B

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

Диалоговая модель NVIDIA на базе Llama 3 для ответов по документам и RAG с контекстом до 128K токенов.

265скачиваний за 30 дней15лайковвеса обновлены10 сен 2024

Бенчмарки

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Llama3-ChatQA-2-70B — языковая модель NVIDIA для диалоговых ответов с опорой на предоставленный контекст. Она предназначена для поиска и синтеза ответов по документам и извлечённым фрагментам, а также для сценариев RAG, где важно сообщать, если ответа нет в контексте.

Модель построена на Llama 3 и содержит 69,5 млрд параметров. Контекстное окно расширено с 8K до 128K токенов; обучение включало продолжение предобучения для увеличения контекста и три этапа настройки инструкциями. Модель принимает текст и выдаёт текст, поддерживает английский язык и представлена в формате PyTorch.

Для работы рекомендуется формат диалога из карточки модели: системная инструкция, контекст, вопрос и ответ; модель оптимизирована для ответов по контексту. В README приведены оценки на наборах для короткого, длинного и сверхдлинного контекста, но конкретные ограничения и условия лицензии в доступных данных не описаны.

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

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

Ограничения

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

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

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

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

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

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

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

Открыть на Hugging Face

Model Details

We introduce Llama3-ChatQA-2, a suite of 128K long-context models, which bridges the gap between open-source LLMs and leading proprietary models (e.g., GPT-4-Turbo) in long-context understanding and retrieval-augmented generation (RAG) capabilities. Llama3-ChatQA-2 is developed using an improved training recipe from ChatQA-1.5 paper, and it is built on top of Llama-3 base model. Specifically, we continued training of Llama-3 base models to extend the context window from 8K to 128K tokens, along with a three-stage instruction tuning process to enhance the model’s instruction-following, RAG performance, and long-context understanding capabilities. Llama3-ChatQA-2 has two variants: Llama3-ChatQA-2-8B and Llama3-ChatQA-2-70B. Both models were originally trained using Megatron-LM, we converted the checkpoints to Hugging Face format. For more information about ChatQA 2, check the website!

Other Resources

Llama3-ChatQA-2-8B   Evaluation Data   Training Data   Website   Paper

Overview of Benchmark Results

We evaluate ChatQA 2 on short-context RAG benchmark (ChatRAG) (within 4K tokens), long context tasks from SCROLLS and LongBench (within 32K tokens), and ultra-long context tasks from In- finiteBench (beyond 100K tokens). Results are shown below.

Example Image

Note that ChatQA-2 is built based on Llama-3 base model.

Prompt Format

We highly recommend that you use the prompt format we provide, as follows:

when context is available

when context is not available

The content of the system's turn (i.e., {System}) for both scenarios is as follows:

Note that our ChatQA-2 models are optimized for the capability with context, e.g., over documents or retrieved context.

How to use

take the whole document as context

This can be applied to the scenario where the whole document can be fitted into the model, so that there is no need to run retrieval over the document.

from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

model_id = "nvidia/Llama3-ChatQA-2-8B"

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

messages = [
    {"role": "user", "content": "what is the percentage change of the net income from Q4 FY23 to Q4 FY24?"}
]

document = """NVIDIA (NASDAQ: NVDA) today reported revenue for the fourth quarter ended January 28, 2024, of $22.1 billion, up 22% from the previous quarter and up 265% from a year ago.\nFor the quarter, GAAP earnings per diluted share was $4.93, up 33% from the previous quarter and up 765% from a year ago. Non-GAAP earnings per diluted share was $5.16, up 28% from the previous quarter and up 486% from a year ago.\nQ4 Fiscal 2024 Summary\nGAAP\n| $ in millions, except earnings per share | Q4 FY24 | Q3 FY24 | Q4 FY23 | Q/Q | Y/Y |\n| Revenue | $22,103 | $18,120 | $6,051 | Up 22% | Up 265% |\n| Gross margin | 76.0% | 74.0% | 63.3% | Up 2.0 pts | Up 12.7 pts |\n| Operating expenses | $3,176 | $2,983 | $2,576 | Up 6% | Up 23% |\n| Operating income | $13,615 | $10,417 | $1,257 | Up 31% | Up 983% |\n| Net income | $12,285 | $9,243 | $1,414 | Up 33% | Up 769% |\n| Diluted earnings per share | $4.93 | $3.71 | $0.57 | Up 33% | Up 765% |"""

def get_formatted_input(messages, context):
    system = "System: This is a chat between a user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions based on the context. The assistant should also indicate when the answer cannot be found in the context."
    instruction = "Please give a full and complete answer for the question."

    for item in messages:
        if item['role'] == "user":
            ## only apply this instruction for the first user turn
            item['content'] = instruction + " " + item['content']
            break

    conversation = '\n\n'.join(["User: " + item["content"] if item["role"] == "user" else "Assistant: " + item["content"] for item in messages]) + "\n\nAssistant:"
    formatted_input = system + "\n\n" + context + "\n\n" + conversation
    
    return formatted_input

formatted_input = get_formatted_input(messages, document)
tokenized_prompt = tokenizer(tokenizer.bos_token + formatted_input, return_tensors="pt").to(model.device)

terminators = [
    tokenizer.eos_token_id,
    tokenizer.convert_tokens_to_ids("<|eot_id|>")
]

outputs = model.generate(input_ids=tokenized_prompt.input_ids, attention_mask=tokenized_prompt.attention_mask, max_new_tokens=128, eos_token_id=terminators)

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

Command to run generation

python evaluate_cqa_vllm_chatqa2.py --model-folder ${model_path} --eval-dataset ${dataset_name} --start-idx 0 --end-idx ${num_samples} --max-tokens ${max_tokens} --sample-input-file ${dataset_path}

see all_command.sh for all detailed configuration.

Correspondence to

Peng Xu (pengx@nvidia.com), Wei Ping (wping@nvidia.com)

Citation

License

The Model is released under Non-Commercial License and the use of this model is also governed by the META LLAMA 3 COMMUNITY LICENSE AGREEMENT

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

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

GPU в ailist

vLLM

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

Подбираем GPU…

Класс архитектуры
LLaMAForCausalLM
Ревизия весов
4a63dcf

0 моделей