z0n3x's picture
model card: document default <think> reasoning + LM Studio reasoning tags + text-only note
f2b2cb2 verified
|
Raw
History Blame Contribute Delete
5.93 kB
metadata
license: gemma
base_model: mlx-community/gemma-4-12B-it-bf16
base_model_relation: finetune
library_name: mlx
pipeline_tag: text-generation
inference: false
language:
  - en
metrics:
  - accuracy
tags:
  - mlx
  - gemma
  - gemma4
  - finance
  - financial-reasoning
  - crypto
  - grpo
  - fin-r1
  - reasoning
model-index:
  - name: gemma-4-12b-fin-grpo-v4
    results:
      - task:
          type: text-generation
          name: Financial Reasoning (FinQA)
        dataset:
          type: ChanceFocus/flare-finqa
          name: FinQA  FLARE test (N=100)
        metrics:
          - type: accuracy
            value: 64
            name: accuracy
      - task:
          type: text-generation
          name: Conversational Financial Reasoning (ConvFinQA)
        dataset:
          type: ChanceFocus/flare-convfinqa
          name: ConvFinQA  FLARE test (N=100)
        metrics:
          - type: accuracy
            value: 60
            name: accuracy

gemma-4-12b-fin-grpo-v4

A financial-reasoning + crypto model that reproduces the Fin-R1 recipe (Fin-R1: SFT → GRPO on financial chain-of-thought data) on a larger baseGemma 4 12B-it — trained locally on Apple Silicon with mlx-lm-lora.

It reasons step-by-step inside <think> </think> tags, then gives a clear final answer. Coverage spans the whole investment sector — fiat markets, equities, derivatives, macro, accounting, and crypto / DeFi / trading (SMC, ICT, FVG, etc.).

  • Base model: mlx-community/gemma-4-12B-it-bf16 (← google/gemma-4-12b-it)
  • Method: LoRA SFT (rank 16) → GRPO (Fin-R1 stage 2), then fused to full bf16 weights
  • Params / dtype: 12B, bf16 (22 GB)
  • Framework: MLX (mlx-lm). model_type: gemma4.

Training recipe

Stage Data Notes
SFT (v4) ~30k examples: financial CoT (Fino1 FinQA+CoT, fin-alpaca-r1, Finance-Instruct, TAT-QA CoT), crypto trading, an industry/security corpus, and FalseReject de-refusal broad + balanced
GRPO 12k verifiable items (FinQA-style numerics + crypto BUY/HOLD/SELL labels) rewards: think_format + numeric_or_label_accuracy, 200 iters

Evaluation

FinQA / ConvFinQA accuracy (N=100, FLARE test split):

Model FinQA ConvFinQA
base gemma-4-12B-it 27.5% — (often refuses)
SFT v4 61% 59%
this model (SFT→GRPO v4) 64% 60%
Fin-R1 (paper reference) 76% 85%

GRPO added +3 / +1 over SFT, matching the paper's reported lift. De-refusal eval: 100% of legitimate finance/investment questions answered, illegitimate ones still refused.

The model is intentionally broad rather than benchmark-maximized: it trades a few FinQA points versus a narrow FinQA-tuned model (Fin-R1) for crypto/trading coverage that Fin-R1 does not have (e.g. Fin-R1 does not know SMC/ICT terms like Fair Value Gap).

Usage (MLX)

from mlx_lm import load, generate

model, tokenizer = load("z0n3x/gemma-4-12b-fin-grpo-v4")

system = ("You are a financial reasoning assistant covering the whole investment "
          "sector — fiat markets, equities, derivatives, macro, accounting, and "
          "crypto/DeFi. Reason step by step inside <think> </think> tags, then give "
          "a clear, correct final answer.")
messages = [
    {"role": "system", "content": system},
    {"role": "user", "content": "What is a Fair Value Gap (FVG) and how do traders use it?"},
]
prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True)
print(generate(model, tokenizer, prompt=prompt, max_tokens=800))

Thinking / reasoning

The chat template defaults to a reasoning system prompt, so the model produces <think> … </think> then the answer out of the box — you don't need to pass a system message (pass your own to override it). The reasoning markers are <think> / </think> (this model was trained on those tags, not Gemma's native <|channel>thought format).

  • LM Studio: set the reasoning / "thinking" section tags to <think> (start) and </think> (end) to fold the chain-of-thought into a collapsible block.
  • Text-only: the base Gemma 4 vision/audio weights were dropped during fine-tuning, so this checkpoint is not multimodal — by design (Fin-R1 is a text recipe).

Note on loading: these are brand-new Gemma 4 "unified" weights. With some mlx-lm versions you may need a small load-time shim that (a) resolves model_type: gemma4 and (b) drops unused multimodal tensors. This is a text-only checkpoint.

Limitations & disclosures

  • Not financial advice. Outputs are model-generated and can be wrong; verify numbers and do your own research before acting on any market view.
  • De-refusal calibration. Trained (with the FalseReject dataset) to answer legitimate finance/investment questions candidly instead of over-refusing. The boundary kept during training was not optimizing for fraud, money-laundering, or market-manipulation use.
  • Includes a private corpus. Part of the SFT mix is the author's own industry/security ("OAK") corpus; outputs may reflect its style/content.
  • MLX checkpoint. Built and tested with mlx-lm; not validated under transformers.

License

This is a derivative of Google Gemma and is distributed under the Gemma Terms of Use. By using these weights you agree to those terms and to Google's Prohibited Use Policy.

Citation

Built following the Fin-R1 recipe:

@article{liu2025finr1,
  title={Fin-R1: A Large Language Model for Financial Reasoning through Reinforcement Learning},
  author={Liu, Zhaowei and others},
  journal={arXiv preprint arXiv:2503.16252},
  year={2025}
}