FinanceConnect-13B / README.md
ceadar-ie's picture
Update README.md
6cd8d29
|
raw
history blame
7.14 kB
metadata
language: en
datasets:
  - FinTalk-19k
tags:
  - summarization
  - classification
  - translation
  - NLP
  - finance
  - domain specific llm
license: apache-2.0
pipeline_tag: text-generation

Finance Connect

FinanceConnect is a state-of-the-art, open-source chat model tailored for finance and economic discussions. Built on the robust Llama2-13B architecture, this model has been fine-tuned on a combination of FinTalk-19k and Alpaca dataset, making it a valuable resource for finance professionals, researchers, and enthusiasts.

Model Details

Dataset Utilized: FinTalk-19k and Alpaca

Drawing strength from the FinTalk-19k and Alpaca dataset, a curated collection focused on financial knowledge, this model provides insights and information related to the finance industry. For a deeper dive into the dataset, visit: FinTalk-19k, Alpaca

Model Specification

  • Developed by: CeADAR Connect Group
  • Model type: Large Language Model
  • Language(s): en
  • Finetuned from model: Llama2-13B

Key Features and Functionalities

Domain Specialization

The FinanceConnect model is specialized in Finance conversations, serving as a resource for financial researchers, and enthusiasts.

Model API Accessibility

Offers a straightforward Python integration for generating financial content insights.

Performance Optimisation

Efficient performance across both CPU and GPU platforms.

Data Representation

Utilises a combination of comprehensive Finance dataset, enabling content generation to professional standards.

Model Usage

Experience the capabilities of the FinanceConnect model through a well-structured Python interface. To kick-start your exploration, follow the steps and snippets given below:

Prerequisites

1. Ensure required packages are available

import torch
from typing import Any, Dict
from transformers import (
    AutoModelForCausalLM,
    AutoTokenizer,
    BitsAndBytesConfig,
    HfArgumentParser,
    TrainingArguments,
    PreTrainedTokenizerFast,
    pipeline,
    logging,
)
import time

2. Initiate the model and tokenizer

model_name = "ceadar-ie/FinanceConnect-13B"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.float16, load_in_8bit = True, device_map = "auto", trust_remote_code=True)

3. Create a function for generating text

def generate_text(input_text):
    tokenizer.padding_side = "right"
    num_words_input = len(input_text.split())

    start_time = time.time()
    
    pipe = pipeline(task="text-generation", model=model, tokenizer=tokenizer, max_length = 1000)
    prompt = f"<s>[INST] {input_text} [/INST]"
    #prompt = input_text
    result = pipe(prompt)
    generated_text = result[0]['generated_text'].replace(prompt, "").strip()

    end_time = time.time()
    time_taken = end_time - start_time

    num_words_generated = len(generated_text.split())

    print("Generated Output:")
    print(generated_text)
    print('=' * 60 )
    print("\nNumber of Words in Input Text:", num_words_input)
    print("Number of Words in Generated Output:", num_words_generated)
    print("Time Taken to Generate Output: {:.2f} seconds".format(time_taken))

Example Evaluation and Use

Example Prompt 1:

List the key factors influencing the current state of the global economy.

Generated Output:

The key factors influencing the current state of the global economy are:

  1. COVID-19 pandemic and its impact on consumer spending and supply chains
  2. Inflation and its impact on consumer prices and central banks' monetary policies
  3. Interest rates and their impact on borrowing and investment
  4. Global economic growth and its impact on trade and investment
  5. Geopolitical tensions and their impact on trade and investment
  6. Technological advancements and their impact on industries and employment
  7. Shifts in global economic power and their impact on trade and investment
  8. Environmental factors such as climate change and their impact on industries and economies.

These are some of the key factors that influence the current state of the global economy.

Example Prompt 2:

Explain the concept of quantitative easing and its impact on financial markets.

Generated Output:

Quantitative easing (QE) is a monetary policy tool used by central banks to stimulate economic growth during times of recession or low inflation. It involves the central bank purchasing government bonds from banks, which increases the money supply and lowers interest rates. This can lead to a decrease in the value of a country's currency, making exports cheaper for foreign buyers and potentially boosting economic growth. However, QE can also lead to inflation, as the increased money supply can drive up prices.

Training Details

Training Hyperparameters

  • per_device_train_batch_size = 10
  • gradient_accumulation_steps = 4
  • optim = "paged_adamw_32bit"
  • learning_rate = 2e-4
  • max_grad_norm = 0.3
  • warmup_ratio = 0.03

Model Limitations

Potential Biases: With its fine-tuning centered on financial conversations sources, inherent biases from these sources may reflect in the model's outputs.

Licensing

The FinanceConnect model, developed by CeADAR Connect Group, combines the licensing frameworks of Llama2, FinTalk-8k and Alpaca. Under Meta's terms, users are granted a non-exclusive, worldwide, non-transferable, royalty-free limited license for the use and modification of Llama Materials, inclusive of the Llama2 model and its associated documentation. When redistributing, the provided Agreement and a specific attribution notice must be included. In alignment with the FinTalk dataset's licensing and Alpaca dataset's licensing, the model is also distributed under the "cc-by-nc-4.0" license.

Out-of-Scope Use

FinanceConnect is specifically tailored for finanical discussions and knowledge. It is not optimized for:

  • General, non-AI-related conversations.
  • Domain-specific tasks outside financial tasks.
  • Direct interfacing with physical devices or applications.

Bias, Risks, and Limitations

  • Dataset Biases: The FinTalk-19k and Alpaca dataset may contain inherent biases that influence the model's outputs.
  • Over-reliance: The model is an aid, not a replacement for human expertise. Decisions should be made with careful consideration.
  • Content Understanding: The model lacks human-like understanding and cannot judge the veracity of knowledge.
  • Language Limitations: The model's primary language is English. Performance may decrease with other languages.
  • Knowledge Cut-off: The model may not be aware of events or trends post its last training update.

Citation:

Contact:

For any further inquiries or feedback concerning FinanceConnect, please forward your communications to ahtsham.zafar@ucd.ie