Downloads · 30 days
24
22% of all-time downloads
gabrielgts/granite4-3b-ec-magento
granite4-3b-ec-magento is a text generation model from gabrielgts. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
A QLoRA adapter for ibm-granite/granite-4.1-3b specialized in e-commerce catalog tasks with Magento 2 conventions: attribute extraction to JSON, product Q&A, search-relevance classification, and product ranking.
Downloads · 30 days
24
22% of all-time downloads
All-time downloads
108
Public
Repo size
2.2 GB
Likes
0
Public
Click a slice to open those files.
.gguf2.2 GB · 97%
From the Hugging Face model README
A QLoRA adapter for ibm-granite/granite-4.1-3b specialized in e-commerce catalog tasks with Magento 2 conventions: attribute extraction to JSON, product Q&A, search-relevance classification, and product ranking.
Fifth model in a controlled comparison — five base models, identical frozen training data, identical recipe, one eval harness — alongside qwen3.5-4b-ec-magento, ministral3-3b-ec-magento, phi4-3b-ec-magento and gemma4-e2b-ec-magento. It is the strongest of the five on both held-out sets.
| Path | What | Size | For |
|---|---|---|---|
/ (root) | LoRA adapter (PEFT) | 67MB | transformers/peft/unsloth on top of the base model |
gguf/ | Merged + quantized Q4_K_M (q8_0 embeddings) + Ollama Modelfile | 2.1GB | llama.cpp / Ollama, CPU+GPU serving |
Trained on 56,253 instruction samples: 70% ECInstruct (generic e-commerce) + 30% synthetic Magento-schema data generated from the Magento Luma sample catalog (products fully disjoint between train and eval). Four task shapes:
Attribute extraction — product text (or a raw Magento custom_attributes payload) → JSON:
target attribute: size
product title: Puma Suede green sneakers size 43
→ [{"attribute": "size", "value": "43"}]
Absent attributes are reported as "None" rather than hallucinated.
Product QA — a question answered strictly from given product data.
Relevance classification — query + product → graded relevance option (ESCI-style A–D).
Relevance ranking — query + lettered product list → ranked letters (B,A,C).
from unsloth import FastLanguageModel
model, tokenizer = FastLanguageModel.from_pretrained(
"gabrielgts/granite4-3b-ec-magento", max_seq_length=2048, load_in_4bit=True)
FastLanguageModel.for_inference(model)
# No system message — the model was trained without one, and Granite's template
# injects nothing when no tools/documents are passed. Greedy decoding recommended.
messages = [{"role": "user", "content":
"Extract the value of the target attribute from the given product information "
"and output it as JSON. If the attribute is not present, output None as the value.\n\n"
"target attribute: size\nproduct title: Puma Suede green sneakers size 43"}]
text = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
inputs = tokenizer(text=text, return_tensors="pt").to("cuda")
out = model.generate(**inputs, max_new_tokens=64, do_sample=False)
print(tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
# [{"attribute": "size", "value": "43"}]
Plain peft also works: PeftModel.from_pretrained(base_model, "gabrielgts/granite4-3b-ec-magento").
hf download gabrielgts/granite4-3b-ec-magento --include 'gguf/*' --local-dir .
cd gguf && ollama create granite4-3b-ec-magento -f Modelfile
ollama run granite4-3b-ec-magento "target attribute: color ..."
Quantization note: the shipped GGUF uses --token-embedding-type q8_0 --output-tensor-type q8_0. Granite ties its embeddings over a 100,352-token vocabulary, and tied large-vocab embeddings degrade at plain 4-bit — producing correctly-formatted but wrong answers. If you requantize, keep the embeddings at q8_0 and verify answer content, not just JSON validity.
| Parameter | Value |
|---|---|
| Method | QLoRA (4-bit NF4 base, bf16 compute) via Unsloth |
| LoRA | r=8, alpha=16, targets q/k/v/o/gate/up/down_proj |
| Trainable params | 15.6M of 3,403M (0.46%) |
| Batch | 1 × grad_accum 16 (effective 16), max_seq_length 2048 |
| Optimizer / LR | paged_adamw_8bit, 2e-4 cosine, 1 epoch, seed 42 |
| Data | 56,253 samples: 39,377 ECInstruct + 16,876 Magento-synthetic |
| System prompt | none at train and eval |
Greedy decoding, identical prompts across all five models; base models evaluated zero-shot with the same harness. All five were trained on the same frozen dataset (sha256 afb7e664…), so the base model is the only variable.
Magento held-out set (2,969 samples, 475 products never seen in training). Bold = best of the five.
| Task · metric | Base | this model | ministral3-3b | phi4-mini | qwen3.5-4b | gemma4-e2b |
|---|---|---|---|---|---|---|
| Attribute extraction · F1 | 0.106 | 0.953 | 0.945 | 0.946 | 0.938 | 0.933 |
| Attribute extraction · parse failures | 21.5% | 0.1% | 0.1% | 0.3% | 0.0% | 0.0% |
| Product QA · token-F1 | 0.040 | 0.954 | 0.954 | 0.950 | 0.943 | 0.953 |
| Relevance classification · accuracy | 0.599 | 0.962 | 0.972 | 0.959 | 0.962 | 0.961 |
| Relevance rank · top-1 | 0.625 | 0.773 | 0.793 | 0.783 | 0.799 | 0.776 |
ECInstruct held-out set (2,000 samples):
| Task · metric | Base | this model | ministral3-3b | phi4-mini | qwen3.5-4b | gemma4-e2b |
|---|---|---|---|---|---|---|
| Answerability · accuracy | 0.448 | 0.838 | 0.735 | 0.733 | 0.780 | 0.728 |
| Attribute extraction · F1 | 0.000 | 0.659 | 0.654 | 0.616 | 0.646 | 0.641 |
| Query→product rank · top-1 | 0.142 | 0.655 | 0.632 | 0.645 | 0.650 | 0.647 |
| Relevance classification · accuracy | 0.427 | 0.670 | 0.655 | 0.650 | 0.685 | 0.662 |
| Answer generation · token-F1 | 0.153 | 0.132 | 0.135 | 0.144 | 0.147 | 0.128 |
Long-list ranking (500 held-out ESCI queries, 5–8 candidates with graded hard negatives; chance top-1 = 0.167). This set is much harder than the ranking task above, which is 62% two-candidate:
| top-1 | exact-match | |
|---|---|---|
| Base (zero-shot) | 0.070 | 0.000 |
| this model | 0.516 | 0.008 |
Read that 0.516 against its own baseline, not against the 0.655 above: the easy set is mostly binary A/B choices, so a high score there flatters the model. Ranking is this model's relative weak spot.
do_sample=False / temperature 0) — that is how it was evaluated.| Training run | granite4-3b-r8-mix56k-e1 |
| Adapter sha256 | 770f30f9c6abc2e06ce1f19f7ebac6fa5d9cb1e0160be35f76e11a3165f04d5b |
| Train set sha256 | afb7e664cda4490597c1914db6aff94933991a56d2175435666f8f6b7a726532 (mixture_train.jsonl, 56,253 rows) |
| Eval set sha256 | 8feafdb2… (magento_eval.jsonl) · 2583a61e… (ecinstruct_eval.jsonl) |
| GGUF | adapter merged into ibm-granite/granite-4.1-3b bf16, Q4_K_M + q8_0 embeddings, sha256 d733ffd7… |
| Stack | torch 2.6.0+cu124 · transformers 5.5.0 · unsloth 2026.6.9 |