CoolFace
Modelpublic

SwayAlgo/SwayAlgo-Finance-gemma-4-E4B-it-1

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes13downloads
Model Card

SwayAlgo Finance Gemma 4 E4B-it 1

SwayAlgo Finance Gemma 4 E4B-it 1 is a finance-oriented language model adaptation built by SwayAlgo on top of google/gemma-4-E4B-it.

This repository contains the merged model weights for the verified SwayAlgo Finance Gemma 4 E4B-it 1 run that reached 45.45% accuracy on our full local BhashaBench-Finance evaluation file.

The package includes:

  • —Full merged model weights
  • —Tokenizer and chat-template files
  • —Evaluation summary
  • —Per-question predictions
  • —Mistake file

This model is not BharatGen FinanceParam. FinanceParam is a separate model from BharatGen. This repository documents SwayAlgo's own merged Gemma 4 E4B-it finance model and compares it transparently against the FinanceParam benchmark numbers shown on BharatGen's public model card.

The comparison should be read with model size in mind. FinanceParam is a smaller model based on Param-1-2.9B-Instruct, while SwayAlgo Finance Gemma 4 E4B-it 1 uses the larger Gemma 4 E4B-it base. The benchmark tables report observed accuracy under the stated evaluation setup; they are not intended to claim equal model size, equal compute cost, or equal deployment efficiency.


Motivation

Indian finance assistants need more than generic language fluency. They need practical reasoning across quantitative aptitude, accounting, banking, commerce, finance education, policy, regulatory, and business-operation style questions.

This run was designed around one focused objective: improve BhashaBench-Finance-style multiple-choice performance while keeping the training process inspectable and reproducible.

The training strategy was:

  1. 1.Start with google/gemma-4-E4B-it.
  2. 2.Fine-tune a compact LoRA adapter instead of directly updating every base-model weight.
  3. 3.Merge the trained LoRA adapter back into the Gemma 4 E4B-it base model.
  4. 4.Analyze previous mistakes.
  5. 5.Build a targeted anti-bias training corpus.
  6. 6.Evaluate the merged model on the full BhashaBench-Finance file and save all predictions.

Model Architecture

SwayAlgo Finance Gemma 4 E4B-it 1 inherits its base architecture from google/gemma-4-E4B-it.

Text model details from the local base model configuration:

  • —Base model: google/gemma-4-E4B-it
  • —Architecture: Gemma4ForConditionalGeneration
  • —Model type: gemma4
  • —Text hidden size: 2560
  • —Text intermediate size: 10240
  • —Text hidden layers: 42
  • —Attention heads: 8
  • —Key-value heads: 2
  • —Max position embeddings: 131072
  • —Sliding window: 512
  • —Vocabulary size: 262144
  • —Precision: bfloat16
  • —Training adaptation method: LoRA
  • —LoRA rank used during training: 4
  • —LoRA alpha used during training: 8
  • —LoRA dropout: 0
  • —PEFT type during training: LoRA
  • —Task type: causal language modeling
  • —Published artifact: full merged model

Training was done with LoRA, then the learned LoRA update was merged into the Gemma 4 E4B-it base weights. The uploaded model is intended to load directly as a standard causal language model.


Repository Layout

The Hugging Face repository is organized as a merged-model release with model files at the root and evaluation artifacts in separate folders:

