Views
No views yet
| 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 |
1import torch
2from unsloth import FastLanguageModel
3from transformers import AutoTokenizer
4
5# Load model + adapter
6BASE_MODEL = "unsloth/Meta-Llama-3.1-8B-Instruct-bnb-4bit"
7ADAPTER_PATH = "LT3/definitions-all-llama-8B-instruct"
8#ADAPTER_PATH = "LT3/definitions-slang-llama-8B-instruct"
9#ADAPTER_PATH = "LT3/definitions-oxford-llama-8B-instruct"
10#ADAPTER_PATH = "LT3/definitions-all-noslang-llama-8B-instruct"
11#ADAPTER_PATH = "LT3/definitions-wordnet-llama-8B-instruct"
12
13MAX_SEQ_LENGTH = 512
14
15model, tokenizer = FastLanguageModel.from_pretrained(
16 model_name=BASE_MODEL,
17 max_seq_length=MAX_SEQ_LENGTH,
18 dtype="float16", # or "bfloat16" if needed
19 load_in_4bit=True
20)
21
22model.load_adapter(ADAPTER_PATH)
23FastLanguageModel.for_inference(model)
24
25# Prompt variants
26PROMPTS = {
27 "definition_0": "What is the definition of {keyword} in the following text?",
28 # "definition_1": "What is the contextual definition of {keyword} in the following text?",
29 # "definition_2": "In what sense is the {keyword} used in the following text?",
30 # "definition_3": "What is the persuasive definition of {keyword} in the following text?",
31 # "definition_4": "What is the emotionally charged definition of {keyword} in the following text?"
32}
33
34# Alpaca-style prompt formatting
35def format_prompt(instruction, context):
36 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.
37
38### Instruction:
39{instruction}
40
41### Input:
42{context}
43
44### Response:
45"""
46
47# Clean model output
48def clean_response(response):
49 return response.split("### Response:")[-1].strip()
50
51# Your example input
52keyword = "death penalty"
53argument = "As long as death penalty is kept, this confirms that our society is founded on violence."
54
55# Generate for each prompt variant
56print(f"\n Argument:\n{argument}\n")
57for name, template in PROMPTS.items():
58 instruction = template.format(keyword=keyword)
59 prompt = format_prompt(instruction, argument)
60
61 inputs = tokenizer([prompt], return_tensors="pt").to("cuda")
62 outputs = model.generate(
63 **inputs,
64 max_new_tokens=100,
65 do_sample=True,
66 temperature=0.7,
67 use_cache=True
68 )
69
70 decoded = tokenizer.decode(outputs[0], skip_special_tokens=True)
71 definition = clean_response(decoded)
72
73 print(f" {name}:\n{definition}\n")
74
75| 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 |
1@inproceedings{evgrafova-etal-2025-stance,
2 title = "Stance-aware Definition Generation for Argumentative Texts",
3 author = "Evgrafova, Natalia and
4 De Langhe, Loic
5and
6 Hoste, Veronique and
7 Lefever, Els ",
8 editor = "Chistova, Elena and
9 Cimiano, Philipp and
10 Haddadan, Shohreh and
11 Lapesa, Gabriella and
12 Ruiz-Dolz, Ramon",
13 booktitle = "Proceedings of the 12th Argument mining Workshop",
14 month = jul,
15 year = "2025",
16 address = "Vienna, Austria",
17 publisher = "Association for Computational Linguistics",
18 url = "https://aclanthology.org/2025.argmining-1.16/",
19 doi = "10.18653/v1/2025.argmining-1.16",
20 pages = "168--180",
21 ISBN = "979-8-89176-258-9",
22 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."
23}
24