File size: 7,126 Bytes
c1768dc 2b1eb6e c1768dc e3dfb92 2b1eb6e c1768dc 7ccd289 c1768dc 2b1eb6e c1768dc 2b1eb6e c1768dc 2b1eb6e c1768dc 2b1eb6e c1768dc 2b1eb6e c1768dc 7ccd289 2b1eb6e c1768dc 2b1eb6e c1768dc 2b1eb6e c1768dc 2b1eb6e c1768dc 2b1eb6e c1768dc 2b1eb6e c1768dc 2b1eb6e c1768dc 2b1eb6e c1768dc 2b1eb6e c1768dc 2b1eb6e c1768dc 2b1eb6e c1768dc 2b1eb6e c1768dc 2b1eb6e c1768dc 2b1eb6e c1768dc 2b1eb6e c1768dc 2b1eb6e c1768dc 2b1eb6e c1768dc 2b1eb6e c1768dc 2b1eb6e c1768dc 2b1eb6e c1768dc 2b1eb6e c1768dc 7ccd289 2b1eb6e 7ccd289 2b1eb6e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
---
base_model: unsloth/Meta-Llama-3.1-8B-Instruct-bnb-4bit
library_name: peft
---
# Monolingual English Model Adapters for Neutral and Stance-Aware Definition Generation
The following models were trained in accordance with the methodology outlined in the paper:
[Stance-aware Definition Generation for Argumentative Texts]([URL](https://aclanthology.org/2025.argmining-1.16/)).
These models are trained to generate neutral (noslang, wordnet, oxford) and biased (slang, all), stance-aware definitions.
These adapters should be used together with the base model *unsloth/Meta-Llama-3.1-8B-Instruct-bnb-4bit* and require *unsloth* installation.
The models are instruction-tuned on the dictionary data:
WordNet (Ishiwatari et al., 2019), Oxford (Gadet-
sky et al., 2018), Wiktionary (Mickus
et al., 2022), Urban Dic-
tionary (Ni and Wang, 2017).
| Model | Training data |
|-------------------|--------------------------|
| LT3/definitions-oxford-llama-8B-instruct | Oxford |
| LT3/definitions-all-noslang-llama-8B-instruct | WordNet, Wiki, Oxford |
| LT3/definitions-all-llama-8B-instruct | WordNet, Wiki, Oxford, Urban |
| LT3/definitions-wordnet-llama-8B-instruct |WordNet |
| LT3/definitions-slang-llama-8B-instruct | Urban |
## How to use
The models expect a usage example and a keyword as input:
- keyword = "death penalty"
- example usage (argument) = "As long as death penalty is kept, this confirms that our society is founded on violence."
While we tested the models on the argumentative data to explore their potential to produce stance-aware definitions, they can be used for a general definition generation task for various contexts.
If you want to generate neutral definitions, avoid using slang- and all- models, these models aim to capture contextual bias that reflects the attitude of the author (pro, contra) towards the keyword.
The following code can be used for the definition generation task:
```python
import torch
from unsloth import FastLanguageModel
from transformers import AutoTokenizer
# Load model + adapter
BASE_MODEL = "unsloth/Meta-Llama-3.1-8B-Instruct-bnb-4bit"
#ADAPTER_PATH = "LT3/definitions-all-llama-8B-instruct"
#ADAPTER_PATH = "LT3/definitions-slang-llama-8B-instruct"
#ADAPTER_PATH = "LT3/definitions-oxford-llama-8B-instruct"
ADAPTER_PATH = "LT3/definitions-all-noslang-llama-8B-instruct"
#ADAPTER_PATH = "LT3/definitions-wordnet-llama-8B-instruct"
MAX_SEQ_LENGTH = 512
model, tokenizer = FastLanguageModel.from_pretrained(
model_name=BASE_MODEL,
max_seq_length=MAX_SEQ_LENGTH,
dtype="float16", # or "bfloat16" if needed
load_in_4bit=True
)
model.load_adapter(ADAPTER_PATH)
FastLanguageModel.for_inference(model)
# Prompt variants
PROMPTS = {
"definition_0": "What is the definition of {keyword} in the following text?",
# "definition_1": "What is the contextual definition of {keyword} in the following text?",
# "definition_2": "In what sense is the {keyword} used in the following text?",
# "definition_3": "What is the persuasive definition of {keyword} in the following text?",
# "definition_4": "What is the emotionally charged definition of {keyword} in the following text?"
}
# Alpaca-style prompt formatting
def format_prompt(instruction, context):
return f"""Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
{instruction}
### Input:
{context}
### Response:
"""
# Clean model output
def clean_response(response):
return response.split("### Response:")[-1].strip()
# Your example input
keyword = "death penalty"
argument = "As long as death penalty is kept, this confirms that our society is founded on violence."
# Generate for each prompt variant
print(f"\n Argument:\n{argument}\n")
for name, template in PROMPTS.items():
instruction = template.format(keyword=keyword)
prompt = format_prompt(instruction, argument)
inputs = tokenizer([prompt], return_tensors="pt").to("cuda")
outputs = model.generate(
**inputs,
max_new_tokens=100,
do_sample=True,
temperature=0.7,
use_cache=True
)
decoded = tokenizer.decode(outputs[0], skip_special_tokens=True)
definition = clean_response(decoded)
print(f" {name}:\n{definition}\n")
```
## Model Performance
The best model for the general definition generation task is oxford-llama. The lower plausibility score for slang- and all- models means the definitions are biased. These models can be further used to explore the generation of
contextual definitions that capture stance-related bias (pro or contra the keyword).
The plausibility score is based on human annotations.
| Model | BERTScoreF1 [%] | Plausibility [%] |
|-------------------|--------------------------|--------------|
| LT3/definitions-oxford-llama-8B-instruct | 88.2 | 84.5 |
| LT3/definitions-all-noslang-llama-8B-instruct | 86.0 | 79.8 |
| LT3/definitions-all-llama-8B-instruct | 86.5 | 53.25 |
| LT3/definitions-wordnet-llama-8B-instruct | 87.0 | 43.00 |
| LT3/definitions-slang-llama-8B-instruct | 86.8 | 37.25 |
### BibTeX entry and citation info
If you use our models, feel free to copy the following BibTeX code to cite the paper:
```bibtex
@inproceedings{evgrafova-etal-2025-stance,
title = "Stance-aware Definition Generation for Argumentative Texts",
author = "Evgrafova, Natalia and
De Langhe, Loic
and
Hoste, Veronique and
Lefever, Els ",
editor = "Chistova, Elena and
Cimiano, Philipp and
Haddadan, Shohreh and
Lapesa, Gabriella and
Ruiz-Dolz, Ramon",
booktitle = "Proceedings of the 12th Argument mining Workshop",
month = jul,
year = "2025",
address = "Vienna, Austria",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/2025.argmining-1.16/",
doi = "10.18653/v1/2025.argmining-1.16",
pages = "168--180",
ISBN = "979-8-89176-258-9",
abstract = "Definition generation models trained on dictionary data are generally expected to produce neutral and unbiased output while capturing the contextual nuances. However, previous studies have shown that generated definitions can inherit biases from both the underlying models and the input context. This paper examines the extent to which stance-related bias in argumentative data influences the generated definitions. In particular, we train a model on a slang-based dictionary to explore the feasibility of generating persuasive definitions that concisely reflect opposing parties' understandings of contested terms. Through this study, we provide new insights into bias propagation in definition generation and its implications for definition generation applications and argument mining."
}
``` |