text
.
|-- base-model-evaluations/
|-- evaluations/
|-- .gitattributes
|-- README.md
|-- chat_template.jinja
|-- config.json
|-- generation_config.json
|-- model-00001-of-00004.safetensors
|-- model-00002-of-00004.safetensors
|-- model-00003-of-00004.safetensors
|-- model-00004-of-00004.safetensors
|-- model.safetensors.index.json
|-- tokenizer.json
|-- tokenizer_config.json
`-- tokenizer_config.json.bak

The model is uploaded as a merged model, so users can load it directly with Transformers without separately attaching a LoRA adapter.


Data Preparation

The training data was prepared as a focused finance-reasoning corpus aligned with the shape of the evaluation task. The goal was to improve option selection, numerical reasoning, and consistency across common Indian finance benchmark patterns without turning the model into a memorization artifact.

The preparation flow combined structured finance examples, controlled multiple-choice transformations, and targeted correction passes from earlier evaluation traces. Questions were normalized into a compact instruction format, answer choices were balanced across labels, and exact evaluation-input overlap was filtered out before training.

At a high level, the process emphasized:

  • —Finance, accounting, aptitude, and business-reasoning coverage.
  • —Multiple-choice consistency with single-letter answer supervision.
  • —Balanced answer labels to reduce option bias.
  • —Targeted reinforcement on previously weak patterns.
  • —Reproducible JSONL generation with saved evaluation artifacts.

Approximate training exposure for this run:

  • —Optimizer steps: 8509
  • —Per-device batch size: 1
  • —Gradient accumulation: 8
  • —Approximate examples processed: 68072
  • —Epochs: 1
  • —Max sequence length: 1024

Training Setup

  • —Base model: google/gemma-4-E4B-it
  • —Training framework: Unsloth + TRL SFTTrainer + PyTorch
  • —Adaptation framework used during training: PEFT LoRA
  • —Precision: bfloat16
  • —Epochs: 1
  • —Learning rate: 3e-5
  • —LoRA rank: 4
  • —LoRA alpha: 8
  • —Gradient accumulation steps: 8
  • —Save steps: 100
  • —Final checkpoint: checkpoint-8509
  • —Final epoch: 1.0
  • —Hardware used: NVIDIA GeForce RTX 5060 Ti 16 GB

Training environment variables used for the LoRA stage before merge:

bash
UNSLOTH_BASE_MODEL=/home/swayalgo-pc-01/swayalgo-models/base/gemma-4-E4B-it
UNSLOTH_OUTPUT_DIR=/home/swayalgo-pc-01/swayalgo-models/swayalgo-finance-gemma-4-e4b-it-1-adapter
UNSLOTH_MAX_SEQ_LENGTH=1024
UNSLOTH_LORA_RANK=4
UNSLOTH_LORA_ALPHA=8
UNSLOTH_GRAD_ACCUM=8
UNSLOTH_EPOCHS=1
UNSLOTH_LEARNING_RATE=3e-5
UNSLOTH_SAVE_STEPS=100
UNSLOTH_LOGGING_STEPS=1
PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
TOKENIZERS_PARALLELISM=false

Inference Example

Because this repository is a merged model, it can be loaded directly with Transformers. PeftModel is not required for normal inference.

Gemma 4 support is expected in recent Transformers builds. If your environment does not recognize model_type: gemma4, upgrade the inference stack before loading:

bash
pip install -U "transformers>=5.13.1" accelerate safetensors torch
python
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

model_name = "Swayalgo/SwayAlgo-Finance-gemma-4-E4B-it-1"

tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
    model_name,
    torch_dtype=torch.bfloat16 if torch.cuda.is_available() else torch.float32,
    device_map="auto",
    trust_remote_code=True,
)

messages = [
    {
        "role": "user",
        "content": "A company has assets of Rs. 500000 and liabilities of Rs. 180000. What is owner's equity?",
    }
]

inputs = tokenizer.apply_chat_template(
    messages,
    tokenize=True,
    return_tensors="pt",
).to(model.device)

with torch.no_grad():
    output = model.generate(
        inputs,
        max_new_tokens=128,
        temperature=0.2,
        do_sample=False,
    )

print(tokenizer.decode(output[0], skip_special_tokens=True))

Evaluation Method

Evaluation was performed on the merged model using an internal multiple-choice scoring harness. The harness prompts the model on BhashaBench-Finance rows and extracts the final answer letter A/B/C/D/E.

Evaluated on the public BhashaBench-Finance benchmark dataset. The local Gemma 4 E4B-it base and SwayAlgo merged-model evaluations used runtime 4-bit loading through Unsloth/bitsandbytes on the same local evaluation setup. Published comparison values for smaller reference models and FinanceParam are reproduced from the BharatGen FinanceParam model card.

Evaluation artifacts in this repository:

  • —evaluations/summary.json
  • —evaluations/predictions.jsonl
  • —evaluations/mistakes.jsonl

Benchmarks

Overall BhashaBench-Finance Performance

The reference-model and FinanceParam values below are reproduced from the public BharatGen FinanceParam model card. Gemma 4 E4B-it base values are computed from gemma-4-e4b-it-base-full. SwayAlgo merged-model values are from the included local evaluation artifacts: evaluations/summary.json, evaluations/predictions.jsonl, and evaluations/mistakes.jsonl. The local Gemma 4 E4B-it base and SwayAlgo rows were both evaluated with runtime 4-bit loading, so those two rows are internally comparable under the same local runtime settings.

ModelBBFBBF EnglishBBF Hindi
gemma-2-2b-it30.2431.2627.93
Llama-3.2-1B-Instruct26.2126.2826.04
Llama-3.2-3B-Instruct31.7632.9429.09
Qwen2.5-3B-Instruct33.0934.8429.17
granite-3.1-2b-instruct31.0732.8227.11
Gemma 4 E4B-it base39.9841.6736.18
FinanceParam31.4232.2429.56
SwayAlgo Finance Gemma 4 E4B-it 145.4546.4543.20

Evaluation size:

SplitQuestionsCorrectAccuracy
Full eval19433883245.45%
English13451624846.45%
Hindi5982258443.20%

Expected answer distribution:

AnswerCount
A4563
B5083
C5048
D4739

Predicted answer distribution:

AnswerCount
Blank/no extracted answer9
A5306
B4602
C4775
D4739
E2

Domain-Wise Performance

Eval Questions is the number of local BhashaBench-Finance rows used to compute the Gemma 4 E4B-it base and SwayAlgo scores for that domain.

Domaingemma-2-2b-itLlama-3.2-1B-InstructLlama-3.2-3B-InstructQwen2.5-3B-Instructgranite-3.1-2b-instructGemma 4 E4B-it baseFinanceParamSwayAlgo Finance Gemma 4 E4B-it 1Eval Questions
Accounting30.5326.1327.6831.8230.9235.7131.0536.35773
Banking Services34.6728.1838.6836.8934.3343.0435.7850.131171
Behavioral Finance46.2728.3637.3144.7844.7850.7547.7652.2467
Business Management45.7826.5153.0140.9640.9662.6544.5871.0883
Commerce31.0527.4631.5233.7232.2140.3228.5143.34863
Corporate Finance & Investment31.9826.3735.0537.5831.8745.9335.0548.79910
Data & Analytics in Finance27.5618.1120.4728.3538.5829.1335.4335.43127
Economics & Development Studies41.2432.8540.5144.1637.5952.1940.8862.77274
Energy, Infrastructure & Finance28.0528.0539.0230.4939.0253.6634.1557.3282
Environmental Finance34.5229.7638.6944.0541.6761.3145.8362.50168
Finance Education39.8325.4234.7543.2241.5350.8531.3656.78118
Financial Markets36.1729.7948.9442.5534.0448.9440.4363.8347
Financial Technology47.8313.0434.7839.1334.7869.5743.4869.5723
General Knowledge38.4028.9443.0438.2239.1549.1740.0755.66539
Governance & Policy34.2127.6339.2938.1635.1548.3138.1653.101064
Healthcare Economics39.4731.5841.2345.6134.2156.1436.8451.75114
History, Sociology & Cultural Studies of Finance41.7330.7144.8838.5837.0149.6145.6753.54127
Information Technology Finance44.4935.5153.0658.1648.1681.4358.1682.04490
Insurance & Risk Management30.9526.1938.1038.1033.3340.4835.7157.1442
Interdisciplinary Finance36.6030.7233.3336.6037.2547.0637.2561.44153
International Finance & Trade42.1734.9439.7642.1736.1444.5845.7854.2283
Language & Communication40.0629.1840.5942.7135.9464.4841.6568.60946
Legal Finance41.1820.5920.5923.5350.0047.0620.5955.8834
Marketing Finance35.7138.1038.1050.0054.7661.9061.9076.1942
Mathematics for Finance25.9624.9127.5729.8527.6632.0525.5937.174845
Problem Solving24.7623.6525.1526.2026.5631.3825.7138.275686
Rural Economics40.6130.6544.8345.2141.7657.8547.1367.43261
Science and Technology in Finance37.6230.6941.5843.5627.7242.5740.5956.44101
Sports, Media & Finance Linkages48.8928.8942.2253.3328.8942.2235.5651.1145
Taxation & Regulatory Compliance45.8131.6147.1038.7131.6150.3237.4251.61155

Difficulty-Level Performance

Eval Questions is the number of local BhashaBench-Finance rows used to compute the Gemma 4 E4B-it base and SwayAlgo scores for that difficulty level.

Difficultygemma-2-2b-itLlama-3.2-1B-InstructLlama-3.2-3B-InstructQwen2.5-3B-Instructgranite-3.1-2b-instructGemma 4 E4B-it baseFinanceParamSwayAlgo Finance Gemma 4 E4B-it 1Eval Questions
Easy36.5528.7239.7339.9136.6850.7538.3155.697111
Medium27.6725.5028.2030.4828.6335.9327.7141.429348
Hard23.2022.4323.8725.0225.3226.9326.6033.622974

Question-Type Performance

Eval Questions is the number of local BhashaBench-Finance rows used to compute the Gemma 4 E4B-it base and SwayAlgo scores for that question type. The single Essay row in the local artifact is omitted from this table because the comparison model card does not report an essay row.

Question Typegemma-2-2b-itLlama-3.2-1B-InstructLlama-3.2-3B-InstructQwen2.5-3B-Instructgranite-3.1-2b-instructGemma 4 E4B-it baseFinanceParamSwayAlgo Finance Gemma 4 E4B-it 1Eval Questions
Assertion or Reasoning32.5628.8435.3527.4433.9547.9129.7744.19215
Fill in the blanks35.6627.9738.1144.0633.9260.4944.7667.13286
MCQ30.4026.2931.7133.2031.3139.7731.5345.6718019
Match the column24.3720.1732.7731.0930.2541.1822.6946.22119
Reading Comprehension30.5925.8831.7628.2431.7636.4730.5940.0085
Rearrange the sequence24.2923.5929.1028.3922.8834.7525.1431.92708

Benchmark interpretation note: SwayAlgo numbers are truthful to the local merged-model evaluation artifacts included with this repository. Gemma 4 E4B-it base and SwayAlgo numbers are computed with local evaluation artifacts using runtime 4-bit loading. The other reference-model and FinanceParam numbers are reproduced from the published FinanceParam model card. Treat this as a reported-results comparison unless all models are rerun through the exact same benchmark checkout, prompt, decoding parameters, runtime precision or quantization mode, and answer-extraction script.


Limitations

  • —This model is not a certified tax, legal, accounting, or investment advisor.
  • —It can make mistakes on hard reasoning, rearrangement, reading comprehension, and mathematics-heavy questions.
  • —The training process targeted benchmark-style multiple-choice behavior, so open-ended finance quality should be evaluated separately.
  • —Benchmark comparison depends on prompt format, decoding settings, and answer extraction logic.
  • —The base model license and Apache 2.0 terms must be followed.

References


Citation

If you use this model or its reported evaluation artifacts, cite it as:

bibtex
@misc{swayalgo_finance_gemma_4_e4b_it_1_2026,
  title        = {SwayAlgo Finance Gemma 4 E4B-it 1},
  author       = {SwayAlgo},
  year         = {2026},
  howpublished = {\url{https://huggingface.co/Swayalgo/SwayAlgo-Finance-gemma-4-E4B-it-1}},
  note         = {Merged finance-domain model based on google/gemma-4-E4B-it}
}