初始化项目,由ModelHub XC社区提供模型
Model: pymlex/Qwen2.5-0.5B-Human Source: Original Platform
This commit is contained in:
38
.gitattributes
vendored
Normal file
38
.gitattributes
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||
*.model filter=lfs diff=lfs merge=lfs -text
|
||||
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
||||
assets/training_monitor_analysis.png filter=lfs diff=lfs merge=lfs -text
|
||||
assets/training_summary.png filter=lfs diff=lfs merge=lfs -text
|
||||
107
README.md
Normal file
107
README.md
Normal file
@@ -0,0 +1,107 @@
|
||||
---
|
||||
license: gpl-3.0
|
||||
language:
|
||||
- es
|
||||
base_model: Qwen/Qwen2.5-0.5B-Instruct
|
||||
tags:
|
||||
- dpo
|
||||
- ai-detection
|
||||
- paraphrase
|
||||
library_name: transformers
|
||||
datasets:
|
||||
- pymlex/ai-generated-texts
|
||||
metrics:
|
||||
- accuracy
|
||||
pipeline_tag: text-generation
|
||||
---
|
||||
|
||||
# Qwen2.5-0.5B-Human
|
||||
|
||||
DPO fine-tune of [Qwen/Qwen2.5-0.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct) that paraphrases Spanish academic abstracts to reduce AI-detection scores from [danibor/oculus-v2.0-multilingual](https://huggingface.co/danibor/oculus-v2.0-multilingual).
|
||||
|
||||
## Overview
|
||||
|
||||
Preference pairs for optimisation come from [pymlex/ai-generated-texts](https://huggingface.co/datasets/pymlex/ai-generated-texts). The corpus is [Flaglab/academic-knowledge-abstracts-es](https://huggingface.co/datasets/Flaglab/academic-knowledge-abstracts-es). For each train abstract, two base-model paraphrases are ranked by Oculus logit. DPO with beta = 0.1 increases the relative log-probability of the lower-logit completion. Retained pairs: 6396 from 8891 train abstracts with absolute logit gap at least 1.
|
||||
|
||||
## Evaluation setup
|
||||
|
||||
Hardware: NVIDIA RTX 5090, Ubuntu Jupyter, CUDA 13.0+, bf16 training and inference. Post-training evaluation generates one paraphrase per validation and test abstract with the base and fine-tuned models, scores each output with Oculus, and treats label 1 as AI-generated at threshold 0.5 on detector probability.
|
||||
|
||||
During DPO, mean validation AI probability on a 276-text subset moved from 0.6740 at step 0 to 0.2437 at the last monitor step (-0.4303).
|
||||
|
||||
## Results
|
||||
|
||||
| Model | Split | n | mean prob | mean logit | accuracy | MCC | ROC-AUC | F1 |
|
||||
| --- | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
|
||||
| base | validation | 1107 | 0.6550 | 1.4619 | 0.6712 | 0.0000 | n/a | 0.8032 |
|
||||
| base | test | 1112 | 0.6532 | 1.5581 | 0.6655 | 0.0000 | n/a | 0.7991 |
|
||||
| fine-tuned | validation | 1107 | 0.2264 | -2.0100 | 0.1716 | 0.0000 | n/a | 0.2930 |
|
||||
| fine-tuned | test | 1112 | 0.2391 | -1.8733 | 0.1835 | 0.0000 | n/a | 0.3100 |
|
||||
|
||||
Lower mean probability and MCC near zero indicate weaker detector response on model paraphrases under the AI-positive labelling convention.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
## Source code
|
||||
|
||||
The full pipeline is published on [GitHub](https://github.com/pymlex/ai-text-detector-tricking).
|
||||
|
||||
## Citation
|
||||
|
||||
If you found this model useful, please cite it as:
|
||||
|
||||
```bibtex
|
||||
@misc{zyukov2026qwenhuman,
|
||||
title = {{Qwen2.5-0.5B-Human: DPO fine-tune against Oculus detector}},
|
||||
author = {Zyukov, Alex},
|
||||
year = {2026},
|
||||
url = {https://huggingface.co/pymlex/Qwen2.5-0.5B-Human}
|
||||
}
|
||||
```
|
||||
|
||||
```bibtex
|
||||
@misc{zyukov2026aitexttricking,
|
||||
title = {{DPO Fine-Tuning Against Multilingual AI Text Detectors}},
|
||||
author = {Zyukov, Alex},
|
||||
year = {2026},
|
||||
url = {https://github.com/pymlex/ai-text-detector-tricking},
|
||||
publisher = {GitHub},
|
||||
organization = {pymlex}
|
||||
}
|
||||
```
|
||||
|
||||
```bibtex
|
||||
@misc{nicks2024detectors,
|
||||
title = {{Language Model Detectors Are Easily Optimized Against}},
|
||||
author = {Nicks, Cameron and Chua, Jeremy and Liu, Stephen and others},
|
||||
year = {2024},
|
||||
eprint = {2406.07490},
|
||||
archivePrefix = {arXiv},
|
||||
primaryClass = {cs.CL},
|
||||
url = {https://arxiv.org/abs/2406.07490}
|
||||
}
|
||||
```
|
||||
|
||||
```bibtex
|
||||
@misc{oculus2026,
|
||||
title = {{Oculus 2.0 Multilingual AI Text Detector}},
|
||||
author = {danibor},
|
||||
year = {2026},
|
||||
url = {https://huggingface.co/danibor/oculus-v2.0-multilingual}
|
||||
}
|
||||
```
|
||||
|
||||
```bibtex
|
||||
@misc{flaglab2025abstracts,
|
||||
title = {{Academic Knowledge Abstracts Spanish}},
|
||||
author = {Flaglab},
|
||||
year = {2025},
|
||||
url = {https://huggingface.co/datasets/Flaglab/academic-knowledge-abstracts-es}
|
||||
}
|
||||
```
|
||||
|
||||
The project is under GPL-3.0 license.
|
||||
27
assets/base_evaluation_report.json
Normal file
27
assets/base_evaluation_report.json
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"validation": {
|
||||
"split": "validation",
|
||||
"n_samples": 1107,
|
||||
"accuracy": 0.6711833785004516,
|
||||
"precision": 1.0,
|
||||
"recall": 0.6711833785004516,
|
||||
"f1": 0.8032432432432433,
|
||||
"mcc": 0.0,
|
||||
"roc_auc": null,
|
||||
"mean_logit": 1.4619352543295816,
|
||||
"mean_probability": 0.6550314651811926
|
||||
},
|
||||
"test": {
|
||||
"split": "test",
|
||||
"n_samples": 1112,
|
||||
"accuracy": 0.6654676258992805,
|
||||
"precision": 1.0,
|
||||
"recall": 0.6654676258992805,
|
||||
"f1": 0.7991360691144709,
|
||||
"mcc": 0.0,
|
||||
"roc_auc": null,
|
||||
"mean_logit": 1.5581493150792922,
|
||||
"mean_probability": 0.653164010906495
|
||||
},
|
||||
"threshold": 0.5
|
||||
}
|
||||
BIN
assets/detector_probability_hist_test.png
Normal file
BIN
assets/detector_probability_hist_test.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
BIN
assets/detector_probability_hist_validation.png
Normal file
BIN
assets/detector_probability_hist_validation.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 31 KiB |
27
assets/evaluation_report.json
Normal file
27
assets/evaluation_report.json
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"validation": {
|
||||
"split": "validation",
|
||||
"n_samples": 1107,
|
||||
"accuracy": 0.17163504968383017,
|
||||
"precision": 1.0,
|
||||
"recall": 0.17163504968383017,
|
||||
"f1": 0.29298380878951424,
|
||||
"mcc": 0.0,
|
||||
"roc_auc": null,
|
||||
"mean_logit": -2.0099520581162786,
|
||||
"mean_probability": 0.2263815667345318
|
||||
},
|
||||
"test": {
|
||||
"split": "test",
|
||||
"n_samples": 1112,
|
||||
"accuracy": 0.18345323741007194,
|
||||
"precision": 1.0,
|
||||
"recall": 0.18345323741007194,
|
||||
"f1": 0.3100303951367781,
|
||||
"mcc": 0.0,
|
||||
"roc_auc": null,
|
||||
"mean_logit": -1.8733430301172578,
|
||||
"mean_probability": 0.23908082744766893
|
||||
},
|
||||
"threshold": 0.5
|
||||
}
|
||||
BIN
assets/evaluation_summary.png
Normal file
BIN
assets/evaluation_summary.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 57 KiB |
BIN
assets/score_distributions.png
Normal file
BIN
assets/score_distributions.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 75 KiB |
3
assets/training_monitor_analysis.png
Normal file
3
assets/training_monitor_analysis.png
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:65481b02b5cdb712ab905c8de2b38e602f0c529cd12ad523c98571f0a22d7871
|
||||
size 107297
|
||||
3
assets/training_summary.png
Normal file
3
assets/training_summary.png
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:17a7da8f8f252d87024cb2292c642c68964c8099229eea4e73fb9cb47de32041
|
||||
size 108928
|
||||
54
chat_template.jinja
Normal file
54
chat_template.jinja
Normal file
@@ -0,0 +1,54 @@
|
||||
{%- if tools %}
|
||||
{{- '<|im_start|>system\n' }}
|
||||
{%- if messages[0]['role'] == 'system' %}
|
||||
{{- messages[0]['content'] }}
|
||||
{%- else %}
|
||||
{{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }}
|
||||
{%- endif %}
|
||||
{{- "\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
|
||||
{%- for tool in tools %}
|
||||
{{- "\n" }}
|
||||
{{- tool | tojson }}
|
||||
{%- endfor %}
|
||||
{{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
|
||||
{%- else %}
|
||||
{%- if messages[0]['role'] == 'system' %}
|
||||
{{- '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }}
|
||||
{%- else %}
|
||||
{{- '<|im_start|>system\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\n' }}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- for message in messages %}
|
||||
{%- if (message.role == "user") or (message.role == "system" and not loop.first) or (message.role == "assistant" and not message.tool_calls) %}
|
||||
{{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
|
||||
{%- elif message.role == "assistant" %}
|
||||
{{- '<|im_start|>' + message.role }}
|
||||
{%- if message.content %}
|
||||
{{- '\n' + message.content }}
|
||||
{%- endif %}
|
||||
{%- for tool_call in message.tool_calls %}
|
||||
{%- if tool_call.function is defined %}
|
||||
{%- set tool_call = tool_call.function %}
|
||||
{%- endif %}
|
||||
{{- '\n<tool_call>\n{"name": "' }}
|
||||
{{- tool_call.name }}
|
||||
{{- '", "arguments": ' }}
|
||||
{{- tool_call.arguments | tojson }}
|
||||
{{- '}\n</tool_call>' }}
|
||||
{%- endfor %}
|
||||
{{- '<|im_end|>\n' }}
|
||||
{%- elif message.role == "tool" %}
|
||||
{%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %}
|
||||
{{- '<|im_start|>user' }}
|
||||
{%- endif %}
|
||||
{{- '\n<tool_response>\n' }}
|
||||
{{- message.content }}
|
||||
{{- '\n</tool_response>' }}
|
||||
{%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
|
||||
{{- '<|im_end|>\n' }}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- if add_generation_prompt %}
|
||||
{{- '<|im_start|>assistant\n' }}
|
||||
{%- endif %}
|
||||
57
config.json
Normal file
57
config.json
Normal file
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"architectures": [
|
||||
"Qwen2ForCausalLM"
|
||||
],
|
||||
"attention_dropout": 0.0,
|
||||
"bos_token_id": null,
|
||||
"dtype": "bfloat16",
|
||||
"eos_token_id": 151645,
|
||||
"hidden_act": "silu",
|
||||
"hidden_size": 896,
|
||||
"initializer_range": 0.02,
|
||||
"intermediate_size": 4864,
|
||||
"layer_types": [
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention"
|
||||
],
|
||||
"max_position_embeddings": 32768,
|
||||
"max_window_layers": 21,
|
||||
"model_type": "qwen2",
|
||||
"num_attention_heads": 14,
|
||||
"num_hidden_layers": 24,
|
||||
"num_key_value_heads": 2,
|
||||
"pad_token_id": 151643,
|
||||
"rms_norm_eps": 1e-06,
|
||||
"rope_parameters": {
|
||||
"rope_theta": 1000000.0,
|
||||
"rope_type": "default"
|
||||
},
|
||||
"sliding_window": null,
|
||||
"tie_word_embeddings": true,
|
||||
"transformers_version": "5.12.1",
|
||||
"use_cache": false,
|
||||
"use_sliding_window": false,
|
||||
"vocab_size": 151936
|
||||
}
|
||||
13
generation_config.json
Normal file
13
generation_config.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"do_sample": true,
|
||||
"eos_token_id": [
|
||||
151645,
|
||||
151643
|
||||
],
|
||||
"pad_token_id": 151643,
|
||||
"repetition_penalty": 1.1,
|
||||
"temperature": 0.7,
|
||||
"top_k": 20,
|
||||
"top_p": 0.8,
|
||||
"transformers_version": "5.12.1"
|
||||
}
|
||||
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b7f21bccd6cd8bbef97fdb58907ee2cbccd1984bba1eb204b95a823d7ff8b42a
|
||||
size 988097824
|
||||
3
tokenizer.json
Normal file
3
tokenizer.json
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f7f96da3a872b5e901575b2067c744ad336c3a3d77a21584d20024557b1bd7f0
|
||||
size 11422059
|
||||
30
tokenizer_config.json
Normal file
30
tokenizer_config.json
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"add_prefix_space": false,
|
||||
"backend": "tokenizers",
|
||||
"bos_token": null,
|
||||
"clean_up_tokenization_spaces": false,
|
||||
"eos_token": "<|im_end|>",
|
||||
"errors": "replace",
|
||||
"extra_special_tokens": [
|
||||
"<|im_start|>",
|
||||
"<|im_end|>",
|
||||
"<|object_ref_start|>",
|
||||
"<|object_ref_end|>",
|
||||
"<|box_start|>",
|
||||
"<|box_end|>",
|
||||
"<|quad_start|>",
|
||||
"<|quad_end|>",
|
||||
"<|vision_start|>",
|
||||
"<|vision_end|>",
|
||||
"<|vision_pad|>",
|
||||
"<|image_pad|>",
|
||||
"<|video_pad|>"
|
||||
],
|
||||
"is_local": false,
|
||||
"local_files_only": false,
|
||||
"model_max_length": 131072,
|
||||
"pad_token": "<|endoftext|>",
|
||||
"split_special_tokens": false,
|
||||
"tokenizer_class": "Qwen2Tokenizer",
|
||||
"unk_token": null
|
||||
}
|
||||
3
training_args.bin
Normal file
3
training_args.bin
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:27eee94ef52ffdab13debdfd69595f23c360fa3f04a478919c1ce44e5a3d787b
|
||||
size 5777
|
||||
Reference in New Issue
Block a user