Views
No views yet
| Split | Instances |
|---|---|
| Train | 35,000 (70%) |
| Validation | 5,000 (10%) |
| Test | 10,000 (20%) |
1ft_prompt = """<|begin_of_text|><|start_header_id|>system<|end_header_id|>
2{instruction}<|eot_id|>
3<|start_header_id|>user<|end_header_id|>
4Conversation History:
5{history}
6<|eot_id|>
7<|start_header_id|>assistant<|end_header_id|>"""
8
9EOS_TOKEN = tokenizer.eos_tokenYou 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.1generation_config = {
2 "max_new_tokens": 256,
3 "do_sample": True,
4 "temperature": 0.7,
5 "top_p": 0.9,
6 "top_k": 50,
7}pip install unsloth transformers peft torch1from peft import PeftModel
2from transformers import AutoModelForCausalLM, AutoTokenizer
3import torch
4
5base_model = AutoModelForCausalLM.from_pretrained(
6 "meta-llama/Llama-3.2-3B-Instruct",
7 device_map="auto",
8 torch_dtype=torch.float16,
9)
10tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-3.2-3B-Instruct")
11model = PeftModel.from_pretrained(base_model, "Lakshan2003/Llama3.2-3B-instruct-customerservice-context-summary")
12
13# Merge adapter (optional, for deployment)
14model = model.merge_and_unload()
15model.eval()1instruction = """You are a professional conversation summarization assistant.
2Goal:
3Produce a clear, concise and factual summary of the conversation so far so that
4YOU, the same customer service agent handling this client, can accurately answer
5their next question.
6Include only information explicitly stated:
7- Client's issue or request and current status (explicitly mention client and
8 agent names if present in the conversation)
9- Verification steps completed or pending
10- Exact names, account numbers or identifiers, dates, amounts and actions taken
11 or agreed
12- Commitments, deadlines and follow-up actions
13- Current state of the conversation
14Exclude:
15Greetings, filler dialogue, speculation, assumptions, or invented details.
16Style:
17Neutral and professional. Vary sentence structure and phrasing to avoid repetition.
18Output:
19One coherent, detailed paragraph summarizing the conversation context."""
20
21history = """Agent: Thank you for calling Optimal Financial Partners, my name is Almira. How can I help you today?
22Client: Hi, I'm Kathrine. I noticed some unexpected charges on my account statement and I'm not sure what they are.
23Agent: 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.
24Client: That's great to know. What if I'm not satisfied with the outcome of the investigation?"""
25
26input_text = ft_prompt.format(instruction=instruction, history=history)
27inputs = tokenizer(input_text, return_tensors="pt", truncation=True, max_length=1024).to(model.device)
28
29with torch.no_grad():
30 outputs = model.generate(
31 **inputs,
32 max_new_tokens=256,
33 temperature=0.7,
34 do_sample=True,
35 top_p=0.8,
36 top_k=20,
37 pad_token_id=tokenizer.eos_token_id,
38 eos_token_id=tokenizer.eos_token_id,
39 )
40
41input_length = inputs.input_ids.shape[1]
42summary = tokenizer.decode(outputs[0][input_length:], skip_special_tokens=True).strip()
43print(summary)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.1@article{cooray2026small,
2 title={Can Small Language Models Handle Context-Summarized Multi-Turn Customer-Service QA? A Synthetic Data-Driven Comparative Evaluation},
3 author={Cooray, Lakshan and Sumanathilaka, Deshan and Raju, Pattigadapa Venkatesh},
4 journal={arXiv preprint arXiv:2602.00665},
5 year={2026}
6}