--- license: mit base_model: unsloth/Phi-3-mini-4k-instruct tags: - unsloth - lora - phi-3 - customer-support - fine-tuned - qlora language: - en pipeline_tag: text-generation library_name: peft model_type: phi3 datasets: - custom --- # Phi-3-mini-4k-instruct — Customer Support Fine-tune A LoRA fine-tune of Microsoft's [Phi-3-mini-4k-instruct](https://huggingface.co/microsoft/Phi-3-mini-4k-instruct) (3.8B parameters), adapted for retail/e-commerce customer support conversations. Trained using [Unsloth](https://unsloth.ai) with 4-bit QLoRA for fast, memory-efficient fine-tuning on a single T4 GPU. ## Model Details - **Base model:** unsloth/Phi-3-mini-4k-instruct - **Fine-tuning method:** QLoRA (4-bit), rank 16, alpha 16 - **Framework:** Unsloth + TRL `SFTTrainer` - **Training hardware:** 1x NVIDIA T4 (Google Colab, free tier) - **Training data:** 467 cleaned, deduplicated customer support Q&A pairs (custom dataset) ## Training Data The training set covers common retail support scenarios across these categories: | Category | Examples | |---|---| | Orders | 136 | | Shipping | 103 | | Payment | 70 | | Returns | 59 | | Product Info | 34 | | Account | 33 | | Sizing | 14 | | Order Management | 11 | | Support | 5 | Each example is a single user question paired with a support-style answer (e.g. order tracking, return policy, payment troubleshooting). Data was cleaned to fix text-encoding artifacts and deduplicated before training. ## Intended Use This model is intended for **retail customer-support-style Q&A** within the categories above — e.g. answering questions about order status, return policy, shipping timelines, and payment issues in a tone consistent with the training data. It is **not** intended for: - General-purpose assistant use outside customer support - Safety-critical or compliance-sensitive support (e.g. legal, medical, financial advice) - Production deployment without human review of outputs ## Limitations - Trained on a small dataset (467 examples) — behavior on questions outside the categories above is closer to the unmodified base model. - Some categories (Sizing, Order Management, Support) have very few examples and may show limited improvement over the base model. - Like any fine-tuned language model, it can produce plausible-sounding but incorrect specifics (order numbers, policy details, dates) — outputs should be verified before being shown to real customers. - English only. ## How to Use ```python from unsloth import FastLanguageModel model, tokenizer = FastLanguageModel.from_pretrained("00harshh/phi3-mini-support-bot") FastLanguageModel.for_inference(model) messages = [{"role": "user", "content": "Where is my order?"}] inputs = tokenizer.apply_chat_template( messages, tokenize=True, add_generation_prompt=True, return_tensors="pt" ).to("cuda") outputs = model.generate(input_ids=inputs, max_new_tokens=150, temperature=0.7, top_p=0.9) print(tokenizer.decode(outputs[0][inputs.shape[1]:], skip_special_tokens=True)) ``` ## Training Procedure - **LoRA config:** r=16, alpha=16, dropout=0, target modules: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj - **Optimizer:** adamw_8bit - **Learning rate:** 2e-4, linear schedule - **Epochs:** 3 - **Effective batch size:** 16 (batch size 4 × gradient accumulation 4)