Views
No views yet
unsloth/gemma-3-1b-it into a high-precision intent-preserving paraphrase generator.unsloth/gemma-3-1b-itadapter_config.json.| Parameter | Value |
|---|---|
LoRA Rank (r) | 48 |
| LoRA Alpha | 192 |
| LoRA Dropout | 0.0 |
| Target Modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Gradient Checkpointing | Unsloth |
| Full Finetuning | Disabled |
| 4-bit / 8-bit loading | Disabled |
| Random Seed | 3407 |
{"examples": ["...", "..."]}q entry includes 4–5 high-precision paraphrases that maintain:1{
2 "q": "When will Truth Social launch on iOS?",
3 "examples": [
4 "When will Truth Social be available on iOS?",
5 "What is the release date for Truth Social app on iPhone?",
6 "When does the Truth Social app launch on iOS?",
7 "Truth Social iOS release date?",
8 "Can you tell me when iOS users can access Truth Social?"
9 ]
10}1{
2 "q": "When will Truth Social launch on Android?",
3 "examples": [
4 "What is the release date for Truth Social on Android?",
5 "When is Truth Social expected to become available on Android?",
6 "When can Android users access Truth Social?",
7 "On which date will Truth Social be launched for Android devices?",
8 "When will the Android version of Truth Social be released?"
9 ]
10}| Hyperparameter | Value |
|---|---|
| Epochs | 2 |
| Learning Rate | 5e-5 |
| Warmup Steps | 5 |
| Optimizer | adamw_8bit |
| Batch Size | 4 |
| Weight Decay | 0.01 |
<start_of_turn>user
<start_of_turn>model1import torch
2from unsloth import FastLanguageModel
3
4model, tokenizer = FastLanguageModel.from_pretrained(
5 "mohanadffy/gemma3-intent-paraphraser-lora",
6 max_seq_length = 2048,
7 dtype = torch.float16,
8 load_in_4bit = False,
9)
10
11FastLanguageModel.for_inference(model)1SYSTEM_MSG = (
2 "You are an intent paraphrase generator.
3"
4 "Given a user query, output 5 diverse paraphrased examples expressing the SAME intent.
5"
6 "CRITICAL RULES:
7"
8 "1. Output ONLY a valid JSON object.
9"
10 "2. Follow EXACT schema: {\"examples\": [\"...\", \"...\"]}
11"
12 "3. No commentary. No markdown. No extra text.
13"
14)
15
16def generate_intent_examples(query, max_tokens=300):
17 prompt = tokenizer.apply_chat_template(
18 [
19 {"role": "system", "content": SYSTEM_MSG},
20 {"role": "user", "content": query},
21 ],
22 tokenize=False,
23 add_generation_prompt=True
24 )
25
26 inputs = tokenizer(prompt, return_tensors="pt").to(
27 "cuda" if torch.cuda.is_available() else "cpu"
28 )
29
30 output = model.generate(
31 **inputs,
32 max_new_tokens=max_tokens,
33 do_sample=True,
34 temperature=0.3,
35 top_p=0.95,
36 )
37
38 text = tokenizer.decode(output[0])
39
40 # Extract only the JSON block
41 import re
42 match = re.search(r"\{.*\}", text, flags=re.DOTALL)
43 return match.group(0) if match else textprint(generate_intent_examples("When will Truth Social launch on iOS?"))@misc{gemma_intent_paraphraser_2025,
title = {Gemma-3 Intent Paraphraser (LoRA Adapter)},
author = {Mohanad Afiffy , Mohamed Waleed Fakhr , Fahima Maghraby},
year = {2025},
howpublished = {\url{https://huggingface.co/mohanadffy/gemma3-intent-paraphraser-lora}},
}temperature = 0.1–0.3top_p = 0.9–0.95max_new_tokens = 200