Instructions to use TheTokenFactory/gemma-4-E2B-sec-extraction-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use TheTokenFactory/gemma-4-E2B-sec-extraction-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="TheTokenFactory/gemma-4-E2B-sec-extraction-GGUF", filename="gemma-4-E2B-it.BF16-mmproj.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use TheTokenFactory/gemma-4-E2B-sec-extraction-GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf TheTokenFactory/gemma-4-E2B-sec-extraction-GGUF:BF16 # Run inference directly in the terminal: llama-cli -hf TheTokenFactory/gemma-4-E2B-sec-extraction-GGUF:BF16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf TheTokenFactory/gemma-4-E2B-sec-extraction-GGUF:BF16 # Run inference directly in the terminal: llama-cli -hf TheTokenFactory/gemma-4-E2B-sec-extraction-GGUF:BF16
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf TheTokenFactory/gemma-4-E2B-sec-extraction-GGUF:BF16 # Run inference directly in the terminal: ./llama-cli -hf TheTokenFactory/gemma-4-E2B-sec-extraction-GGUF:BF16
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf TheTokenFactory/gemma-4-E2B-sec-extraction-GGUF:BF16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf TheTokenFactory/gemma-4-E2B-sec-extraction-GGUF:BF16
Use Docker
docker model run hf.co/TheTokenFactory/gemma-4-E2B-sec-extraction-GGUF:BF16
- LM Studio
- Jan
- vLLM
How to use TheTokenFactory/gemma-4-E2B-sec-extraction-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TheTokenFactory/gemma-4-E2B-sec-extraction-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": "TheTokenFactory/gemma-4-E2B-sec-extraction-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/TheTokenFactory/gemma-4-E2B-sec-extraction-GGUF:BF16
- Ollama
How to use TheTokenFactory/gemma-4-E2B-sec-extraction-GGUF with Ollama:
ollama run hf.co/TheTokenFactory/gemma-4-E2B-sec-extraction-GGUF:BF16
- Unsloth Studio new
How to use TheTokenFactory/gemma-4-E2B-sec-extraction-GGUF with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for TheTokenFactory/gemma-4-E2B-sec-extraction-GGUF to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for TheTokenFactory/gemma-4-E2B-sec-extraction-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for TheTokenFactory/gemma-4-E2B-sec-extraction-GGUF to start chatting
- Pi new
How to use TheTokenFactory/gemma-4-E2B-sec-extraction-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf TheTokenFactory/gemma-4-E2B-sec-extraction-GGUF:BF16
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "TheTokenFactory/gemma-4-E2B-sec-extraction-GGUF:BF16" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use TheTokenFactory/gemma-4-E2B-sec-extraction-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf TheTokenFactory/gemma-4-E2B-sec-extraction-GGUF:BF16
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default TheTokenFactory/gemma-4-E2B-sec-extraction-GGUF:BF16
Run Hermes
hermes
- Docker Model Runner
How to use TheTokenFactory/gemma-4-E2B-sec-extraction-GGUF with Docker Model Runner:
docker model run hf.co/TheTokenFactory/gemma-4-E2B-sec-extraction-GGUF:BF16
- Lemonade
How to use TheTokenFactory/gemma-4-E2B-sec-extraction-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull TheTokenFactory/gemma-4-E2B-sec-extraction-GGUF:BF16
Run and chat with the model
lemonade run user.gemma-4-E2B-sec-extraction-GGUF-BF16
List all available models
lemonade list
DEPRECATED — Please use gemma-4-E2B-sec-extraction-GGUF-v2 instead.
v2 was trained on a combined instruction + corrective dataset (3,957 examples vs. 2,726) and shows measurably stronger extraction quality, including a 2 percentage point reduction in hallucination rate versus the base Gemma 4 E2B model (10.7% vs. 12.7%). v2 also improves symbol compliance (+0.9%), reduces bare number errors (-0.8%), and eliminates year-as-value hallucinations entirely.
This v1 model remains available for reproducibility but is no longer recommended for production use.
Gemma 4 E2B — SEC Financial Extraction (v1, GGUF) [DEPRECATED]
A fine-tuned Gemma 4 E2B model specialized for extracting structured financial data from SEC Exhibit 10 material contracts. Quantized to Q4_K_M GGUF for efficient local inference.
What This Model Does
Given raw text from an SEC filing (employment agreements, credit facilities, merger agreements, etc.), this model extracts structured JSON containing:
- Metadata — effective dates and contracting party names
- Financial terms — dollar amounts and percentages classified into 13 categories (salary, bonus, severance, equity_grant, credit_facility, interest_rate, etc.)
- Debt covenants — financial maintenance tests classified into 7 categories (leverage_ratio, interest_coverage, debt_service, net_worth, etc.)
Why You Should Use v2 Instead
| Metric | v1 | v2 | Delta |
|---|---|---|---|
| Hallucination phrase rate | — | 10.7% (vs 12.7% base) | -2.0pp |
| Symbol compliance | — | 84.3% (vs 83.4% base) | +0.9pp |
| Bare number rate | — | 8.8% (vs 9.6% base) | -0.8pp |
| Year-as-value errors | — | 0 (vs 1 base) | Eliminated |
| Training examples | 2,726 | 3,957 | +45% |
| Training signal | Positive only | Positive + corrective + hard negatives | Richer |
v2 is a strict upgrade — same base model, same hardware requirements, better extraction quality across all measured dimensions.
Upgrade: TheTokenFactory/gemma-4-E2B-sec-extraction-GGUF-v2
Usage
LM Studio
- Download
gemma-4-E2B-it.Q4_K_M.gguf(3.4 GB) - Import into LM Studio
- Set GPU Layers to max (35/35), Context Length to 4096
- Send extraction prompts via the chat API at
http://localhost:1234/v1
Python (via OpenAI-compatible API)
from openai import OpenAI
client = OpenAI(base_url="http://localhost:1234/v1", api_key="lm-studio")
response = client.chat.completions.create(
model="gemma",
temperature=0.1,
messages=[
{"role": "system", "content": "You are a financial analyst AI. Extract ALL monetary dollar amounts and financial percentages. Output strictly as JSON."},
{"role": "user", "content": "<contract text here>"},
],
)
print(response.choices[0].message.content)
Training Details
| Parameter | Value |
|---|---|
| Base model | unsloth/gemma-4-E2B-it |
| Method | QLoRA (4-bit) via Unsloth |
| LoRA rank | 8 |
| LoRA alpha | 8 |
| Epochs | 3 |
| Learning rate | 2e-4 |
| Max sequence length | 2,048 tokens |
| Training examples | 2,726 (positive only) |
| Quantization | Q4_K_M |
| Hardware | Google Colab T4 (16 GB VRAM) |
Financial Term Types (13 categories)
salary bonus severance retirement_benefit equity_grant credit_facility loan_amount interest_rate fee threshold purchase_price compensation other
Covenant Types (7 categories)
leverage_ratio interest_coverage debt_service net_worth liquidity fixed_charge other
Hardware Requirements
| Setup | VRAM | Notes |
|---|---|---|
| RTX 4050 / 4060 (6 GB) | 3.4 GB model + KV cache | Full GPU offload, 4096 context |
| RTX 3060 / 4070 (8+ GB) | Comfortable headroom | |
| CPU-only | ~4 GB RAM | Slower, but works |
Limitations
- Temporal scope: Trained on S&P 500 filings from a 6-month window
- Universe: Large-cap US equities only (S&P 500)
- Language: English only
- Label quality: Silver-standard (model-generated, not human-annotated)
- No corrective training: v1 was trained only on positive examples, without the corrective/hard-negative signal that improves v2
License
CC-BY-4.0. SEC filings are public domain; this model's value is in the fine-tuning for structured extraction.
Trained 2x faster with Unsloth
- Downloads last month
- 194
4-bit
