Views
No views yet
1from transformers import AutoModelForCausalLM, AutoTokenizer
2from peft import PeftModel
3
4base_model = "meta-llama/Llama-3.1-8B-Instruct"
5adapter = "aghassel/dialogue_disruption_monitor"
6
7tokenizer = AutoTokenizer.from_pretrained(base_model)
8model = AutoModelForCausalLM.from_pretrained(base_model, device_map="auto")
9model = PeftModel.from_pretrained(model, adapter)1from dee import DialogueMonitor
2
3monitor = DialogueMonitor()
4
5dialogue_history = [
6 {"role": "assistant", "content": "It's nice to go shopping alone."},
7 {"role": "user", "content": "I agree. That's nice."},
8 {"role": "assistant", "content": "Shopping takes time."},
9 {"role": "user", "content": "Window shopping is also fun."},
10]
11
12response = "It's fun to go shopping with somebody."
13
14result = monitor.detect(dialogue_history, response)
15# Returns: {
16# "breakdown": True,
17# "confidence": 0.87,
18# "justification": "The response contradicts the earlier statement..."
19# }1from dee import DEEPipeline
2
3pipeline = DEEPipeline(
4 monitor_model="aghassel/dialogue_disruption_monitor",
5 superior_model="claude-3-5-sonnet", # or "gpt-4o", "llama-3.1-405b"
6 escalation_threshold=0.5
7)
8
9# Automatically monitors and escalates when needed
10safe_response = pipeline.generate(dialogue_history, user_input)1from dee import PromptStrategies
2
3# Zero-shot
4result = detector.detect(dialogue, strategy="zero-shot")
5
6# Few-shot with hard examples
7result = detector.detect(dialogue, strategy="few-shot", difficulty="hard", n_shots=2)
8
9# Chain-of-thought
10result = detector.detect(dialogue, strategy="cot")
11
12# Analogical reasoning
13result = detector.detect(dialogue, strategy="analogical")
14
15# Curriculum learning + Analogical reasoning
16result = detector.detect(dialogue, strategy="cl+ar")| Dataset | Language | Type | Annotation Level |
|---|---|---|---|
| DBDC5 | English | Open-domain | Utterance |
| DBDC5 | Japanese | Open-domain | Utterance |
| BETOLD | English | Task-oriented | Conversation |
| Model | English Acc. | English F1_B | Japanese Acc. | Japanese F1_B |
|---|---|---|---|---|
| Previous SOTA (S2T2) | 77.9 | 82.4 | 76.7 | 75.4 |
| Claude-3.5 Sonnet (AR) | 85.5 | 89.8 | 88.0 | 91.7 |
| Claude-3.5 Sonnet (CL+AR) | 83.5 | 88.5 | 89.0 | 92.4 |
| Llama-3.3 70B (CL+AR) | 85.5 | 89.5 | 77.0 | 83.1 |
| Ours (8B Monitor) | 81.5 | 86.2 | 67.9 | 68.8 |
1python train.py \
2 --base_model meta-llama/Llama-3.1-8B-Instruct \
3 --dataset dbdc5 \
4 --output_dir ./checkpoints \
5 --lora_rank 16 \
6 --learning_rate 2e-4 \
7 --num_epochs 3 \
8 --batch_size 81python generate_traces.py \
2 --teacher_model meta-llama/Llama-3.3-70B-Instruct \
3 --dataset dbdc5 \
4 --output_path ./data/reasoning_traces.json1@article{ghassel2025dee,
2 title={Detect, Explain, Escalate: Sustainable Dialogue Breakdown Management for LLM Agents},
3 author={Ghassel, Abdellah and Li, Xianzhi and Zhu, Xiaodan},
4 journal={IEEE/ACM Transactions on Audio, Speech, and Language Processing},
5 year={2025},
6 publisher={IEEE}
7}