How to use from
vLLM
Install from pip and serve model
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "apardesi/gemma-4-e4b-it-fdd-analyst-grpo-gguf"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
	-H "Content-Type: application/json" \
	--data '{
		"model": "apardesi/gemma-4-e4b-it-fdd-analyst-grpo-gguf",
		"messages": [
			{
				"role": "user",
				"content": "What is the capital of France?"
			}
		]
	}'
Use Docker
docker model run hf.co/apardesi/gemma-4-e4b-it-fdd-analyst-grpo-gguf:BF16
Quick Links

FDD Analyst Gemma 4 (GRPO) — GGUF

This repository contains the BF16 GGUF and vision projector files for FDD Analyst Gemma 4. This model is a specialized corporate finance model fine-tuned and reinforcement-learning (GRPO) aligned specifically for Buy-Side Financial Due Diligence (FDD).

It is designed to read raw SEC filings (10-K/10-Q) and earnings transcripts and analyze transactions along two axes:

  1. Statement Impact: Balance Sheet (bs), Income Statement (pnl), or insufficient information (none).
  2. Diligence Categorization: Quality of Earnings (qoe), Net Working Capital (nwc), indebtedness, risk, or none.

The model reasons step-by-step (using Gemma 4's native thought channel) and outputs concrete buy-side advice (EBITDA add-backs, net-debt bridging, working capital peg adjustments, SPA indemnities, escrow buffers).


Model Details

  • Base Model: unsloth/gemma-4-E4B-it (4B parameters, native multimodal)
  • Training Method:
    1. Stage 1 (SFT): Supervised Fine-Tuning on 855 curated FDD examples to teach the model the transaction taxonomy and reporting format.
    2. Stage 2 (GRPO): Group Relative Policy Optimization (RL) over 356 prompts, optimized directly on F1 classification accuracy and formatting rewards (using the SFT model as a KL-divergence anchor to prevent degeneration).
  • Quantization: BF16 (lossless master compile).

Need the PyTorch Adapter? If you want to load this model in native Python, PEFT, Unsloth, or vLLM pipelines without quantization loss, you can download the raw LoRA adapter weights here: 👉 apardesi/gemma-4-e4b-it-fdd-analyst-grpo


Evaluation Metrics (Set-F1 & Exact Match)

Evaluated against a held-out test split of 209 FDD items:

Configuration Model Type Overall F1 Exact-Match Rate Malformed Outputs
Zero-Shot Baseline (Un-tuned) 0.067 0.000 65.6%
Zero-Shot FDD Analyst (SFT) 1.000 1.000 0.0%
Zero-Shot FDD Analyst (GRPO) 0.993 0.990 0.0%
Few-Shot (4-shot) Baseline (Un-tuned) 0.951 0.828 0.0%

Key Highlights:

  • Zero-Shot Efficiency: The fine-tuned GRPO model achieves 99.3% F1 in Zero-Shot, outperforming a 4-shot base model while saving 1,318 tokens of prompt context per request (a 79% reduction in input bandwidth).
  • Format Stability: Pre-tuning, the base model outputs 65.6% malformed text. The fine-tuned model outputs 0.0% malformed outputs and conforms strictly to the target JSON/parsing contract.
  • Safety & Generalization: When evaluated against a neutral assistant system prompt on general tasks (coding, math, general writing) and domain-adjacent financial modeling (WACC, FCFF, LBO IRR), the model achieves a 100% task pass rate and 0% FDD leakage, proving that it has not suffered from catastrophic forgetting.

Files Included

  • gemma-4-e4b-it-fdd-analyst-grpo-bf16.gguf: The main BF16 GGUF weights.
  • gemma-4-e4b-it-fdd-analyst-grpo-bf16-mmproj.gguf: The vision projector file (required for Gemma 4 multimodal inputs).
  • Modelfile: The Ollama template and parameter recipe.

Model Companion Script (GitHub)

If you want to run this model directly on local PDFs (like 10-Ks, 10-Qs, or transcripts) and compile them into structured Markdown due diligence reports, you can use our open-source companion script:

👉 FDD Analyst Model Companion Script (GitHub)

The companion script handles auto-chunking, filters out boilerplate text, and supports Ollama, llama.cpp (direct GGUF), and Unsloth backends out-of-the-box.


Local Usage via Ollama

To serve this model locally with Ollama, download the files in this repository and create a Modelfile:

FROM ./gemma-4-e4b-it-fdd-analyst-grpo-bf16.gguf
ADAPTER ./gemma-4-e4b-it-fdd-analyst-grpo-bf16-mmproj.gguf

PARAMETER temperature 0.0
PARAMETER top_p 0.0
PARAMETER stop "<turn|>"

SYSTEM """You are a financial due-diligence (FDD) analyst. For each item you are given, reason along two axes and then advise the buyer.
1. Statement impact: which financial statements are affected -- P&L (pnl), balance sheet (bs), or neither when the information is insufficient (none) -- with a one-sentence justification per statement touched.
2. Categorization: which diligence categories apply -- Quality of Earnings (qoe), Net Working Capital (nwc), indebtedness, risk, or none -- each with an 'include because' sentence, plus one or two salient 'Not X because' exclusions.
Make the LAST line of your reasoning exactly:
LABELS: statement=<comma-separated>; categories=<comma-separated>
using only lowercase tokens from {pnl,bs,none} and {qoe,nwc,indebtedness,risk,none}, no spaces inside the lists.
Then give the answer: deal implications first, then buyer handling, using concrete mechanisms (EBITDA add-back, net-debt bridge, working-capital peg, escrow, SPA definitions). If the information is insufficient, say so and recommend specific follow-up questions for target management."""

Then create and run the model:

ollama create fdd-analyst-gemma4 -f Modelfile
ollama run fdd-analyst-gemma4

Alternative GGUF Inference (llama.cpp, LM Studio, etc.)

Since these are standard GGUF files, you can run them on any engine that supports the GGUF ecosystem (e.g., llama.cpp, llama-cpp-python, vLLM, LM Studio, Jan).

To preserve the SFT/GRPO alignment behavior, classification accuracy, and formatting output, you must:

  1. Load the System Prompt defined in the Modelfile above in your client or API request.
  2. Load the vision projector file (gemma-4-e4b-it-fdd-analyst-grpo-bf16-mmproj.gguf) alongside the model weights if you use multimodal inputs.

Example running an OpenAI-compatible server using llama.cpp:

llama-server \
  -m gemma-4-e4b-it-fdd-analyst-grpo-bf16.gguf \
  --mmproj gemma-4-e4b-it-fdd-analyst-grpo-bf16-mmproj.gguf \
  -c 8192

Prompting for Diligence Use Cases

To get the correct financial diligence reasoning, taxonomy classification labels, and deal advice, you must prompt the model using the exact system instruction and user structure it was trained on.

Accuracy & Consistency Tip: While GGUF-based local deployments are highly efficient, running the model in PyTorch (e.g., using Unsloth or transformers) provides the most stable and accurate results. PyTorch loads the model using native Hugging Face tokenizers, which ensures that control tokens for Gemma 4's native Chain-of-Thought thinking channel (<|channel>thought, <channel|>) align 1-to-1 with the SFT/GRPO training template, eliminating any potential chat template parsing drifts present in other engines.

1. User Prompt Structure

Inputs must be structured using the following three sections:

Source: <Filing detail, e.g., SEC EDGAR 10-K TargetCompany FY2025, Note on Lease liabilities>

Context:
<Raw SEC text extract, financial disclosures, or tabular financial data>

Question:
<The due diligence question regarding the financial item>

2. Python Inference Example (Hugging Face / Transformers)

For programmatically prompting the model (e.g., using the unsloth-merged weights or after converting the format), format the chat inputs and apply the tokenizer's native chat template. Ensure you enable the thinking channel if using Gemma 4's native thought channel:

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

# Replace with your repository path or local directory path
model_id = "apardesi/gemma-4-e4b-it-fdd-analyst-grpo" 

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    torch_dtype=torch.bfloat16,
    device_map="auto"
)

