Text Generation
Transformers
Safetensors
English
t5
text2text-generation
dialogue
gricean-maxims
cooperative-communication
text-repair
seq2seq
nlp
Eval Results (legacy)
text-generation-inference
Instructions to use Pushkar27/GriceBench-Repair with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Pushkar27/GriceBench-Repair with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Pushkar27/GriceBench-Repair")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("Pushkar27/GriceBench-Repair") model = AutoModelForSeq2SeqLM.from_pretrained("Pushkar27/GriceBench-Repair") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Pushkar27/GriceBench-Repair with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Pushkar27/GriceBench-Repair" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Pushkar27/GriceBench-Repair", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Pushkar27/GriceBench-Repair
- SGLang
How to use Pushkar27/GriceBench-Repair with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Pushkar27/GriceBench-Repair" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Pushkar27/GriceBench-Repair", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Pushkar27/GriceBench-Repair" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Pushkar27/GriceBench-Repair", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Pushkar27/GriceBench-Repair with Docker Model Runner:
docker model run hf.co/Pushkar27/GriceBench-Repair
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,30 +1,242 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
- **Architecture**: T5-base (seq2seq)
|
| 5 |
-
- **Parameters**: 220M
|
| 6 |
-
- **Task**: Conditional rewriting of violating dialogue responses to achieve Gricean compliance.
|
| 7 |
-
- **Release Date**: March 2026 (v2.0 with Degeneracy Prevention)
|
| 8 |
|
| 9 |
-
#
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
3.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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7 |
+
- text2text-generation
|
| 8 |
+
- dialogue
|
| 9 |
+
- gricean-maxims
|
| 10 |
+
- cooperative-communication
|
| 11 |
+
- t5
|
| 12 |
+
- text-repair
|
| 13 |
+
- nlp
|
| 14 |
+
- seq2seq
|
| 15 |
+
datasets:
|
| 16 |
+
- topical_chat
|
| 17 |
+
metrics:
|
| 18 |
+
- bleu
|
| 19 |
+
pipeline_tag: text2text-generation
|
| 20 |
+
base_model: google-t5/t5-base
|
| 21 |
+
---
|
| 22 |
|
| 23 |
+
<div align="center">
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
+
# π§ GriceBench-Repair
|
| 26 |
+
|
| 27 |
+
**Rewrites cooperative communication failures into compliant dialogue β surgically, not generally.**
|
| 28 |
+
|
| 29 |
+
[](https://opensource.org/licenses/Apache-2.0)
|
| 30 |
+
[](https://www.python.org/downloads/)
|
| 31 |
+
|
| 32 |
+
Part of the **GriceBench** system β [GitHub](https://github.com/PushkarPrabhath27/Research-Model) |
|
| 33 |
+
[π Detector](https://huggingface.co/Pushkar27/GriceBench-Detector) |
|
| 34 |
+
[β‘ DPO Generator](https://huggingface.co/Pushkar27/GriceBench-DPO)
|
| 35 |
+
|
| 36 |
+
</div>
|
| 37 |
+
|
| 38 |
+
---
|
| 39 |
+
|
| 40 |
+
## What This Model Does
|
| 41 |
+
|
| 42 |
+
GriceBench-Repair is a seq2seq model that takes a dialogue response flagged
|
| 43 |
+
for Gricean maxim violations and rewrites it to be cooperative. Unlike generic
|
| 44 |
+
paraphrasing or self-refinement, it is **violation-type-aware**: it uses
|
| 45 |
+
different generation strategies depending on which maxim was violated.
|
| 46 |
+
|
| 47 |
+
| Violation | Strategy | Why |
|
| 48 |
+
|-----------|----------|-----|
|
| 49 |
+
+| **Quantity** | Beam search (n=4) + length constraints | Needs precise length control |
|
| 50 |
+
+| **Quality** | Beam search (n=4) + repetition penalty | Needs factual precision |
|
| 51 |
+
+| **Manner** | Nucleus sampling (T=0.85, p=0.92) | Needs diverse creative rewrites |
|
| 52 |
+
+| **Relation** | β Not handled here | Relation requires full regeneration β route to FAISS retrieval |
|
| 53 |
+
|
| 54 |
+
---
|
| 55 |
+
|
| 56 |
+
## Quick Start
|
| 57 |
+
|
| 58 |
+
```python
|
| 59 |
+
from transformers import T5ForConditionalGeneration, T5Tokenizer
|
| 60 |
+
import torch
|
| 61 |
+
|
| 62 |
+
# Load model
|
| 63 |
+
model_name = "Pushkar27/GriceBench-Repair"
|
| 64 |
+
tokenizer = T5Tokenizer.from_pretrained(model_name)
|
| 65 |
+
model = T5ForConditionalGeneration.from_pretrained(model_name)
|
| 66 |
+
model.eval()
|
| 67 |
+
|
| 68 |
+
def repair_violation(
|
| 69 |
+
context: str,
|
| 70 |
+
response: str,
|
| 71 |
+
violation_type: str, # "quantity", "quality", or "manner"
|
| 72 |
+
) -> str:
|
| 73 |
+
"""
|
| 74 |
+
Repair a Gricean maxim violation.
|
| 75 |
+
|
| 76 |
+
Args:
|
| 77 |
+
context: Conversation history
|
| 78 |
+
response: The violating response to fix
|
| 79 |
+
violation_type: Which maxim was violated
|
| 80 |
+
|
| 81 |
+
Returns:
|
| 82 |
+
Rewritten cooperative response
|
| 83 |
+
|
| 84 |
+
Note: Relation violations should use FAISS retrieval, not this model.
|
| 85 |
+
"""
|
| 86 |
+
assert violation_type in ["quantity", "quality", "manner"], \
|
| 87 |
+
"Relation violations must use the FAISS retrieval system."
|
| 88 |
+
|
| 89 |
+
input_text = f"fix {violation_type}: [CONTEXT] {context} [RESPONSE] {response}"
|
| 90 |
+
inputs = tokenizer(
|
| 91 |
+
input_text, return_tensors="pt",
|
| 92 |
+
max_length=256, truncation=True
|
| 93 |
+
)
|
| 94 |
+
|
| 95 |
+
with torch.no_grad():
|
| 96 |
+
if violation_type == "manner":
|
| 97 |
+
# Nucleus sampling for diverse rewrites
|
| 98 |
+
output_ids = model.generate(
|
| 99 |
+
**inputs,
|
| 100 |
+
do_sample=True,
|
| 101 |
+
temperature=0.85,
|
| 102 |
+
top_p=0.92,
|
| 103 |
+
max_length=128,
|
| 104 |
+
min_length=8,
|
| 105 |
+
repetition_penalty=1.5,
|
| 106 |
+
no_repeat_ngram_size=3,
|
| 107 |
+
)
|
| 108 |
+
else:
|
| 109 |
+
# Beam search for precision
|
| 110 |
+
output_ids = model.generate(
|
| 111 |
+
**inputs,
|
| 112 |
+
num_beams=4,
|
| 113 |
+
max_length=128,
|
| 114 |
+
min_length=8,
|
| 115 |
+
repetition_penalty=1.5,
|
| 116 |
+
no_repeat_ngram_size=3,
|
| 117 |
+
)
|
| 118 |
+
|
| 119 |
+
return tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
| 120 |
+
|
| 121 |
+
|
| 122 |
+
# ββ Examples ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 123 |
+
|
| 124 |
+
# Example 1: Quantity violation (too short)
|
| 125 |
+
repaired = repair_violation(
|
| 126 |
+
context="What do you think about the development of commercial space travel?",
|
| 127 |
+
response="It's fine.", # Under-informative
|
| 128 |
+
violation_type="quantity"
|
| 129 |
+
)
|
| 130 |
+
print(f"Repaired: {repaired}")
|
| 131 |
+
# Repaired: "Commercial space travel has advanced remarkably, with companies like SpaceX
|
| 132 |
+
# making orbital flight more accessible, though high costs remain a barrier."
|
| 133 |
+
|
| 134 |
+
# Example 2: Manner violation (ambiguous pronouns)
|
| 135 |
+
repaired = repair_violation(
|
| 136 |
+
context="Alice told Bob that she would handle the project.",
|
| 137 |
+
response="She said she would do it before she left.", # Ambiguous pronouns
|
| 138 |
+
violation_type="manner"
|
| 139 |
+
)
|
| 140 |
+
print(f"Repaired: {repaired}")
|
| 141 |
+
# Repaired: "Alice confirmed she would complete the project before leaving the office."
|
| 142 |
+
```
|
| 143 |
+
|
| 144 |
+
---
|
| 145 |
|
| 146 |
## Performance
|
| 147 |
+
|
| 148 |
+
**Violation removal rate: 93.0%** (corrected, post-fix evaluation on 200 samples)
|
| 149 |
+
|
| 150 |
+
Per-maxim BLEU scores on the repair validation set:
|
| 151 |
+
|
| 152 |
+
| Violation Type | BLEU Score | Notes |
|
| 153 |
+
|----------------|-----------|-------|
|
| 154 |
+
+| Quality | **97.8%** | Near-perfect factual correction |
|
| 155 |
+
+| Manner | **92.5%** | Excellent clarity improvements |
|
| 156 |
+
+| Quantity | **61.8%** | Requires insertion/deletion β harder task |
|
| 157 |
+
+| Relation | 9.3% | β οΈ Intentionally routed to FAISS retrieval instead |
|
| 158 |
+
|
| 159 |
+
**Degeneracy fix results** (before/after applying violation-type-aware decoding):
|
| 160 |
+
|
| 161 |
+
| Maxim | Before Fix | After Fix | Improvement |
|
| 162 |
+
|-------|-----------|-----------|-------------|
|
| 163 |
+
+| Quantity | 30.1% degenerate | 2.1% degenerate | **+28.0pp** |
|
| 164 |
+
+| Manner | 93.3% degenerate | 4.5% degenerate | **+88.8pp** |
|
| 165 |
+
+| Overall | 64.4% degenerate | 5.2% degenerate | **+59.2pp** |
|
| 166 |
+
|
| 167 |
+
**Key lesson:** Using beam search for Manner repairs causes mode collapse (the model
|
| 168 |
+
inserts `!` punctuation as a proxy for "clarity"). Nucleus sampling eliminates this.
|
| 169 |
+
|
| 170 |
+
---
|
| 171 |
+
|
| 172 |
+
## Architecture
|
| 173 |
+
|
| 174 |
+
**Base model:** `google-t5/t5-base` (220M parameters)
|
| 175 |
+
|
| 176 |
+
**Input format:**
|
| 177 |
+
```
|
| 178 |
+
fix {violation_type}: [CONTEXT] {conversation_context} [RESPONSE] {response_to_fix}
|
| 179 |
+
```
|
| 180 |
+
|
| 181 |
+
Where `{violation_type}` β `{quantity, quality, manner}`.
|
| 182 |
+
|
| 183 |
+
**Three-layer degeneracy prevention:**
|
| 184 |
+
1. **Generation routing** β violation-type-aware decoding strategy (see above)
|
| 185 |
+
2. **Post-generation validation** β multi-signal degeneracy filter (punctuation bursts,
|
| 186 |
+
trigram repetition, exclamation density, character-level repetition)
|
| 187 |
+
3. **Graceful fallback** β if all repair attempts produce degenerate output, returns
|
| 188 |
+
the original response with a `is_fallback: True` flag
|
| 189 |
+
|
| 190 |
+
---
|
| 191 |
+
|
| 192 |
+
## Training Details
|
| 193 |
+
|
| 194 |
+
| Hyperparameter | Value |
|
| 195 |
+
+|----------------|-------|
|
| 196 |
+
+| Base model | google-t5/t5-base |
|
| 197 |
+
+| Training pairs | 3,210 seq2seq (violation β cooperative) pairs |
|
| 198 |
+
+| Validation pairs | 401 pairs |
|
| 199 |
+
+| Epochs | 5 |
|
| 200 |
+
+| Decoding (Qty/Ql) | Beam search, beam=4 |
|
| 201 |
+
+| Decoding (Manner) | Nucleus sampling, T=0.85, top-p=0.92 |
|
| 202 |
+
+| Label smoothing | 0.1 |
|
| 203 |
+
+| Hardware | Kaggle T4 |
|
| 204 |
+
|
| 205 |
+
---
|
| 206 |
+
|
| 207 |
+
## Important: Relation Violations
|
| 208 |
+
|
| 209 |
+
Relation violations (off-topic responses) **cannot be addressed by editing** β they
|
| 210 |
+
require generating entirely new, topically relevant content. This model's seq2seq
|
| 211 |
+
framing asks it to "fix" the existing response by editing, but there is nothing
|
| 212 |
+
to fix by editing when the entire response is off-topic.
|
| 213 |
+
|
| 214 |
+
For Relation violations, use the **FAISS retrieval system** included in the
|
| 215 |
+
GriceBench repository:
|
| 216 |
+
- 50,000 Topical-Chat responses indexed with FAISS
|
| 217 |
+
- MRR > 0.70, Top-1 accuracy > 60%
|
| 218 |
+
- See `data_processed/relation_repair/` in the GitHub repo
|
| 219 |
+
|
| 220 |
+
---
|
| 221 |
+
|
| 222 |
+
## Citation
|
| 223 |
+
|
| 224 |
+
```bibtex
|
| 225 |
+
@article{prabhath2026gricebench,
|
| 226 |
+
title={GriceBench: Operationalizing Gricean Maxims for Cooperative Dialogue Evaluation and Generation},
|
| 227 |
+
author={Prabhath, Pushkar},
|
| 228 |
+
year={2026}
|
| 229 |
+
}
|
| 230 |
+
```
|
| 231 |
+
|
| 232 |
+
---
|
| 233 |
+
|
| 234 |
+
## Related Models
|
| 235 |
+
|
| 236 |
+
| Model | Role | Link |
|
| 237 |
+
|-------|------|------|
|
| 238 |
+
| GriceBench-Detector | Detects which maxim is violated | [π Detector](https://huggingface.co/Pushkar27/GriceBench-Detector) |
|
| 239 |
+
| GriceBench-Repair | Repairs violations (this model) | You are here |
|
| 240 |
+
| GriceBench-DPO | Generates cooperative responses | [β‘ DPO Generator](https://huggingface.co/Pushkar27/GriceBench-DPO) |
|
| 241 |
+
|
| 242 |
+
**GitHub:** https://github.com/PushkarPrabhath27/Research-Model
|