Usage
The adapter expects the exact prompt format it was trained on:
from peft import PeftModelfrom transformers import AutoModelForCausalLM, AutoTokenizer tok = AutoTokenizer.from_pretrained("Qwen/Qwen3.5-4B")model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3.5-4B", torch_dtype="bfloat16")model = PeftModel.from_pretrained(model, "TomMoeras/contragand-qwen3.5-4b-open") system = """You read an English sentence, identify every role, occupation, or relational REFERENT in it (e.g. doctor, teacher, brother, neighbor, captain), and classify each one's gender. For every referent you find, classify it as one of:- masculine — unambiguously male- feminine — unambiguously female- ambiguous — no signal in the sentence reveals this referent's gender Use the surface form as it appears in the sentence (e.g. "doctor", not "the doctor"). List the referents in the order they appear. Respond with ONLY a JSON object:{"referents": [{"referent": "...", "gender": "masculine|feminine|ambiguous", "confidence": N, "reasoning": "..."}]} confidence is an integer 1-5 (5 = certain).reasoning is one short sentence per referent citing the textual evidence.""" user = "Sentence: The librarian, Mrs. Thompson, shelved the returned books."prompt = tok.apply_chat_template( [{"role": "system", "content": system}, {"role": "user", "content": user}], tokenize=False, add_generation_prompt=True, enable_thinking=False)
Greedy decoding, max_new_tokens=384. The response is a single JSON object
with one entry per identified referent.
Training
QLoRA (nf4), r=64, alpha=128, dropout 0.05 on all linear projections; lr 2e-5
cosine, 5 epochs with early stopping on eval loss; sequence length 1024;
trained with axolotl on 4x A100-80GB. Full configs, data builders, and
per-row evaluation results: https://github.com/TomMoeras/ContraGAND
Intended use and limitations
Research artifact for gender-ambiguity detection. Labels are restricted to
{masculine, feminine, ambiguous} and cannot represent non-binary or
singular-they referents. English only. Silver supervision can inherit rare
teacher coreference mis-bindings (see the paper's Limitations).
Dataset
Trained on the ContraGAND corpus: https://huggingface.co/datasets/TomMoeras/ContraGAND
Demo
Interactive demo (open + closed task): https://huggingface.co/spaces/TomMoeras/contragand-demo
Citation
Thomas Moerman, Eleni Gkovedarou, and Janiça Hackenbuchner. 2026. ContraGAND: Auditing and
Repairing Gender Ambiguity Failures in LLMs with Neurosymbolic Contrastive Data Augmentation.
In Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing
(EMNLP), pages 11136–11159, Budapest, Hungary. Association for Computational Linguistics.
https://doi.org/10.18653/2026.emnlp-main.485
@inproceedings{moerman2026contragand, title = {{ContraGAND}: Auditing and Repairing Gender Ambiguity Failures in {LLMs} with Neurosymbolic Contrastive Data Augmentation}, author = {Moerman, Thomas and Gkovedarou, Eleni and Hackenbuchner, Jani{\c{c}}a}, booktitle = {Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing (EMNLP)}, pages = {11136--11159}, address = {Budapest, Hungary}, publisher = {Association for Computational Linguistics}, url = {https://aclanthology.org/2026.emnlp-main.485/}, doi = {10.18653/2026.emnlp-main.485}, year = {2026}}