CoolFace
Modelpublic

Aditya757864/llama3.1-8b-fincot

sourceHugging Facellama3.1updated 1mo agoView on Hugging Face
0likes26downloads
Model Card

Llama-3.1-8B FinCoT — Financial Reasoning Model

A LoRA fine-tune of Meta-Llama-3.1-8B-Instruct for financial question answering with explicit step-by-step reasoning. Trained on the TheFinAI/FinCoT dataset using Unsloth.

The model is trained to produce output in two parts: a chain-of-thought under Reasoning: followed by a concise conclusion under Final Answer:.

Intended use

Answering financial questions grounded in a provided context — amortization schedules, margin and ratio calculations, lease commitments, and similar numeric reasoning over financial statements.

Not intended for: real investment, tax, or legal advice. Outputs may contain arithmetic or reasoning errors and should be independently verified.

Model track

image

How to use

This repo contains a LoRA adapter. Load it with the base model:

python
from unsloth import FastLanguageModel

model, tokenizer = FastLanguageModel.from_pretrained(
    model_name="your-hf-username/llama3.1-8b-fincot",
    max_seq_length=4096,
    load_in_4bit=False,
)
FastLanguageModel.for_inference(model)

SYSTEM_PROMPT = (
    "You are a financial reasoning assistant. Work through the problem "
    'step by step under "Reasoning:", then give the polished final answer '
    'under "Final Answer:".'
)

messages = [
    {"role": "system", "content": SYSTEM_PROMPT},
    {"role": "user", "content": "Please answer the given financial question based on the context.\n\n[your context]\n\nQuestion: [your question]"},
]
inputs = tokenizer.apply_chat_template(
    messages, tokenize=True, add_generation_prompt=True, return_tensors="pt"
).to("cuda")
out = model.generate(input_ids=inputs, max_new_tokens=512, use_cache=True)
print(tokenizer.batch_decode(out))

Prompt format

The model expects the system prompt above and produces:

Reasoning:
<step-by-step working>

Final Answer:
<concise answer>

Split on the Final Answer: marker to separate reasoning from the answer.

Training details

  • —Base model: meta-llama/Meta-Llama-3.1-8B-Instruct
  • —Dataset: TheFinAI/FinCoT (SFT split)
  • —Method: LoRA (r=16, alpha=16, dropout=0) on q/k/v/o/gate/up/down projections
  • —Framework: Unsloth + TRL SFTTrainer
  • —Precision: bf16
  • —Epochs: 1
  • —Learning rate: 2e-4 (linear schedule, 10 warmup steps)
  • —Optimizer: adamwtorchfused
  • —Max sequence length: 4096
  • —Hardware: NVIDIA B200

Limitations

  • —Trained on one epoch of a single dataset; may not generalize beyond financial-statement QA.
  • —Can produce confident but incorrect calculations — always verify figures.
  • —Inherits limitations and biases of the base Llama-3.1-8B model.

License

Governed by the Llama 3.1 Community License.