Model Description
Qwen2.5-7B-Comment-Sexuality-Reasoner is a fine-tuned version of Qwen2.5-7B-Instruct adapted to a specific social-media analysis task in Spanish.
The model receives contextual information associated with an image together with one or more comments and analyzes each comment individually.
The task is context-aware: the model is instructed to evaluate the meaning and intent of a comment in relation to the provided image context and topic, rather than relying only on individual words.
Base Model
- Base model:
Qwen/Qwen2.5-7B-Instruct
- Fine-tuning method: DoRA
- Training framework: Unsloth
- Inference framework: vLLM
- Output language: Spanish (Castilian Spanish)
Intended Use
The model is intended for:
- Research on Spanish social-media comments.
- Context-aware classification of potentially sexualized comments.
- Dataset annotation and weak/semi-supervised labeling.
- Analysis of reasoning produced by language models for social-media moderation tasks.
- Experimental research into context-aware sexuality/sexualization detection.
The model should be considered a research model, not a production-ready moderation system.
The model expects structured information containing:
image_id: image identifier.
image_context: textual description of the associated image.
topic: topic associated with the image/content.
comment_author: author identifier.
author_gender: author gender metadata, when available.
comments: one or more comments to analyze.
The intended inference workflow groups comments by:
image_id + comment_author
This allows multiple comments from the same author on the same image to be provided together as additional context, while each comment is still classified independently.
Labels
non-sexualized: The comment is based on the image context and/or expresses admiration, support, or humor without sexual connotations or hidden intentions.
sexualized: The comment expresses desire, objectification, or an explicit or implicit sexual insinuation toward the person, outside the context of the image.
neutral: Multiple interpretations are possible and there is insufficient evidence to decide between them, or there is insufficient context.
Output
For each input comment, the model returns:
label
reasoning
non_sexualized_probability
sexualized_probability
neutral_probability
The probabilities are intended to sum to exactly 1.00, and the label should correspond to the class with the highest probability.
The reasoning is generated in Spanish.
Training
The model was fine-tuned from Qwen/Qwen2.5-7B-Instruct using parameter-efficient fine-tuning with DoRA.
Training was performed in two phases. The second phase focused on improving the desired reasoning behavior using a curated labeled dataset.
The training data was created for the specific task of analyzing Spanish social-media comments and included image descriptions, topics, comment text, author metadata, annotations, and reasoning examples.
The final model was merged with the base model and saved in 16-bit format for inference.
The objective was not only to learn the three-class classification task, but also to learn a reasoning style that explicitly considers the comment, image context, topic, and available author context.
Evaluation
The model was evaluated on a held-out gold dataset containing 448 comments.
The main comparison was against Qwen2.5-32B-Instruct using the same task setup and a dedicated reasoning-quality evaluation.
The evaluation considered:
- Classification performance against gold labels.
- Similarity between predicted and reference reasoning.
- Quality and specificity of generated reasoning.
- Reasoning richness.
- Consistency and contradictions.
- Probability behavior and calibration-related analyses.
The benchmark presented in this model card is task-specific and should not be interpreted as a general-purpose LLM benchmark.
Benchmark
The model was evaluated on a held-out gold dataset containing 448 comments and compared against Qwen2.5-32B-Instruct on the same task.
Classification, inference and reasoning metrics
Table with columns: Evaluation, Qwen2.5-32B-Instruct, Qwen2.5-7B-Comment-Sexuality-Reasoner| Evaluation | Qwen2.5-32B-Instruct | Qwen2.5-7B-Comment-Sexuality-Reasoner |
|---|
| Accuracy | 42.19% | 70.54% |
| Macro F1 | 49.24% | 70.53% |
| Inference time / 448 samples | 4m 30s | 35s |
| Reasoning TTR | 0.859 | 0.822 |
| Reasoning MTLD | 86.75 | 55.73 |
LLM-as-a-judge evaluation
Reasoning quality was additionally evaluated using an LLM-as-a-judge setup. The judge compared the generated outputs from both models for each example.
Table with columns: Evaluation, Qwen2.5-32B, Qwen2.5-7B-Comment-Sexuality-Reasoner| Evaluation | Qwen2.5-32B | Qwen2.5-7B-Comment-Sexuality-Reasoner |
|---|
| Best answer | 191 | 108 |
| Most similar to gold reasoning | 168 | 89 |
| Richest reasoning | 290 | 55 |
| Contradictory reasoning | 16 | 3 |
These results show that the 32B model generally produces richer and somewhat more semantically similar reasoning, while the 7B model produces substantially fewer contradictions according to the judge. More models were compared on the gold dataset, but the output shows the best two ones; this is why the sum is not 448.
Probability quality
Because the model outputs class probabilities in addition to a label, probability quality was also evaluated using the Brier score. Lower values are better.
Table with columns: Brier Score, Qwen2.5-32B, Qwen2.5-7B-Comment-Sexuality-Reasoner| Brier Score | Qwen2.5-32B | Qwen2.5-7B-Comment-Sexuality-Reasoner |
|---|
| Neutral | 0.1380 | 0.1078 |
| Non-sexualized | 0.2605 | 0.2075 |
| Sexualized | 0.1385 | 0.1569 |
Benchmark summary
Despite having only 7B parameters, Qwen2.5-7B-Comment-Sexuality-Reasoner substantially outperforms the 32B comparison model on the core classification task:
- Accuracy: 70.54% vs. 42.19%
- Macro F1: 70.53% vs. 49.24%
- Inference speed: 35s vs. 4m 30s for 448 samples.
- It also achieves better label-definition similarity (0.624 vs. 0.611).
- It achieves lower Brier scores for neutral and non-sexualized probabilities.
- According to the LLM-as-a-judge evaluation, the 32B model generally produces richer reasoning and is more often selected as the best answer, but the 7B model is selected as having fewer contradictory reasonings (3 vs. 16).
Overall, the benchmark indicates that the fine-tuned 7B model is substantially better adapted to this specific task than the larger 32B comparison model, while remaining much faster at inference. The 32B model retains an advantage in lexical and argumentative richness, but the 7B model achieves competitive reasoning quality while being considerably smaller and faster.
Bias, Risks and Limitations
The model was fine-tuned for a specific Spanish-language social-media dataset and may not generalize reliably to other languages, cultural contexts, platforms, or domains.
The model relies on the supplied image_context and topic. Errors or biases in the image-to-text description can propagate to the final classification.
author_gender is provided as contextual information but should not be sufficient evidence for classification. Demographic metadata can nevertheless introduce unintended biases.
Sexualization is context-dependent and culturally sensitive. The model may produce confident predictions in cases where human annotators disagree.
The generated probabilities should not automatically be interpreted as statistically calibrated probabilities of the true class. They are model-generated confidence estimates and should be validated for calibration before use in high-stakes systems.
This is a research model and has not been validated as a safety-critical content moderation system. Human review is recommended for ambiguous or consequential decisions.
How to Use
The recommended inference stack uses vLLM.
Installation
pip install transformers==4.45.2 torch==2.4.0 vllm==0.6.3.post1 trl==1.10.0 peft==0.19.1
The development environment used Python 3.12.13.
The model was tested using an NVIDIA A100-SXM4-40GB GPU. It is expected to run on smaller GPUs such as an NVIDIA L4 or T4, although memory requirements and inference speed depend on the configuration and workload.
Loading the model
from vllm import LLM
MODEL_PATH = "diego-florez/Qwen2.5-7B-Comment-Sexuality-Reasoner"
llm = LLM(
model=MODEL_PATH,
dtype="float16",
gpu_memory_utilization=0.90,
max_model_len=6144,
trust_remote_code=True,
)
tokenizer_vllm = llm.get_tokenizer()
import json
SYSTEM_MESSAGE = (
"Eres un experto razoneando y etiquetando comentarios "
"en redes sociales. "
"Responde SOLO JSON válido en español castellano."
)
def build_user_message(grouped_row):
comments_list = [
{"comment_text": ctext}
for ctext in grouped_row["comment_text"]
]
input_data = {
"image_context": grouped_row["image_context"],
"topic": grouped_row["topic"],
"comment_author": grouped_row["comment_author"],
"author_gender": grouped_row["author_gender"],
"num_comments": len(comments_list),
"comments": comments_list,
}
return """INPUT DATA:
{}
TASK:
Tu tarea es analizar comentarios relacionando con:
- image_context
- topic
- author_gender
Para cada comentario de la lista devuelve:
- label
- reasoning
- non_sexualized_probability
- sexualized_probability
- neutral_probability
Responde siempre en español castellano.
Las tres probabilidades deben sumar exactamente 1.00.
El label debe corresponder a la categoría con mayor probabilidad.
""".format(json.dumps(input_data, ensure_ascii=False, indent=2))
For reproducible use, the complete task instructions from the model's prompt should be used rather than the shortened example above.
Chat template
def build_full_prompt(grouped_row):
messages = [
{"role": "system", "content": SYSTEM_MESSAGE},
{"role": "user", "content": build_user_message(grouped_row)},
]
return tokenizer_vllm.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
)
The intended preprocessing groups the dataframe by image_id + comment_author:
gold_grouped = (
gold_df
.groupby(["image_id", "comment_author"])
.agg({
"image_context": "first",
"topic": "first",
"author_gender": "first",
"comment_id": list,
"comment_text": list,
"label": list,
})
.reset_index()
)
Several comments from the same author and image can therefore be processed together.
Running inference
from vllm import SamplingParams
all_prompts = []
all_sampling_params = []
for _, row in gold_grouped.iterrows():
n = len(row["comment_id"])
all_prompts.append(build_full_prompt(row))
all_sampling_params.append(
SamplingParams(
temperature=0.0,
repetition_penalty=1.05,
max_tokens=min(512, n * 384),
)
)
outputs = llm.generate(
all_prompts,
all_sampling_params,
use_tqdm=True,
)
The model is intended to return one JSON object per input comment, preserving the order of the comments in the input array.
comment_id comment_author author_gender
UgwRQpqDv9Q-3R2Mwnl4AaABAg @Minnie_Seung11 Female
UgznFZHitercnWbqsLp4AaABAg @sailymercedes009 Female
comment_text
"Mis rodillas no funcionan para ese baile 💀🫂"
"Jj q coordinación, d momento parecían trilliza..."
image_id
PDBKRRy5Glg
topic
Dance
image_context
[
"Number of people in the image: There are three...",
...
]
Output
comment_id pred_label
UgxY2bezj_1Vcts9hfR4AaABAg non-sexualized
UgwwtFB9UyVYEw8C1ON4AaABAg non-sexualized
reasoning
"El comentario no está relacionado con el contenido..."
"El comentario es un texto extenso que critica ..."
non_sexualized_probability
0.95
0.85
sexualized_probability
0.05
0.05
neutral_probability
0.0
0.1
The raw model response is JSON and can be parsed externally and aligned with the original comment_id values by position.
Model Files
The Hugging Face repository should contain the complete merged model and tokenizer output.
The model was exported as a merged 16-bit model specifically for inference with vLLM. All model weight shards generated by the export process, together with the configuration and tokenizer files, are required.
Reproducibility
- Python:
3.12.13
- PyTorch:
2.4.0
- Transformers:
4.45.2
- vLLM:
0.6.3.post1
- TRL:
1.10.0
- PEFT:
0.19.1
- GPU used for development/evaluation: NVIDIA A100-SXM4-40GB
The model was trained using parameter-efficient fine-tuning and subsequently merged into a 16-bit model for inference.
License
This model is released under the Apache License 2.0, consistent with the licensing of the Qwen2.5-7B-Instruct base model.
Please review the base model's license and terms before using the model in downstream applications.
Citation
If you use this model or the associated dataset/pipeline in research, please cite the corresponding project repository once it is published.
'''
Path('/mnt/data/README.md').write_text(readme, encoding='utf-8')
print(Path('/mnt/data/README.md').resolve())
print(Path('/mnt/data/README.md').stat().st_size)