Downloads · 30 days
110
32% of all-time downloads
ravinarayanan/Gemma4-E2b-SOQL-QLORA
Gemma4-E2b-SOQL-QLORA is a text generation model from ravinarayanan. Use it when you need the model to write or continue text. The card lists the license as gemma.
Fine-tuned from google/gemma-4-2b-it to translate natural-language questions into SOQL (Salesforce Object Query Language) queries.
Downloads · 30 days
110
32% of all-time downloads
All-time downloads
347
Public
Repo size
7 GB
Likes
0
Public
Click a slice to open those files.
.gguf3.4 GB · 96%
From the Hugging Face model README
Fine-tuned from google/gemma-4-2b-it to translate natural-language questions into SOQL (Salesforce Object Query Language) queries.
Note: The model is trained and prompted to return bare SOQL, but like all small LLMs it may occasionally include reasoning traces (
<think>...</think>blocks), brief explanations, or off-script text. Always validate the output and strip non-SOQL content before execution. The reference orchestrator (orchestrator/app.py) handles this automatically.
| Property | Value |
|---|---|
| Base model | unsloth/gemma-4-E2B-it (4-bit, Unsloth day-0 quant) |
| Fine-tune method | QLoRA — LoRA r=16, alpha=16 |
| LoRA target modules | q/k/v/o_proj + gate/up/down_proj |
| Training hardware | A100 GPU |
| Training steps | 250 (early stop; val loss 0.119) |
| Dataset | 11,040 synthetic NL→SOQL pairs, 17 SOQL pattern types |
| Quantization | Q4_K_M GGUF (~1.5 GB) |
| Context window | 2048 tokens |
Given a Salesforce object schema + a natural-language question, the model returns
a SOQL SELECT query. It was trained on fictional object/field names
(Vehicle__c, Driver__c, etc.) to learn SOQL syntax — not any specific org's schema.
Inject your real org's schema in the user message at inference time.
Simple SELECT · WHERE filters · ORDER BY · LIMIT · COUNT/aggregate · GROUP BY · HAVING · date literals · multi-field · relationship queries · subquery IN filters · parent field traversal · child subqueries · LIKE · NULL checks · boolean logic · semi-joins
# Pull directly from this repo
ollama pull hf.co/ravinarayanan/gemma-2b-soql-qlora
# Or create from the bundled Modelfile
ollama create soql-gemma4 -f Modelfile
ollama run soql-gemma4
Object: Vehicle__c
Fields: Name, Make__c, Model__c, Year__c, Price__c, FuelType__c, IsAvailable__c
Relationships: Dealership__c (lookup), ServiceRecords__r (child)
Write a SOQL query to find electric vehicles priced under 25000 that are available
The model typically returns bare SOQL, but may prefix it with a <think> block.
Strip everything before and including </think> if present:
SELECT Name, Make__c, Model__c, Price__c
FROM Vehicle__c
WHERE FuelType__c = 'Electric'
AND Price__c < 25000
AND IsAvailable__c = true
import re
def extract_soql(raw: str) -> str:
# Strip <think>...</think> block if present
raw = re.sub(r"<think>.*?</think>", "", raw, flags=re.DOTALL).strip()
# Take only the first SELECT statement
match = re.search(r"(SELECT\b.*)", raw, re.IGNORECASE | re.DOTALL)
return match.group(1).strip() if match else raw.strip()
You are a SOQL query generator. Given a Salesforce schema and a question,
output ONLY the bare SOQL query. No explanation, no markdown, no extra text,
no reasoning.
11,040 synthetic training examples generated from a fictional Salesforce schema
(4 objects: Vehicle__c, Driver__c, Dealership__c, ServiceRecord__c) covering
17 SOQL pattern types. Dataset was generated with a capability-aware template
generator to ensure pattern diversity and avoid duplicates.
This model is derived from Gemma 4 and is subject to the Gemma Terms of Use.