Downloads · 30 days
11
12% of all-time downloads
Lakshan2003/Phi-4-mini-instruct-customerservice-context-summary
Phi-4-mini-instruct-customerservice-context-summary is a summarization model from Lakshan2003. Use it when you need a shorter version of a longer 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-instruct trained to generate context summaries from multi-turn customer-service conversations in the banking domain.
Downloads · 30 days
11
12% of all-time downloads
All-time downloads
94
Public
Repo size
33.4 MB
Likes
0
Public
Click a slice to open those files.
.json19.5 MB · 49%
From the Hugging Face model README
This model is a QLoRA fine-tuned version of microsoft/Phi-4-mini-instruct trained to generate context summaries from multi-turn customer-service conversations in the banking domain.
This is a QLoRA (Quantized Low-Rank Adaptation) fine-tuned version of microsoft/Phi-4-mini-instruct optimized for context summarization of multi-turn customer-service conversations. Given a multi-turn banking conversation, the model produces a single coherent, factual paragraph capturing all key information needed for an agent to accurately answer the client's next question.
Base Model: microsoft/Phi-4-mini-instruct
Parameters: ~3.8 billion
Fine-tuning Method: QLoRA (4-bit quantization + LoRA)
Domain: Customer Service (Banking)
Task: Multi-Turn Conversation Context Summarization
Dataset: Synthetic multi-turn customer-service context summarization dataset
Source: Derived from an original multi-turn customer-service conversation dataset; 50,000 unique conversations randomly selected
Public Dataset: Lakshan2003/customer-support-context-summary-50k
| Split | Instances |
|---|---|
| Train | 35,000 (70%) |
| Validation | 5,000 (10%) |
| Test | 10,000 (20%) |
ft_prompt = """<|system|>
{instruction}<|end|>
<|user|>
Conversation History:
{history}<|end|>
<|assistant|>
"""
EOS_TOKEN = tokenizer.eos_token
System Instruction:
You are a professional conversation summarization assistant.
Goal:
Produce a clear, concise and factual summary of the conversation so far so that
YOU, the same customer service agent handling this client, can accurately answer
their next question.
Include only information explicitly stated:
- Client's issue or request and current status (explicitly mention client and
agent names if present in the conversation)
- Verification steps completed or pending
- Exact names, account numbers or identifiers, dates, amounts and actions taken
or agreed
- Commitments, deadlines and follow-up actions
- Current state of the conversation
Exclude:
Greetings, filler dialogue, speculation, assumptions, or invented details.
Style:
Neutral and professional. Vary sentence structure and phrasing to avoid repetition.
Output:
One coherent, detailed paragraph summarizing the conversation context.
Inference Parameters:
generation_config = {
"max_new_tokens": 256,
"temperature": 0.7,
"do_sample": True,
"top_p": 0.8,
"top_k": 20,
"min_p": 0.0,
}
pip install unsloth transformers peft torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
base_model = AutoModelForCausalLM.from_pretrained(
"microsoft/Phi-4-mini-instruct",
device_map="auto",
torch_dtype=torch.float16,
)
tokenizer = AutoTokenizer.from_pretrained("microsoft/Phi-4-mini-instruct")
model = PeftModel.from_pretrained(base_model, "Lakshan2003/Phi-4-mini-instruct-customerservice-context-summary")
# Merge adapter (optional, for deployment)
model = model.merge_and_unload()
model.eval()
instruction = """You are a professional conversation summarization assistant.
Goal:
Produce a clear, concise and factual summary of the conversation so far so that
YOU, the same customer service agent handling this client, can accurately answer
their next question.
Include only information explicitly stated:
- Client's issue or request and current status (explicitly mention client and
agent names if present in the conversation)
- Verification steps completed or pending
- Exact names, account numbers or identifiers, dates, amounts and actions taken
or agreed
- Commitments, deadlines and follow-up actions
- Current state of the conversation
Exclude:
Greetings, filler dialogue, speculation, assumptions, or invented details.
Style:
Neutral and professional. Vary sentence structure and phrasing to avoid repetition.
Output:
One coherent, detailed paragraph summarizing the conversation context."""
history = """Agent: Thank you for calling Optimal Financial Partners, my name is Almira. How can I help you today?
Client: Hi, I'm Kathrine. I noticed some unexpected charges on my account statement and I'm not sure what they are.
Agent: I'm sorry to hear that, Kathrine. As a valued customer, you have the right to dispute any unauthorized or incorrect charges on your account. I'd be happy to investigate any charges you believe are incorrect.
Client: That's great to know. What if I'm not satisfied with the outcome of the investigation?"""
input_text = ft_prompt.format(instruction=instruction, history=history)
inputs = tokenizer(input_text, return_tensors="pt", truncation=True, max_length=1024).to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=256,
temperature=0.7,
do_sample=True,
top_p=0.8,
top_k=20,
min_p=0.0,
pad_token_id=tokenizer.eos_token_id,
eos_token_id=tokenizer.eos_token_id,
)
input_length = inputs.input_ids.shape[1]
summary = tokenizer.decode(outputs[0][input_length:], skip_special_tokens=True).strip()
print(summary)
Example Output:
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.
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 microsoft/Phi-4-mini-instruct model. Please refer to the respective license agreement.