CoolFace
Modelpublic

ramtinasadi/Quantfinlab-Qwen3.5-2B-Financial-Analysis-LoRA

sourceHugging Faceapache-2.0updated 7d agoView on Hugging Face
0likes37downloads
Model Card

Qwen3.5-2B Quantfinlab Financial Analyst LoRA

This repository contains the LoRA adapter for Qwen3.5-2B Quantfinlab Financial Analyst, an English financial-analysis adaptation of Qwen/Qwen3.5-2B.

The adapter was developed for Financial Analysis with Local LLM in the Quantitative Finance Lab. It is published primarily for training reproducibility, inspection, and continued experimentation.

For lightweight local inference, use the companion Q4_K_M GGUF repository.

Project and reproducibility links

Purpose

The adapter modifies the language path of Qwen3.5-2B for evidence-grounded financial analysis.

The intended workflow supplies current evidence and calculated financial context at runtime. The model then analyzes what changed, what appears material, why it may matter, which evidence supports each claim, and where uncertainty remains.

The five supervised task families are:

  • —Financial-event analysis
  • —SEC filing-change analysis
  • —Macro-release analysis
  • —Cross-source evidence reconciliation
  • —Market and cross-asset synthesis

These correspond directly to the workflows demonstrated in Project 24.

Training-data design

Training used a reviewed and frozen evidence-grounded dataset rather than generic financial instruction data.

Each example contains a point-in-time evidence packet and a supervised analytical response. Before training, the pipeline verifies source timestamps and text hashes and requires all evidence to have been available by the example's declared analysis cutoff.

The training notebook enforces separation between training and validation using:

  • —example IDs;
  • —event/group IDs;
  • —source IDs;
  • —source hashes;
  • —strict chronological separation.

Validation examples are strictly later than the training examples.

The model-visible targets train the assistant to produce structured financial analysis rather than hidden chain-of-thought. The supervised output contains:

  • —conclusion;
  • —materiality;
  • —evidence-linked claims;
  • —what changed;
  • —why it matters;
  • —uncertainty.

The underlying source corpus is not published here as a general-purpose financial dataset. The reproducible training logic, schema checks, and processing workflow are documented in the training notebook.

Training configuration

The adapter was trained from the following pinned base:

  • —Base model: Qwen/Qwen3.5-2B
  • —Base revision: 15852e8c16360a2fea060d615a32b45270f8a8fc

The workflow uses the text/language path only; vision layers were frozen.

SettingValue
Base precision16-bit
Training context8,192 tokens
LoRA rank16
LoRA alpha16
LoRA dropout0
Biasnone
Epochs2
Learning rate5e-5
Per-device train batch size1
Gradient accumulation8
Seed3407
Training objectiveCompletion-only / assistant-output tokens

LoRA target modules:

text
q_proj
k_proj
v_proj
o_proj
gate_proj
up_proj
down_proj

The training notebook verifies that only LoRA parameters are trainable and rejects unexpected trainable vision projections or 4-bit base-model loading.

Reproducible training workflow

The complete workflow is implemented in qwen_train_lora.ipynb.

The notebook:

  1. 1.loads a pinned training environment;
  2. 2.verifies GPU, precision, and storage requirements;
  3. 3.verifies the frozen dataset and SHA256 checksums;
  4. 4.checks point-in-time evidence integrity and train/validation leakage;
  5. 5.validates every reference target before training;
  6. 6.verifies completion-only masking and the Qwen chat template;
  7. 7.trains the LoRA with checkpointing and validation;
  8. 8.performs held-out adapter acceptance checks;
  9. 9.merges the adapter with the exact pinned base revision;
  10. 10.converts the merged model to GGUF through a pinned llama.cpp revision;
  11. 11.quantizes the model to Q4KM;
  12. 12.loads the quantized GGUF and performs post-export checks;
  13. 13.writes export manifests, model hashes, dataset metadata, output schema, and chat-template metadata.

The notebook is designed to be resumable: completed adapters, merge artifacts, conversions, and quantization outputs are checksum-verified and reused rather than silently rebuilt.

Open it directly in Google Colab.

Acceptance checks

The adapter was checked on 30 held-out validation examples, six examples from each of the five task families.

All 30/30 adapter checks passed on the first attempt in the published release workflow.

The companion Q4KM export was separately loaded through llama.cpp and passed 5/5 post-export task checks.

The automatic checks cover:

  • —valid structured output;
  • —valid evidence references;
  • —numerical traceability to supplied evidence;
  • —normal generation termination;
  • —repeated-claim detection.

These are release and grounding checks. They are not a benchmark of financial judgment, investment performance, forecasting accuracy, or superiority over another language model.

Loading the adapter

A compatible PEFT/Transformers workflow can load the pinned base and this adapter.

python
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel

base_id = "Qwen/Qwen3.5-2B"
adapter_id = "ramtinasadi/Quantfinlab-Qwen3.5-2B-Financial-Analysis-LoRA"
base_revision = "15852e8c16360a2fea060d615a32b45270f8a8fc"

tokenizer = AutoTokenizer.from_pretrained(base_id, revision=base_revision)
base = AutoModelForCausalLM.from_pretrained(
    base_id,
    revision=base_revision,
    torch_dtype="auto",
    device_map="auto",
)
model = PeftModel.from_pretrained(base, adapter_id)

For exact reproducibility, use the pinned environment documented in the training notebook.

For low-memory local use, the companion GGUF repository is the intended artifact.

Relationship to Project 24

The LoRA is only one component of Project 24. The full project adds:

  • —targeted SEC and official-document ingestion;
  • —point-in-time source availability;
  • —section-aware chunking and SQLite FTS5/BM25 retrieval;
  • —calculated Quantfinlab market, risk, volatility, rates, financial-conditions, factor, cross-asset, fundamentals, credit, and macro context;
  • —local Q4KM inference through llama.cpp;
  • —evidence and numerical validation;
  • —response caching;
  • —higher-level company, macro, event, market, and daily-analysis workflows.

See the complete implementation in Financial Analysis with Local LLM.

Intended use

The adapter is intended for:

  • —reproduction of the Quantfinlab financial-analysis model;
  • —continued PEFT experimentation;
  • —evidence-grounded analysis of supplied financial documents;
  • —SEC disclosure-change analysis;
  • —macro-release interpretation;
  • —financial-event analysis;
  • —market and cross-asset synthesis with supplied structured context.

Limitations

  • —The adapter does not make Qwen3.5-2B a source of live financial data.
  • —The model remains small and can produce weak or incorrect interpretations.
  • —Good results depend strongly on evidence quality, retrieval, quantitative context, and post-generation validation.
  • —Causal market explanations require particular caution.
  • —The adaptation is English-focused.
  • —Vision layers were not fine-tuned.
  • —Outputs should not be treated as investment recommendations or as a substitute for independent verification.

License and attribution

This adapter is derived from Qwen/Qwen3.5-2B, released under the Apache License 2.0. This repository uses the same license.

Please retain attribution to the original Qwen model when redistributing derivative artifacts.

Author

Developed by Ramtin Asadi as part of the open-source Quantitative Finance Lab.