Views
No views yet
"General Wordplay" query placeholder. The simplicity of this prompt produces more consistent supervision than the structured typed alternative.| File | Base model | LoRA r | Training data | MAP |
|---|---|---|---|---|
adapter_model.safetensors | Qwen2.5-7B-Instruct | 64 | Generic rationales, no augmentation | 0.6055 |
1from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
2from peft import PeftModel
3import torch
4
5base_model_id = "Qwen/Qwen2.5-7B-Instruct"
6adapter_id = "DS4AI-UPB/jokes-on-qwen2.5-7b"
7
8bnb_config = BitsAndBytesConfig(
9 load_in_4bit=True,
10 bnb_4bit_quant_type="nf4",
11 bnb_4bit_compute_dtype=torch.bfloat16,
12)
13
14tokenizer = AutoTokenizer.from_pretrained(base_model_id)
15model = PeftModel.from_pretrained(
16 AutoModelForCausalLM.from_pretrained(
17 base_model_id,
18 quantization_config=bnb_config,
19 device_map="auto",
20 ),
21 adapter_id,
22)
23model.eval()
24
25SYSTEM = (
26 "You are a humor and wordplay detection judge. You evaluate whether a text is relevant to a "
27 "query AND contains humor, jokes, puns, wordplay, or any form of linguistic wit (double "
28 "meanings, homophones, malapropisms, ironic twists). Answer only YES or NO."
29)
30
31def score(query: str, text: str) -> float:
32 messages = [
33 {"role": "system", "content": SYSTEM},
34 {"role": "user", "content": f'Query: "{query}"\nText: "{text}"\nIs this a relevant joke? Answer YES or NO.'},
35 ]
36 tokenized = tokenizer.apply_chat_template(
37 messages, add_generation_prompt=True, return_tensors="pt", return_dict=True
38 )
39 ids = tokenized["input_ids"].to(model.device)
40 with torch.no_grad():
41 logits = model(ids).logits[:, -1, :]
42 yes_id = tokenizer.convert_tokens_to_ids("YES")
43 no_id = tokenizer.convert_tokens_to_ids("NO")
44 return torch.softmax(torch.stack([logits[0, yes_id], logits[0, no_id]]), dim=0)[0].item()pip install -U transformers peft bitsandbytes accelerateTested withtransformers >= 4.45,peft >= 0.14,bitsandbytes >= 0.43. Requires a CUDA GPU for 4-bit quantization.
gemma4:e4b via Ollama) explaining why the text is or is not a relevant joke. Hard negatives (literal rewrites, defused jokes, wrong-topic jokes) are excluded from this variant — augmentation consistently degraded official evaluation performance.1@InProceedings{Mocanu2026IROH,
2 author = {Mocanu, Ana-Maria Luisa and Mocanu, Sebastian and Truică, Ciprian-Octavian and Apostol, Elena-Simona},
3 title = {IROH: Insightful Ranking Of Humor using Multi-Stage Hybrid Retrieval with Rationale-Distilled LLM Judges for JOKER 2026 Track Task 1 English},
4 booktitle = {Working Notes of CLEF 2026},
5 month = {September},
6 year = {2026}
7}| Resource | Link |
|---|---|
| Paper | WIP - will be updated when proceedings are published |
| arXiv | WIP |
| Code | GitHub — DS4AI-UPB/VANGUARD-CLEF2026-JOKER |
| Gemma judge | jokes-on-gemma4-31b |