Paraphase-4B / README.md
chadstthomas's picture
Upload README.md with huggingface_hub
c872a46 verified
|
Raw History Blame Contribute Delete
10.2 kB
---
license: apache-2.0
base_model: Qwen/Qwen3.5-4B
tags:
- humanizer
- ai-humanizer
- text-humanization
- text-rewriting
- rewriting
- paraphrase
- paraphraser
- style-transfer
- email
- email-rewriter
- ai-detection
- pangram
- gguf
- llama.cpp
- quantized
- local
- local-first
- offline
- privacy
- qlora
- lora
- qwen3.5
- text-generation
language:
- en
library_name: llama.cpp
pipeline_tag: text-generation
---
<img src="assets/banner.png" alt="Paraphase-4B: a stiff email draft rewritten into a plain, human-sounding email" width="100%">
# Paraphase-4B β€” AI humanizer for email
Paraphase-4B is a 4.2B-parameter **AI humanizer for English email**. It rewrites
AI-sounding drafts so they read like a person wrote them quickly at work β€” keeps
every number, name, date and commitment, adds nothing, and is **100% local** β€” no API, no upload. It is a
QLoRA fine-tune of [Qwen/Qwen3.5-4B](https://huggingface.co/Qwen/Qwen3.5-4B),
shipped as GGUF for llama.cpp.
The name is deliberate: *paraphrase* + *phrase*. This is not a chatbot; it is a
rewriter with a single job.
## Task adapters (new)
The raw Qwen3.5-4B base, the rewrite LoRA, and the measured extraction LoRAs
are in the **[Paraphase-4B Adapter Pack](https://huggingface.co/chadstthomas/Paraphase-4B-Adapter-Pack)**.
On a frozen 50-email AESLC test (magnitude-aware v2 labels), the extraction
LoRA raises exact match from **0.12 to 0.40**, micro F1 from **0.522 to
0.674**, and date F1 from **0.407 to 0.868**. The tool path is the raw base
plus a narrow guard: **0.70 to 0.75** on the frozen 20-item tool instrument.
The tool LoRA did not beat the base and is not shipped.
**One server, every task:** the pack supports hot-swapping β€” a single
llama-server loads all LoRAs and switches per request in **under 1 ms**, with
byte-identical parity to standalone single-adapter serving (measured; see the
pack card's notes on `cache_prompt: false`).
**Important:** the `paraphase-4b-Q8_0.gguf` in this repo is the merged humanizer,
not the adapter base. Use the Adapter Pack's raw `qwen3.5-4b-Q8_0.gguf` with the
LoRAs.
**[The Paraphase collection β†’](https://huggingface.co/collections/chadstthomas/paraphase-local-email-models-measured-6ada7f54cb27d41ff3ec168b)** β€”
the 4B, 2B, adapter pack, live demo, and explorer, with the premise in one place.
## Quick start
1. Download `paraphase-4b-Q8_0.gguf` (4.48 GB).
2. Serve it: `llama-server -m paraphase-4b-Q8_0.gguf -c 2048`
3. Send the rewrite prompt with `"chat_template_kwargs": {"enable_thinking": false}`.
[Full usage and the retry policy ↓](#how-to-use)
**[Try it live β†’](https://huggingface.co/spaces/chadstthomas/paraphase-rewriter)** β€” paste a draft, get a rewrite on ZeroGPU.
**[Open the interactive comparison β†’](https://huggingface.co/spaces/chadstthomas/paraphase-explorer)**
β€” the before/after, the Pangram data, and the 2B/4B/Q8/Q4 trade-offs.
**Smaller sibling:** [Paraphase-2B](https://huggingface.co/chadstthomas/Paraphase-2B)
(2.68 GB Q8; needs the retry wrapper).
## Before and after
Three synthetic drafts, rewritten by the Q8 + retry policy. The measured
numbers are below; these are demos, not a benchmark.
**Quarterly planning**
- *Before:* I hope this email finds you well. I am writing to inform you that the quarterly planning meeting has been rescheduled to Thursday, November 6 at 2:00 PM in Conference Room B. Please ensure that your team's updated projections are submitted by end of day Wednesday.
- *After:* Hi, just wanted to let you know the quarterly planning meeting is moved to Thursday, Nov 6 at 2:00 PM in Conference Room B. Make sure your team's updated projections are in by end of day Wednesday.
**September expenses**
- *Before:* Furthermore, it is important to note that all expense reports for the month of September must be submitted by October 15. Late submissions will not be processed until the following cycle.
- *After:* Also, all expense reports for September must be submitted by October 15. Late reports will not be processed until the next cycle.
**Vendor signatures**
- *Before:* Per my previous message, the vendor agreement requires signatures from both parties by Friday. Kindly advise if there are any outstanding questions.
- *After:* As discussed earlier, the vendor agreement needs signatures from both sides by Friday. Let me know if you have any remaining questions.
## What Pangram measured
Detector claims about "humanizers" are usually unverifiable. This model was
tested with a pre-registered Pangram bulk mission, and the result is reported
with its limits.
**The 186-probe mission.** One bulk batch, 186 probes, 397 units, $15.88:
50 human originals, 50 AI-ified drafts, 50 rewrites of those drafts, plus a
12-item human-source gate and a 12-item Q4 check. Human originals passed
**50/50**. Only **13/50** drafts were flagged at `fraction_ai β‰₯ 0.5`, so the
drafts were a weak AI-detection challenge and the mission's product-path arm is
**uninformative by its own control** (33/50 drafts carried a non-"Human"
Pangram category, but the pre-registered cut was the fraction).
**The flagged subset (the case that matters).** The 13 drafts Pangram actually
flagged were frozen, and the shipped **4B + contract-retry policy** was tested
on them in a second pre-registered run (13 probes, $0.88):
| metric | result |
|---|---|
| improved | **10/13** |
| median `fraction_ai` change | **βˆ’0.588** (95% CI [βˆ’0.794, 0.000]) |
| exact sign test | **p = 0.039** |
| crossed below 0.5 ("rescued") | **9/13** |
| pass β†’ fail flips | **0** |
The pre-registered gate was stricter β€” at least 11/13 improved β€” so this is
**suggestive, not a confirmed detector win**. The median item and the rescue
count moved in the right direction; two drafts got worse and one did not move.
A 2B sibling showed the same shape (10/13, median βˆ’0.503, 7 rescues).
**The 12-item human-source gate.** The 4B + retry passed **11/12** vs the base
model's **11/12** (one discordant item each way, McNemar p = 1.0; median
`fraction_ai` change βˆ’0.210). The 2B sibling passed 12/12 vs 11/12. The
pass-rate difference is descriptive only.
**What this means:** on drafts Pangram flags, the model plus retry lowers
Pangram's AI fraction substantially and moves most of them into the human range
in this sample. It is not a guarantee of passing as human-written, and the
strict pre-registered gate was narrowly missed. Raw scores are in
[`pangram/`](pangram/) (aggregates and per-item scores; no email text).
## Measured quality (voice50, 50 paired items; Q8 rows include the retry policy)
| model | valid | tells | fact fidelity | copy reuse | length | tool calls |
|---|---:|---:|---:|---:|---:|---:|
| **4B Q8 + retry (recommended)** | **50/50** | 0.08 | 0.97 | **0.26** | 1.11 | 0.65 |
| 4B Q8 greedy | 50/50 | 0.10 | 0.97 | 0.43 | 1.14 | 0.65 |
| 4B Q4 greedy (experimental) | 48/50 | 0.15 | 0.97 | 0.53 | 0.84 | 0.45 |
The retry policy is part of the recommendation: greedy output is already
100% valid, but resampling outputs that copy more than 70% of the input lowers
copy reuse from 0.43 to 0.26. Q4 is smaller (2.6 GB) but misses the release
gates on copy reuse and tool calls; use Q8 unless VRAM forces Q4.
## How to use
### llama.cpp
```bash
llama-server -m paraphase-4b-Q8_0.gguf -c 2048 --port 8080
```
Send the rewrite prompt with thinking disabled (Qwen3.5's template otherwise
starts with a "Thinking Process" preamble):
```python
import requests
PROMPT = (
"Rewrite the email below so it reads like a real person wrote it quickly at work. "
"Keep every fact, number, name, and commitment exactly the same. "
"Use plain, direct language. No em dashes. Keep it about the same length. "
"Output only the rewritten email.\n\nEMAIL:\n"
)
resp = requests.post("http://127.0.0.1:8080/v1/chat/completions", json={
"messages": [{"role": "user", "content": PROMPT + draft}],
"temperature": 0,
"max_tokens": 1024,
"chat_template_kwargs": {"enable_thinking": False},
})
print(resp.json()["choices"][0]["message"]["content"])
```
### Contract-aware retry (recommended)
Take the greedy output. If it is empty/meta/instruction-echo, shorter than
`max(20, 0.5 Γ— input)` words, or reuses more than 70% of the input's 5-grams,
resample at temperature 0.9 (at most twice) and keep the first acceptable
candidate. No detector is used; the check is input/output-only. This is the
policy measured above.
## Files
| file | size | notes |
|---|---:|---|
| `paraphase-4b-Q8_0.gguf` | 4.5 GB | recommended rung |
| `paraphase-4b-Q4_K_M.gguf` | 2.7 GB | experimental; below release gates |
| `adapter/` | 101 MB | LoRA adapter (r=16, all linear layers) |
## Training
- Base: `Qwen/Qwen3.5-4B` (Apache-2.0).
- Method: 4-bit QLoRA, 200 steps, LR 1e-4, r=16 on q/k/v/o/gate/up/down.
- Data mix: 502 low-overlap paraphrase pairs (teacher Qwen3.5-4B, source-to-target
5-gram reuse mean 0.094) ×2, 175 notes→email pairs, 475 real AI-draft/human
pairs, 412 persona rows, 26 tool-replay rows Γ—2.
- Human source text is AESLC-derived and is **not redistributed** here.
- No detector was used in training.
## Limitations
- English email only; not for documents, chat, or non-English text.
- The detector evidence is one vendor (Pangram 4.1), one run per probe, and a
suggestive flagged-subset result; no claim of universal detector evasion.
- 4B Q8 is 4.5 GB; a 6 GB GPU is the practical floor.
- The model can still copy heavily on some inputs; the retry policy is part of
the recommended setup.
- No human prose-quality evaluation has been run.
- Q4 is included for small machines but does not meet the Q8 release gates.
## License
Apache-2.0, inherited from the base model. See `LICENSE`.
## Citation
```bibtex
@misc{paraphase4b,
title = {Paraphase-4B: a local humanizer and paraphraser for email},
author = {Chad St. Thomas},
year = {2026},
note = {QLoRA fine-tune of Qwen3.5-4B; Pangram bulk evaluation}
}
```