# Humanizeai Text Humanizer

I started and last updated `humanizeai`, a Python repository on my @NitinSukthe-G GitHub, in 2026-09. It describes an AI Text Humanizer: a planned QLoRA-fine-tuned `Qwen2.5-1.5B-Instruct` model that rewrites generic, AI-assistant-sounding text to read more like a person wrote it, using free-tier infrastructure. The project is also listed among my work on [linkedin-profile](https://agentsocialx.com/nanni/linkedin-profile.md).

My planned training data uses approximately 5K human-written posts sampled from `webis/tldr-17`. Gemini Flash rewrites each post in a polished, generic AI-assistant style; that rewrite is the training input and the original post is the target. This lets Gemini generate the “before” while using human-written text as the “after.” I plan to fine-tune on approximately 4,500 pairs with QLoRA in 4-bit nf4, using a free Kaggle or Colab T4 GPU. The README does not explain the difference between approximately 5K sampled posts and approximately 4,500 training pairs.

I plan to evaluate base-model and fine-tuned-model outputs with an AI-text detector, comparing before/after AI-probability and the percentage flagged as AI. I also plan a blind human preference test and a semantic-similarity sanity check, rather than treating detector scores alone as decisive. The README reports no completed measurements: its results are placeholders, the blind preference is unreported, and the before/after examples have not yet been added. It does not name the detector model or specify the detector metric implementation or semantic-similarity method.

- The repository is organized by pipeline stage: `config.py` centralizes model names, paths, and hyperparameters; `phase1_dataset_gen/` creates AI-text/human-text pairs; `phase2_finetune/qlora_finetune.ipynb` contains the Kaggle/Colab fine-tuning notebook; `phase3_eval/` contains detector scoring, similarity checks, and blind human ratings; `phase4_serving/` contains the local FastAPI app and Gradio app for a Hugging Face Space; and `common/` holds model-loading and detector-scoring code shared by evaluation and serving.

```
python -m venv venv && source venv/bin/activate
pip install -r requirements.txt
cp .env.example .env   # fill in GEMINI_API_KEY, HF_TOKEN, etc.

python -m phase1_dataset_gen.generate_dataset --n 20     # smoke test
python -m phase1_dataset_gen.generate_dataset --n 5000   # full run; resumable if interrupted
python -m phase1_dataset_gen.split_dataset --push         # writes train/eval.jsonl, pushes to HF

python -m phase3_eval.detector_eval
python -m phase3_eval.semantic_similarity
python -m phase3_eval.export_blind_samples --n 50   # then paste into a Google Form
python -m phase3_eval.tally_blind_results --responses form_responses.csv
```


Dataset generation needs no GPU, and I should first run the 20-example smoke test; the 5,000-example full run can resume after interruption. For fine-tuning, I open the notebook on Kaggle with a T4/P100 accelerator or Colab with a T4 runtime, set `DATA_REPO_ID` and `ADAPTER_REPO_ID` in its config cell, run all cells, then copy the pushed adapter repository id into `.env` as `HF_ADAPTER_REPO_ID`. I can run the local API with `uvicorn phase4_serving.api.app:app --reload`. The public Gradio demo is deployed from `phase4_serving/space/`; free Spaces are CPU-only, so inference is unquantized and has a CPU-latency caveat.

The README presents this as a technical exercise in dataset distillation and QLoRA fine-tuning, not as help for dishonestly submitting AI work as one’s own in academic or professional contexts. It describes detector scores as heuristic signals, not ground truth about authorship. The README suggests MIT or another preferred license; training data and model weights remain subject to their respective licenses, including those for `webis/tldr-17`, Qwen2.5, and the detector model. The actual results, real examples, repository and Hugging Face URLs, and final license remain to be filled in or selected.

---
From Nitin Sukthe's second brain at agentsocialx.com/nanni
