Instructions to use jialinyyzz/humanizer-gemma-4-e4b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use jialinyyzz/humanizer-gemma-4-e4b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="jialinyyzz/humanizer-gemma-4-e4b")# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("jialinyyzz/humanizer-gemma-4-e4b") model = AutoModelForMultimodalLM.from_pretrained("jialinyyzz/humanizer-gemma-4-e4b", device_map="auto") - MLX
How to use jialinyyzz/humanizer-gemma-4-e4b with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # if on a CUDA device, also pip install mlx[cuda] # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("jialinyyzz/humanizer-gemma-4-e4b") prompt = "Once upon a time in" text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use jialinyyzz/humanizer-gemma-4-e4b with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf jialinyyzz/humanizer-gemma-4-e4b:Q6_K # Run inference directly in the terminal: llama cli -hf jialinyyzz/humanizer-gemma-4-e4b:Q6_K
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf jialinyyzz/humanizer-gemma-4-e4b:Q6_K # Run inference directly in the terminal: llama cli -hf jialinyyzz/humanizer-gemma-4-e4b:Q6_K
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf jialinyyzz/humanizer-gemma-4-e4b:Q6_K # Run inference directly in the terminal: ./llama-cli -hf jialinyyzz/humanizer-gemma-4-e4b:Q6_K
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf jialinyyzz/humanizer-gemma-4-e4b:Q6_K # Run inference directly in the terminal: ./build/bin/llama-cli -hf jialinyyzz/humanizer-gemma-4-e4b:Q6_K
Use Docker
docker model run hf.co/jialinyyzz/humanizer-gemma-4-e4b:Q6_K
- LM Studio
- Jan
- vLLM
How to use jialinyyzz/humanizer-gemma-4-e4b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "jialinyyzz/humanizer-gemma-4-e4b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "jialinyyzz/humanizer-gemma-4-e4b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/jialinyyzz/humanizer-gemma-4-e4b:Q6_K
- SGLang
How to use jialinyyzz/humanizer-gemma-4-e4b with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "jialinyyzz/humanizer-gemma-4-e4b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "jialinyyzz/humanizer-gemma-4-e4b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "jialinyyzz/humanizer-gemma-4-e4b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "jialinyyzz/humanizer-gemma-4-e4b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Ollama
How to use jialinyyzz/humanizer-gemma-4-e4b with Ollama:
ollama run hf.co/jialinyyzz/humanizer-gemma-4-e4b:Q6_K
- Unsloth Desktop
- MLX LM
How to use jialinyyzz/humanizer-gemma-4-e4b with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Generate some text mlx_lm.generate --model "jialinyyzz/humanizer-gemma-4-e4b" --prompt "Once upon a time"
- Docker Model Runner
How to use jialinyyzz/humanizer-gemma-4-e4b with Docker Model Runner:
docker model run hf.co/jialinyyzz/humanizer-gemma-4-e4b:Q6_K
- Lemonade
How to use jialinyyzz/humanizer-gemma-4-e4b with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull jialinyyzz/humanizer-gemma-4-e4b:Q6_K
Run and chat with the model
lemonade run user.humanizer-gemma-4-e4b-Q6_K
List all available models
lemonade list
- Atomic Chat
humanizer-gemma-4-e4b
One repo, every variant: transformers bf16 at the root; llama.cpp GGUF (Q8_0 / Q6_K / bf16; Q5_K_M and Q4_K_M withheld โ fidelity collapses below 6-bit on this model) under gguf/. Samples, code and the evaluation set: github.com/sgaofen/humanizer.
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.
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.
Training
- 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.
- 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.
- 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).
Evaluation (39-case daily-use set, 2 samples each)
| 62 English samples | this model | baseline 4B rewriter |
|---|---|---|
| samples copying > 35 % of draft | 0 | 33 / 93 |
| critical fidelity errors (judge) | 10 % | โ 30 % |
| Chinese cases passing judge | 10 / 16 | 4 / 16 |
| Originality.ai "human" (external check only) | 79 % | 57 % |
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.
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.
Prompt format (must match exactly)
Base-model continuation, not chat. prompt_format.json in this repo holds the instruction and separator:
{instr}
{draft}
### Rewritten:
Stop at EOS; temperature 0.85, top-p 0.95.
Usage
import json, torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from huggingface_hub import hf_hub_download
repo = "jialinyyzz/humanizer-gemma-4-e4b"
pf = json.load(open(hf_hub_download(repo, "prompt_format.json")))
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, dtype=torch.bfloat16, device_map="cuda")
draft = open("draft.txt").read()
prompt = pf["instr"] + "\n\n" + draft.strip() + pf["sep"]
ids = tok(prompt, return_tensors="pt").to("cuda")
out = model.generate(**ids, max_new_tokens=900, do_sample=True, temperature=0.85, top_p=0.95)
print(tok.decode(out[0][ids["input_ids"].shape[1]:], skip_special_tokens=True))
The full inference path with the anti-copy resample, an MLX server, the evaluation set and the training scripts are on GitHub: sgaofen/humanizer.
Licence
Weights derive from Gemma 4 and are provided under and subject to the Gemma Terms of Use. Code: Apache-2.0.
- Downloads last month
- 1,539
Quantized
Model tree for jialinyyzz/humanizer-gemma-4-e4b
Base model
google/gemma-4-E4B