--- license: apache-2.0 base_model: unsloth/Qwen3-4B-Instruct-2507 tags: - qwen - unsloth - quantized - q4_k_m - gguf - fine-tuned - text-rewriting - text-generation - human-like-writing language: - en datasets: - custom-jsonl-rewriting library_name: gguf pipeline_tag: text-generation --- # Qwen3-4B-Instruct Text Rewriter (GGUF Format) ### Example Notebook 🔗Kaggle notebook [here](https://www.kaggle.com/code/soumyojitsen2004/example-code) ## Model Description This model is a fine-tuned version of **Qwen3-4B-Instruct-2507**, optimized specifically to rewrite AI-generated text into a more natural, human-like style. It was trained to reduce the "robotic" tone often found in LLM outputs while maintaining the original meaning and factual accuracy. - **Base Model:** [unsloth/Qwen3-4B-Instruct-2507](https://huggingface.co/unsloth/Qwen3-4B-Instruct-2507) (merged from `unsloth/Qwen3-4B-Instruct-2507-bnb-4bit`) - **Fine-tuned by:** [Heatw4ve](https://huggingface.co/Heatw4ve) - **Fine-tuning Tool:** [Unsloth](https://github.com/unslothai/unsloth) - **Quantization format:** GGUF (Quantized to Q4_K_M) - **Training framework:** Unsloth (LoRA-based SFT) - **Language:** English - **Intended usage:** Local inference, research, and experimentation ## Training Details The model was fine-tuned using LoRA (Low-Rank Adaptation) on a custom dataset of 28,000+ pairs of AI vs. Human-rewritten text. ### Training Configuration The model was fine-tuned with the following parameters: - **Epochs:** 2 - **Learning Rate:** 5e-5 - **Optimizer:** AdamW 8-bit - **LR Scheduler:** Cosine - **Warmup Steps:** 100 - **Context Length:** 512 tokens - **LoRA Config:** - Rank (r): 64 - Alpha: 128 - Target Modules: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj - **Effective Batch Size:** 128 (32 per device * 4 grad accumulation) ## Usage This is a GGUF version, compatible with **LM Studio**, **Ollama**, and **llama.cpp**. Works best with inputs of length 15-150 words. ### System Prompt To achieve the intended rewriting style, use the following system prompt: > You are a helpful assistant that rewrites AI-toned text into natural, human-like writing. ### User Prompt Format ```text Rewrite the following text to sound like a real human wrote it: [INSERT TEXT HERE] ``` ### Example Code ```code from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="Heatw4ve/Qwen3-4B-Instruct-2507-rewriter-gguf", filename="Qwen3-4B.gguf", n_ctx=4096, n_gpu_layers=16, n_threads=4, verbose=False, chat_format="chatml", ) text=''' William Shakespeare, the master of human insight, gifted us with a timeless observation that cuts to the heart of intellect and humility: "The fool doth think he is wise, but the wise man knows himself to be a fool." Uttered by the character Touchstone in As You Like It, this seemingly paradoxical statement is far more than a witty quip; it's a profound commentary on self-awareness, the nature of true wisdom, and the perpetual quest for knowledge. ''' messages = [ {"role": "system", "content": "You are a helpful assistant that rewrites AI-toned text into natural, human-like writing."}, {"role": "user", "content": f"Rewrite the following text to sound like a real human wrote it:\n\n{text}"} ] output = llm.create_chat_completion( messages=messages, max_tokens=512, temperature=random.uniform(0.9, 1.2), top_p=random.uniform(0.87, 0.96), seed=random.randint(2, 2**32), stop=["<|im_end|>", "<|endoftext|>"] ) print(output["choices"][0]["message"]["content"].strip()) ``` 🔗[Connect](https://www.linkedin.com/in/soumyojit-sen/) with me on LinkedIn