File size: 3,022 Bytes
3d111ce
5a3fae3
 
 
 
 
 
 
 
 
 
 
3d111ce
 
5a3fae3
3d111ce
5a3fae3
 
3d111ce
5a3fae3
3d111ce
5a3fae3
 
 
 
 
 
3d111ce
5a3fae3
 
3d111ce
5a3fae3
 
 
 
3d111ce
5a3fae3
 
3d111ce
5a3fae3
 
3d111ce
5a3fae3
 
 
 
3d111ce
5a3fae3
 
 
 
3d111ce
5a3fae3
 
 
3d111ce
5a3fae3
 
 
3d111ce
5a3fae3
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
---
tags:
- text-generation
- peft
- lora
- e-commerce
- tinyllama
widget:
- text: "Product Description: A sleek, stainless steel smart watch with heart rate tracking and a breathable silicone strap, perfect for outdoor runners.\nTags:"
  example_title: "Smart Watch"
- text: "Product Description: A heavy-duty, waterproof winter coat with a faux-fur lined hood and deep pockets for snowboarding.\nTags:"
  example_title: "Winter Coat"
---

# ๐Ÿค– Smart Catalog Bot: E-Commerce Tagging Assistant

## ๐Ÿ“Œ Overview
This is a fine-tuned LoRA adapter for `TinyLlama/TinyLlama-1.1B-Chat-v1.0`. It has been specifically instruction-tuned to act as an automated, highly structured parser for e-commerce product catalogs. 

Standard open-source Large Language Models often hallucinate conversational filler (e.g., *"Here are your tags..."*). This model was trained to abandon conversational outputs entirely and strictly generate API-ready metadata tags based on unstructured product descriptions.

## ๐Ÿ—๏ธ Model Details
- **Developer:** Ryan Francis
- **Model Type:** Causal Language Model (LoRA Fine-Tune)
- **Base Model:** TinyLlama 1.1B
- **Language:** English
- **Primary Use Case:** Automated e-commerce pipeline categorization

## โš™๏ธ Training Methodology
The model was fine-tuned on a synthetically generated dataset of 100 diverse, unstructured e-commerce product descriptions. It was trained to map these descriptions to a rigid output schema: `[Category: X] [Target: Y] [Material/Style: Z]`.

- **Training Regime:** fp16 mixed precision natively on a T4 GPU
- **Technique:** Parameter-Efficient Fine-Tuning (PEFT) via LoRA 
- **Target Modules:** `q_proj`, `v_proj`
- **Optimizer:** `adamw_torch`

## ๐Ÿ“Š Evaluation and Validation
The model was evaluated using a **Format Compliance Rate** metric. On unseen validation prompts, the fine-tuned adapter achieved strict structural adherence, successfully outputting the exact requested bracketed format with zero conversational hallucinations.

## ๐Ÿ’ป How to Use This Model
You can load this model and run inference using the `peft` and `transformers` libraries.

```python
import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer

# 1. Load the base model
base_model_id = "TinyLlama/TinyLlama-1.1B-Chat-v1.0"
tokenizer = AutoTokenizer.from_pretrained(base_model_id)
model = AutoModelForCausalLM.from_pretrained(base_model_id, device_map="auto", torch_dtype=torch.float16)

# 2. Load the fine-tuned adapter
repo_id = "ryanfrancis/smart-catalog-bot"
model = PeftModel.from_pretrained(model, repo_id)

# 3. Test the model
prompt = "Product Description: A low-profile velvet sofa in emerald green with tapered wooden legs, perfect for a mid-century modern living room.\nTags:"
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")

# Generate with low temperature for strict formatting
outputs = model.generate(**inputs, max_new_tokens=40, temperature=0.1)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))