/ Модель

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

Контекст
2 048 токенов
Параметры
32,3 млрд
Размер весов
65,1 ГБ
Лицензия
gpl
Архитектура
llama · dense
Опубликована
2 июн 2023

fin-llama-33b-merged

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

Дообученная 32,3-миллиардная Llama для генерации финансовых планов и рекомендаций по бюджетированию, инвестициям и управлению рисками.

228скачиваний за 30 дней25лайковвеса обновлены29 ноя 2023

Бенчмарки

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

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

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

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

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

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

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

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

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

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

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

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

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

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

FIN-LLAMA — языковая модель для финансовых сценариев, представленная Bavest. Это дообученная Llama с 32,3 млрд параметров; в метаданных указана архитектура LlamaForCausalLM и генерация текста. Модель обучали на наборе bavest/fin-llama-dataset и позиционируют для финансовых задач, включая бюджетирование, инвестиционные стратегии и управление рисками.

Модель предназначена для генерации финансовых рекомендаций и планов, например для малого бизнеса. Контекст составляет 2048 токенов. В README описана загрузка с 4-битной квантизацией через Transformers и bitsandbytes, однако в репозитории указаны форматы PyTorch, а сама модель характеризуется как дообучение.

README предупреждает, что 4-битный вывод работает медленно, вычисления в fp16 могут быть нестабильны, а для корректной генерации следует установить tokenizer.bos_token_id в 1. Указана лицензия GPL; датасет выпущен под BigScience OpenRAIL-M, что не определяет лицензию весов модели.

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

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

Ограничения

В README указаны медленный 4-битный вывод, возможная нестабильность при вычислениях fp16 и необходимость установить tokenizer.bos_token_id в 1 для корректной генерации. Язык модели в карточке не подтверждён.

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

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

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

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

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

Открыть на Hugging Face

FIN-LLAMA

Efficient Finetuning of Quantized LLMs for Finance

Adapter Weights | Dataset

Installation

To load models in 4bits with transformers and bitsandbytes, you have to install accelerate and transformers from source and make sure you have the latest version of the bitsandbytes library (0.39.0).

pip3 install -r requirements.txt

Other dependencies

If you want to finetune the model on a new instance. You could run the setup.sh to install the python and cuda package.

bash scripts/setup.sh

Finetuning

bash script/finetune.sh

Usage

Quantization parameters are controlled from the BitsandbytesConfig

  • Loading in 4 bits is activated through load_in_4bit
  • The datatype used for the linear layer computations with bnb_4bit_compute_dtype
  • Nested quantization is activated through bnb_4bit_use_double_quant
  • The datatype used for qunatization is specified with bnb_4bit_quant_type. Note that there are two supported quantization datatypes fp4 (four bit float) and nf4 (normal four bit float). The latter is theoretically optimal for normally distributed weights and we recommend using nf4.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig

pretrained_model_name_or_path = "bavest/fin-llama-33b-merge"
model = AutoModelForCausalLM.from_pretrained(
    pretrained_model_name_or_path=pretrained_model_name_or_path,
    load_in_4bit=True,
    device_map='auto',
    torch_dtype=torch.bfloat16,
    quantization_config=BitsAndBytesConfig(
        load_in_4bit=True,
        bnb_4bit_compute_dtype=torch.bfloat16,
        bnb_4bit_use_double_quant=True,
        bnb_4bit_quant_type='nf4'
    ),
)

tokenizer = AutoTokenizer.from_pretrained(pretrained_model_name_or_path)

question = "What is the market cap of apple?"
input = "" # context if needed

prompt = f"""
A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's question.
'### Instruction:\n{question}\n\n### Input:{input}\n""\n\n### Response: 
"""

input_ids = tokenizer.encode(prompt, return_tensors="pt").to('cuda:0')

with torch.no_grad():
    generated_ids = model.generate(
        input_ids,
        do_sample=True,
        top_p=0.9,
        temperature=0.8,
        max_length=128
    )

generated_text = tokenizer.decode(
    [el.item() for el in generated_ids[0]], skip_special_tokens=True
)

Dataset for FIN-LLAMA

The dataset is released under bigscience-openrail-m. You can find the dataset used to train FIN-LLAMA models on HF at bavest/fin-llama-dataset.

Known Issues and Limitations

Here a list of known issues and bugs. If your issue is not reported here, please open a new issue and describe the problem. See QLORA for any other limitations.

  1. 4-bit inference is slow. Currently, our 4-bit inference implementation is not yet integrated with the 4-bit matrix multiplication
  2. Currently, using bnb_4bit_compute_type='fp16' can lead to instabilities.
  3. Make sure that tokenizer.bos_token_id = 1 to avoid generation issues.

Acknowledgements

We also thank Meta for releasing the LLaMA models without which this work would not have been possible.

This repo builds on the Stanford Alpaca , QLORA, Chinese-Guanaco and LMSYS FastChat repos.

License and Intended Use

We release the resources associated with QLoRA finetuning in this repository under GLP3 license. In addition, we release the FIN-LLAMA model family for base LLaMA model sizes of 7B, 13B, 33B, and 65B. These models are intended for purposes in line with the LLaMA license and require access to the LLaMA models.

Prompts

Act as an Accountant

I want you to act as an accountant and come up with creative ways to manage finances. You'll need to consider budgeting, investment strategies and risk management when creating a financial plan for your client. In some cases, you may also need to provide advice on taxation laws and regulations in order to help them maximize their profits. My first suggestion request is “Create a financial plan for a small business that focuses on cost savings and long-term investments".

Paged Optimizer

You can access the paged optimizer with the argument --optim paged_adamw_32bit

Cite

@misc{Fin-LLAMA,
  author = {William Todt, Ramtin Babaei, Pedram Babaei},
  title = {Fin-LLAMA: Efficient Finetuning of Quantized LLMs for Finance},
  year = {2023},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/Bavest/fin-llama}},
}

Open LLM Leaderboard Evaluation Results

Detailed results can be found here

MetricValue
Avg.51.76
ARC (25-shot)65.02
HellaSwag (10-shot)86.2
MMLU (5-shot)58.73
TruthfulQA (0-shot)49.75
Winogrande (5-shot)80.03
GSM8K (5-shot)16.22
DROP (3-shot)6.36

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

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

GPU в ailist

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

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

Подбираем GPU…

Класс архитектуры
LlamaForCausalLM
Ревизия весов
0082b56

0 моделей