Downloads · 30 days
8
26% of all-time downloads
paulregala/Phi-4-mini-instruct-customerservice
Phi-4-mini-instruct-customerservice is a text generation model from paulregala. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as mit.
This model is a QLoRA fine-tuned version of microsoft/Phi-4-Mini on a context-summarized multi-turn customer-service QA dataset for banking domain conversations.
Downloads · 30 days
8
26% of all-time downloads
All-time downloads
31
Public
Repo size
51.2 MB
Likes
0
Public
Click a slice to open those files.
.safetensors35.7 MB · 62%
From the Hugging Face model README
This model is a QLoRA fine-tuned version of microsoft/Phi-4-Mini on a context-summarized multi-turn customer-service QA dataset for banking domain conversations.
This is a QLoRA (Quantized Low-Rank Adaptation) fine-tuned version of Phi-4-Mini (3.8B parameters) optimized for multi-turn customer-service question answering with context summarization. The model was trained on synthetic banking customer-service conversations with history summarization to preserve essential conversational context while maintaining dialogue continuity.
Base Model: microsoft/Phi-4-Mini
Parameters: ~3.8 billion
Fine-tuning Method: QLoRA (4-bit quantization + LoRA)
Domain: Customer Service (Banking)
Task: Context-Summarized Multi-Turn Question Answering
Dataset: Synthetic context-summarized multi-turn customer-service QA dataset
Source: Derived from TalkMap Banking Conversation Corpus
Size: 128,335 training instances, 18,333 validation instances
Conversation Turns: 2-53 turns per conversation (avg: 10.06)
Context Strategy: History summarization using GPT-4o-mini
Response Refinement: GPT-4.1-based response quality enhancement
generation_config = {
"max_new_tokens": 128,
"temperature": 0.7,
"do_sample": True,
"top_p": 0.9,
"top_k": 50,
}
pip install unsloth transformers peft torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# Load base model
base_model = AutoModelForCausalLM.from_pretrained(
"microsoft/Phi-4-Mini",
device_map="auto",
torch_dtype=torch.float16,
trust_remote_code=True,
)
# Load tokenizer
tokenizer = AutoTokenizer.from_pretrained("microsoft/Phi-4-Mini", trust_remote_code=True)
# Load LoRA adapter
model = PeftModel.from_pretrained(base_model, "Lakshan2003/Phi-4-mini-instruct-customerservice")
# Merge adapter (optional, for deployment)
model = model.merge_and_unload()
model.eval()
# Prompt template (adjust for Phi format)
prompt_template = """<|system|>
{instruction}<|end|>
<|user|>
Conversation History:
{history}
Client Question:
{client_question}<|end|>
<|assistant|>
"""
# Example conversation
instruction = "You are a professional call-center customer service agent working at Optimal Financial Partners. Review the conversation history and any provided context (if available). Make sure your response is consistent with the conversation history (names, issues, and actions already taken). If no history is given, treat the client’s message as the start of the conversation. Continue the dialogue as the agent by giving a clear, helpful, and professional response. Responses should sound natural and human-like, like a real phone call, and usually be few short sentences. Provide more detail when the client’s request clearly requires it."
history = "Kathrine has contacted Almira from Optimal Financial Partners regarding unexpected charges on her statement and her rights as a consumer. Almira confirmed that as a customer, Kathrine has the right to dispute any unauthorized or incorrect charges. Almira offered to investigate any charges Kathrine believes are incorrect. No specific charges, amounts, or account identifiers have been mentioned, and no verification steps have been completed or are pending at this time. The conversation is currently focused on explaining consumer rights and the process for disputing charges."
client_question = "That's great to know. What if I'm not satisfied with the outcome of the investigation?"
# Format input
input_text = prompt_template.format(
instruction=instruction,
history=history,
client_question=client_question
)
# Tokenize
inputs = tokenizer(input_text, return_tensors="pt", truncation=True, max_length=512).to(model.device)
# Generate
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=128,
temperature=0.7,
do_sample=True,
top_p=0.9,
top_k=50,
pad_token_id=tokenizer.eos_token_id,
eos_token_id=tokenizer.eos_token_id,
)
# Decode response
input_length = inputs.input_ids.shape[1]
response = tokenizer.decode(outputs[0][input_length:], skip_special_tokens=True).strip()
print(response)
If you use this model, please cite:
@article{cooray2026small,
title={Can Small Language Models Handle Context-Summarized Multi-Turn Customer-Service QA? A Synthetic Data-Driven Comparative Evaluation},
author={Cooray, Lakshan and Sumanathilaka, Deshan and Raju, Pattigadapa Venkatesh},
journal={arXiv preprint arXiv:2602.00665},
year={2026}
}
Author: Lakshan Cooray
Institution: Informatics Institute of Technology, Colombo, Sri Lanka
Email: [email protected]
This model inherits the license from the base Phi-4-Mini model. Please refer to Microsoft's license agreement.