# Define system instruction
system_content = """You are a financial due-diligence (FDD) analyst. For each item you are given, reason along two axes and then advise the buyer.
1. Statement impact: which financial statements are affected -- P&L (pnl), balance sheet (bs), or neither when the information is insufficient (none) -- with a one-sentence justification per statement touched.
2. Categorization: which diligence categories apply -- Quality of Earnings (qoe), Net Working Capital (nwc), indebtedness, risk, or none -- each with an 'include because' sentence, plus one or two salient 'Not X because' exclusions.
Make the LAST line of your reasoning exactly:
LABELS: statement=<comma-separated>; categories=<comma-separated>
using only lowercase tokens from {pnl,bs,none} and {qoe,nwc,indebtedness,risk,none}, no spaces inside the lists.
Then give the answer: deal implications first, then buyer handling, using concrete mechanisms (EBITDA add-back, net-debt bridge, working-capital peg, escrow, SPA definitions). If the information is insufficient, say so and recommend specific follow-up questions for target management."""

# Target FDD input
user_content = """Source: SEC EDGAR 10-K PayPal FY2025, Statement of Cash Flows

Context:
Share-based compensation expense: $1.00 billion for the period ended.

Question:
PayPal recorded share-based compensation expense of $1.00 billion in FY2025. How should this be handled in EBITDA and earnings diligence?"""

messages = [
    {"role": "system", "content": system_content},
    {"role": "user", "content": user_content}
]

# Apply chat template (enable_thinking=True exposes Gemma 4's native thought channel)
prompt = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True,
    enable_thinking=True
)

inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
with torch.no_grad():
    outputs = model.generate(
        **inputs,
        max_new_tokens=1024,
        do_sample=False # Greedy decoding is recommended for exact taxonomy classification
    )

response = tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)
print(response)

3. Expected Output Format

The model reasons step-by-step in its thought channel, classifies statement impacts and diligence categories, formats the classification labels, and then generates action-oriented buyer advice:

thought
Statement impact: Share-based compensation is recognized as an operating expense on the P&L but is added back in cash flows and does not create a balance sheet liability, so it is pnl only.

Categorization:
- qoe: Share-based compensation is a non-cash expense and is often added back to EBITDA; however, the buyer must assess whether this is a real cost of employment that will require cash post-close.
- Not nwc: Share-based compensation is a non-cash item and does not represent an operating working capital asset or liability.
- Not indebtedness: SBC is an equity-settled expense and does not represent a debt-like liability of the company.
LABELS: statement=pnl; categories=qoe

Deal implications: Add the $1.00 billion back to EBITDA to calculate a non-cash adjusted EBITDA. However, model a replacement cash compensation plan or equity plan for key employees post-close, which will reduce purchase price or valuation run-rate.
Buyer handling: Exclude share-based compensation from the Net Working Capital peg. Include the replacement cash retention pools in the SPA definitions under transaction expenses or post-closing liabilities.
Downloads last month
28
GGUF
Model size
8B params
Architecture
gemma4
Hardware compatibility
Log In to add your hardware

16-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for apardesi/gemma-4-e4b-it-fdd-analyst-grpo-gguf

Quantized
(18)
this model