jialinyyzz commited on
Commit
c0393fb
·
verified ·
1 Parent(s): 2e8087e

v2: SFT + DPO + GRPO (R7); two-judge eval; model card updated

Browse files
README.md CHANGED
@@ -20,26 +20,32 @@ One repo, every variant: transformers bf16 at the root; llama.cpp GGUF (Q8_0 / Q
20
 
21
  Rewrites AI-written drafts so they read like a person wrote them, keeping every fact, number, name and date. Fine-tune of `google/gemma-4-E4B`.
22
 
23
- **Trained on data that teaches the model how people write. No reinforcement learning or optimisation against any AI detector; it passes detectors naturally, and detector numbers below are only an external check.**
24
 
25
  ## Training
26
 
27
  * **SFT, 28.6k pairs** of *(AI draft → real human text)*. The human side is always genuine human writing (scientific abstracts, government reports, student essays, email, forum posts, Chinese prose); the AI side is a draft of the same content written by a current frontier model from the human text.
28
  * **DPO, 2 rounds, 1,898 pairs.** Candidates written by the model itself; a separate LLM judge grades *fidelity only* (facts kept, meaning unchanged, nothing added, greeting/sign-off kept, not a verbatim copy). Chosen = fidelity-clean with the least verbatim overlap; rejected = critical fidelity error or near-copy. No style, length or detector signal enters selection.
 
29
  * **Inference guard:** if a sample copies > 35 % of the draft's 5-grams it is resampled once with a logits penalty on draft n-grams (digits exempt).
30
 
31
  ## Evaluation (39-case daily-use set, 2 samples each)
32
 
33
- | 62 English samples | this model | baseline 4B rewriter |
34
- |---|---|---|
35
- | samples copying > 35 % of draft | 0 | 33 / 93 |
36
- | critical fidelity errors (judge) | 10 % | ≈ 30 % |
37
- | Chinese cases passing judge | 10 / 16 | 4 / 16 |
38
- | Originality.ai "human" *(external check only)* | 79 % | 57 % |
 
 
 
 
 
39
 
40
  GGUF files (Q8_0 / Q6_K / bf16; Q5_K_M withheld at 17/62 critical errors, Q4_K_M withheld as gibberish) are in the `gguf/` folder of this repo; their quality on the same set is in `docs/QUALITY.md` of the GitHub repo. MLX 4-/6-bit quantisation of this model is not usable (Gemma 4 PLE layers); use the GGUF quants on a Mac.
41
 
42
- Known failure modes: ~1 in 10 outputs has a meaning flip (who did what, ordered vs received, a metric renamed); subject lines/greetings occasionally dropped; Chinese weaker than English; short drafts (< 120 words) less reliable. **Proofread numbers, dates and the direction of every claim.**
43
 
44
  ## Prompt format (must match exactly)
45
 
@@ -74,7 +80,7 @@ out = model.generate(**ids, max_new_tokens=900, do_sample=True, temperature=0.85
74
  print(tok.decode(out[0][ids["input_ids"].shape[1]:], skip_special_tokens=True))
75
  ```
76
 
77
- The full inference path with the anti-copy resample, an MLX server, the evaluation set and the training scripts are on GitHub: `sgaofen/humanizer`.
78
 
79
  ## Licence
80
 
 
20
 
21
  Rewrites AI-written drafts so they read like a person wrote them, keeping every fact, number, name and date. Fine-tune of `google/gemma-4-E4B`.
22
 
23
+ **v2 (2026-09-14): SFT + DPO + GRPO. Trained on data that teaches the model how people write, then reinforced on fidelity only. No detector was used as a reward, filter, signal or selection criterion at any stage; it passes detectors naturally, and detector numbers below are only an external check.**
24
 
25
  ## Training
26
 
27
  * **SFT, 28.6k pairs** of *(AI draft → real human text)*. The human side is always genuine human writing (scientific abstracts, government reports, student essays, email, forum posts, Chinese prose); the AI side is a draft of the same content written by a current frontier model from the human text.
28
  * **DPO, 2 rounds, 1,898 pairs.** Candidates written by the model itself; a separate LLM judge grades *fidelity only* (facts kept, meaning unchanged, nothing added, greeting/sign-off kept, not a verbatim copy). Chosen = fidelity-clean with the least verbatim overlap; rejected = critical fidelity error or near-copy. No style, length or detector signal enters selection.
29
+ * **GRPO, 300 steps (v2).** LoRA on the merged SFT + DPO model, 8 samples per draft. Reward = LLM-judged fidelity against an atomic fact list of the draft (critical −3.0, minor −0.15, invented −2.0, reversed −2.0, dropped format element / greeting −1.5), −1.0 if the draft's register is normalised, and a superlinear reuse ramp (reuse = max(verbatim 5-gram copy, content-masked syntactic-skeleton recall); free below 0.31, −4 at full copy). Errors are credited to the sentence that carries them. Release checkpoint picked from a 25-step ladder on the held-out set. No detector anywhere in the reward.
30
  * **Inference guard:** if a sample copies > 35 % of the draft's 5-grams it is resampled once with a logits penalty on draft n-grams (digits exempt).
31
 
32
  ## Evaluation (39-case daily-use set, 2 samples each)
33
 
34
+ Two independent judges (GLM-5.3 and gpt-5.6); an error counts only if both report it. v1 re-graded under the same protocol.
35
+
36
+ | 62 English samples | **v2** | v1 (SFT + DPO) | baseline 4B rewriter |
37
+ |---|---|---|---|
38
+ | samples copying > 35 % of draft | 0 | 1 | 33 / 93 |
39
+ | reuse (verbatim ∨ syntactic skeleton), median | 0.29 | 0.34 | — |
40
+ | critical fidelity errors | **0 / 62** | 3 / 62 | ≈ 30 % |
41
+ | minor / clean | 20 / 42 | 15 / 44 | — |
42
+ | format element dropped | 5 / 62 | 12 / 62 | — |
43
+ | Chinese cases passing judge | 13 / 16 | 11 / 16 | 4 / 16 |
44
+ | Originality.ai "human" *(external check only)* | **85 %** | 81 % | 57 % |
45
 
46
  GGUF files (Q8_0 / Q6_K / bf16; Q5_K_M withheld at 17/62 critical errors, Q4_K_M withheld as gibberish) are in the `gguf/` folder of this repo; their quality on the same set is in `docs/QUALITY.md` of the GitHub repo. MLX 4-/6-bit quantisation of this model is not usable (Gemma 4 PLE layers); use the GGUF quants on a Mac.
47
 
48
+ Known failure modes (v2): dropped qualifiers in about 1 in 3 outputs ("an estimated 4.2 %" → "4.2 %", "suggest" → "conclude"); meaning flips were v1's main failure (~1 in 10) and did not appear in v2's 62 samples, but the set is small; an occasional garbled sentence — resample; Chinese weaker than English (13/16); short drafts (< 120 words) less reliable. **Proofread numbers, dates and the direction of every claim.** GGUF fidelity numbers in `docs/QUALITY.md` were measured on v1; v2 quants were built with the same recipe.
49
 
50
  ## Prompt format (must match exactly)
51
 
 
80
  print(tok.decode(out[0][ids["input_ids"].shape[1]:], skip_special_tokens=True))
81
  ```
82
 
83
+ Version history: v2 (2026-09-14, this revision) adds the GRPO stage; v1 (2026-09-10, SFT + DPO) is in the commit history of this repo. The full inference path with the anti-copy resample, an MLX server, the evaluation set and the training scripts are on GitHub: `sgaofen/humanizer`.
84
 
85
  ## Licence
86
 
config.json CHANGED
@@ -62,7 +62,6 @@
62
  "eos_token_id": 1,
63
  "expert_intermediate_size": null,
64
  "final_logit_softcapping": 30.0,
65
- "global_head_dim": 512,
66
  "head_dim": 256,
67
  "hidden_activation": "gelu_pytorch_tanh",
68
  "hidden_size": 2560,
@@ -115,13 +114,36 @@
115
  ],
116
  "max_position_embeddings": 131072,
117
  "model_type": "gemma4_text",
 
118
  "num_attention_heads": 8,
119
  "num_experts": null,
120
- "num_global_key_value_heads": null,
121
  "num_hidden_layers": 42,
122
  "num_key_value_heads": 2,
123
  "num_kv_shared_layers": 18,
124
  "pad_token_id": 0,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  "rms_norm_eps": 1e-06,
126
  "rope_parameters": {
127
  "full_attention": {
@@ -144,7 +166,7 @@
144
  "vocab_size_per_layer_input": 262144
145
  },
146
  "tie_word_embeddings": true,
147
- "transformers_version": "5.5.0.dev0",
148
  "video_token_id": 258884,
149
  "vision_config": {
150
  "_name_or_path": "",
 
62
  "eos_token_id": 1,
63
  "expert_intermediate_size": null,
64
  "final_logit_softcapping": 30.0,
 
65
  "head_dim": 256,
66
  "hidden_activation": "gelu_pytorch_tanh",
67
  "hidden_size": 2560,
 
114
  ],
115
  "max_position_embeddings": 131072,
116
  "model_type": "gemma4_text",
117
+ "moe_intermediate_size": null,
118
  "num_attention_heads": 8,
119
  "num_experts": null,
 
120
  "num_hidden_layers": 42,
121
  "num_key_value_heads": 2,
122
  "num_kv_shared_layers": 18,
123
  "pad_token_id": 0,
124
+ "per_layer_config": {
125
+ "05": {
126
+ "head_dim": 512
127
+ },
128
+ "11": {
129
+ "head_dim": 512
130
+ },
131
+ "17": {
132
+ "head_dim": 512
133
+ },
134
+ "23": {
135
+ "head_dim": 512
136
+ },
137
+ "29": {
138
+ "head_dim": 512
139
+ },
140
+ "35": {
141
+ "head_dim": 512
142
+ },
143
+ "41": {
144
+ "head_dim": 512
145
+ }
146
+ },
147
  "rms_norm_eps": 1e-06,
148
  "rope_parameters": {
149
  "full_attention": {
 
166
  "vocab_size_per_layer_input": 262144
167
  },
168
  "tie_word_embeddings": true,
169
+ "transformers_version": "5.15.0",
170
  "video_token_id": 258884,
171
  "vision_config": {
172
  "_name_or_path": "",
generation_config.json CHANGED
@@ -6,5 +6,5 @@
6
  "temperature": 1.0,
7
  "top_k": 64,
8
  "top_p": 0.95,
9
- "transformers_version": "5.5.0.dev0"
10
  }
 
6
  "temperature": 1.0,
7
  "top_k": 64,
8
  "top_p": 0.95,
9
+ "transformers_version": "5.15.0"
10
  }
model.safetensors → model-00001-of-00004.safetensors RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:519f1a0f586ec262ac70c383d8e2671ebfa57541b2fe6ba14d3dfaf260188a8c
3
- size 15992596739
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4736d5ae6bf7832256619d48c8768e1fc269d8a291532ad85067c61ca0e6b7f5
3
+ size 5637144744
model-00002-of-00004.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:72c4fe414e96b2aa6a5c1987ef76efd8187c71e234a39328eb0cc16553c8c1dc
3
+ size 4994573962
model-00003-of-00004.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e906359b61e36e187b59d7ef8abba0479ca225c72b8776892f1201b08b716901
3
+ size 4996204630
model-00004-of-00004.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8080cb1ab73a91528449fc238665f6a2938583e5f1dc877c099292a1f31f6144
3
+ size 254550436
model.safetensors.index.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json CHANGED
@@ -17,8 +17,30 @@
17
  "<|video|>"
18
  ],
19
  "image_token": "<|image|>",
 
 
20
  "mask_token": "<mask>",
21
  "model_max_length": 1000000000000000019884624838656,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  "pad_token": "<pad>",
23
  "padding_side": "left",
24
  "processor_class": "Gemma4Processor",
 
17
  "<|video|>"
18
  ],
19
  "image_token": "<|image|>",
20
+ "is_local": false,
21
+ "local_files_only": false,
22
  "mask_token": "<mask>",
23
  "model_max_length": 1000000000000000019884624838656,
24
+ "model_specific_special_tokens": {
25
+ "audio_token": "<|audio|>",
26
+ "boa_token": "<|audio>",
27
+ "boi_token": "<|image>",
28
+ "eoa_token": "<audio|>",
29
+ "eoc_token": "<channel|>",
30
+ "eoi_token": "<image|>",
31
+ "eot_token": "<turn|>",
32
+ "escape_token": "<|\"|>",
33
+ "etc_token": "<tool_call|>",
34
+ "etd_token": "<tool|>",
35
+ "etr_token": "<tool_response|>",
36
+ "image_token": "<|image|>",
37
+ "soc_token": "<|channel>",
38
+ "sot_token": "<|turn>",
39
+ "stc_token": "<|tool_call>",
40
+ "std_token": "<|tool>",
41
+ "str_token": "<|tool_response>",
42
+ "think_token": "<|think|>"
43
+ },
44
  "pad_token": "<pad>",
45
  "padding_side": "left",
46
  "processor_class": "Gemma4Processor",