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-closed") system = """You classify the gender of a named REFERENT in an English sentence. Output one of three labels:- masculine — the referent is unambiguously male- feminine — the referent is unambiguously female- ambiguous — the sentence contains no signal that reveals the referent's gender Respond with ONLY a JSON object:{"gender": "masculine|feminine|ambiguous", "confidence": N, "reasoning": "..."} confidence is an integer 1-5 (5 = certain).reasoning is one short sentence citing the textual evidence (the pronoun, the title, the gendered noun, etc.).""" user = "Sentence: The librarian, Mrs. Thompson, shelved the returned books.\nReferent: librarian"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=200. The response is a single JSON object.
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. See the paper's Limitations and
Ethical considerations.
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}}