Text Generation
Safetensors
Turkish
gemma3_text
gemma-3
unsloth
lora
sft
turkish
x-replies
social-media
conversational
Instructions to use berkbirkan/gemma-3-lora-finetune-x-replies with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Local Apps Settings
- Unsloth Studio
How to use berkbirkan/gemma-3-lora-finetune-x-replies with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for berkbirkan/gemma-3-lora-finetune-x-replies to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for berkbirkan/gemma-3-lora-finetune-x-replies to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for berkbirkan/gemma-3-lora-finetune-x-replies to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="berkbirkan/gemma-3-lora-finetune-x-replies", max_seq_length=2048, )
Update bilingual training report
Browse files
README.md
CHANGED
|
@@ -1,21 +1,570 @@
|
|
| 1 |
---
|
| 2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
tags:
|
| 4 |
-
-
|
| 5 |
-
- transformers
|
| 6 |
- unsloth
|
| 7 |
-
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
-
|
|
|
|
| 11 |
---
|
| 12 |
|
| 13 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
-
|
| 20 |
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
language:
|
| 3 |
+
- tr
|
| 4 |
+
license: other
|
| 5 |
+
base_model: unsloth/gemma-3-1b-it
|
| 6 |
+
pipeline_tag: text-generation
|
| 7 |
+
datasets:
|
| 8 |
+
- berkbirkan/turkish-x-engagement-replies
|
| 9 |
tags:
|
| 10 |
+
- gemma-3
|
|
|
|
| 11 |
- unsloth
|
| 12 |
+
- lora
|
| 13 |
+
- sft
|
| 14 |
+
- turkish
|
| 15 |
+
- x-replies
|
| 16 |
+
- social-media
|
| 17 |
---
|
| 18 |
|
| 19 |
+
# Gemma 3 1B — Turkish X Reply LoRA Fine-Tuning
|
| 20 |
+
|
| 21 |
+
Bu repo, Gemma 3 1B modelinin gerçek Türkçe X reply örnekleri üzerinde Unsloth
|
| 22 |
+
ve LoRA ile supervised fine-tuning (SFT) deneyini içerir. Amaç, modele bir ana X
|
| 23 |
+
gönderisine bağlama uygun, doğal ve kısa Türkçe reply üretme davranışını
|
| 24 |
+
kazandırmaktır.
|
| 25 |
+
|
| 26 |
+
This repository contains a supervised fine-tuning (SFT) experiment in which
|
| 27 |
+
Gemma 3 1B was adapted with Unsloth and LoRA on real Turkish X reply examples.
|
| 28 |
+
The objective is to teach the model to write short, natural Turkish replies that
|
| 29 |
+
are relevant to a parent X post.
|
| 30 |
+
|
| 31 |
+
## Bağlantılar / Links
|
| 32 |
+
|
| 33 |
+
- Eğitilen model / Trained model: [berkbirkan/gemma-3-lora-finetune-x-replies](https://huggingface.co/berkbirkan/gemma-3-lora-finetune-x-replies)
|
| 34 |
+
- Eğitim dataseti / Training dataset: [berkbirkan/turkish-x-engagement-replies](https://huggingface.co/datasets/berkbirkan/turkish-x-engagement-replies)
|
| 35 |
+
- Dataset GitHub: [berkbirkan/x-replies-quotes-dataset](https://github.com/berkbirkan/x-replies-quotes-dataset)
|
| 36 |
+
- Bu deneyin GitHub reposu / Experiment repository: [berkbirkan/gemma-3-lora-finetune-x-replies](https://github.com/berkbirkan/gemma-3-lora-finetune-x-replies)
|
| 37 |
+
- Notebook: [`Gemma3_(4B)_ipynb_x_replies_dataset_finetuning.ipynb`](Gemma3_(4B)_ipynb_x_replies_dataset_finetuning.ipynb)
|
| 38 |
+
|
| 39 |
+
> **Adlandırma notu / Naming note:** Notebook dosya adında `4B` yazmasına rağmen
|
| 40 |
+
> çalıştırılan `model_name` açıkça `unsloth/gemma-3-1b-it` değeridir. Eğitim
|
| 41 |
+
> logunda da toplam parametre sayısı 1.006.408.832 olarak görünür. Bu rapor gerçek
|
| 42 |
+
> çalıştırmayı esas alır ve modeli **Gemma 3 1B** olarak tanımlar.
|
| 43 |
+
>
|
| 44 |
+
> Although the notebook filename contains `4B`, the executed `model_name` is
|
| 45 |
+
> explicitly `unsloth/gemma-3-1b-it`, and the trainer reports 1,006,408,832 total
|
| 46 |
+
> parameters. This report follows the actual run and identifies the model as
|
| 47 |
+
> **Gemma 3 1B**.
|
| 48 |
+
|
| 49 |
+
---
|
| 50 |
+
|
| 51 |
+
## Türkçe
|
| 52 |
+
|
| 53 |
+
### Projenin amacı
|
| 54 |
+
|
| 55 |
+
Bu deney, genel amaçlı Gemma 3 1B Instruct modeline Türkçe sosyal medya reply
|
| 56 |
+
üslubu kazandırmayı hedefler. Hedef davranışlar:
|
| 57 |
+
|
| 58 |
+
- Ana gönderinin bağlamına doğrudan cevap vermek
|
| 59 |
+
- Kısa ve doğal Türkçe kullanmak
|
| 60 |
+
- Reply ile quote davranışlarını karıştırmamak
|
| 61 |
+
- Konuşmayı ilerleten veya anlamlı tepki veren cevaplar üretmek
|
| 62 |
+
- Sosyal medya dilindeki mention ve kısa ifade kalıplarına uyum sağlamak
|
| 63 |
+
|
| 64 |
+
Bu çalışma modelin virallik üretmesini veya etkileşim garantisi vermesini
|
| 65 |
+
amaçlamaz. X etkileşimleri görünürlük, takipçi ağı, zamanlama, konu ve platform
|
| 66 |
+
algoritmasından etkilenir.
|
| 67 |
+
|
| 68 |
+
### Dataset
|
| 69 |
+
|
| 70 |
+
Kaynak dataset:
|
| 71 |
+
[`berkbirkan/turkish-x-engagement-replies`](https://huggingface.co/datasets/berkbirkan/turkish-x-engagement-replies)
|
| 72 |
+
|
| 73 |
+
| Split | Kayıt |
|
| 74 |
+
|---|---:|
|
| 75 |
+
| Train | 823 |
|
| 76 |
+
| Validation | 126 |
|
| 77 |
+
| Test | 51 |
|
| 78 |
+
| Toplam | 1.000 |
|
| 79 |
+
|
| 80 |
+
Notebook yalnız `split="train"` ile 823 train örneğini yüklemiştir. Validation ve
|
| 81 |
+
test splitleri veri kaynağında mevcut olmasına rağmen `SFTTrainer` içinde
|
| 82 |
+
`eval_dataset=None` bırakılmıştır; bu nedenle bu deneyde validation loss veya
|
| 83 |
+
test metriği yoktur.
|
| 84 |
+
|
| 85 |
+
Her satır yalnızca `messages` sütununa sahip iki turlu bir konuşmadır:
|
| 86 |
+
|
| 87 |
+
```json
|
| 88 |
+
{
|
| 89 |
+
"messages": [
|
| 90 |
+
{
|
| 91 |
+
"role": "user",
|
| 92 |
+
"content": "Aşağıdaki X gönderisine bağlama uygun, doğal ve kısa bir reply yaz: ..."
|
| 93 |
+
},
|
| 94 |
+
{
|
| 95 |
+
"role": "assistant",
|
| 96 |
+
"content": "Seçilmiş gerçek reply metni"
|
| 97 |
+
}
|
| 98 |
+
]
|
| 99 |
+
}
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
Notebookta gösterilen ilk eğitim örneğinde kullanıcı, Çin ve ABD arasındaki
|
| 103 |
+
ticaret savaşını konu alan bir X gönderisine kısa reply ister. Hedef cevap:
|
| 104 |
+
|
| 105 |
+
> @ProfDemirtas Valla bi şekilde biz görürüz gibi geliyor ya
|
| 106 |
+
|
| 107 |
+
Bu örnek datasetin resmi olmayan, kısa ve sosyal medya bağlamına özgü üslubunu
|
| 108 |
+
gösterir.
|
| 109 |
+
|
| 110 |
+
### Veri istatistikleri
|
| 111 |
+
|
| 112 |
+
Yerel olarak saklanan ve Hugging Face'e yüklenen nihai Parquet dosyaları üzerinde
|
| 113 |
+
hesaplanan mesaj uzunluğu istatistikleri:
|
| 114 |
+
|
| 115 |
+
| Split | Alan | Ortalama karakter | Medyan karakter | Min–maks karakter | Ortalama kelime | Medyan kelime |
|
| 116 |
+
|---|---|---:|---:|---:|---:|---:|
|
| 117 |
+
| Train | User prompt | 316,37 | 342 | 101–419 | 44,28 | 48 |
|
| 118 |
+
| Train | Reply | 140,01 | 111 | 19–350 | 18,63 | 15 |
|
| 119 |
+
| Validation | User prompt | 330,44 | 391 | 122–419 | 45,49 | 50 |
|
| 120 |
+
| Validation | Reply | 160,19 | 160,5 | 31–350 | 21,10 | 19 |
|
| 121 |
+
| Test | User prompt | 365,59 | 419 | 141–419 | 49,12 | 52 |
|
| 122 |
+
| Test | Reply | 116,45 | 73 | 26–350 | 15,31 | 9 |
|
| 123 |
+
|
| 124 |
+
Ek yüzey özellikleri:
|
| 125 |
+
|
| 126 |
+
| Split | Mention içeren reply | URL içeren reply |
|
| 127 |
+
|---|---:|---:|
|
| 128 |
+
| Train | 743 / 823 (`%90,28`) | 111 / 823 (`%13,49`) |
|
| 129 |
+
| Validation | 113 / 126 (`%89,68`) | 14 / 126 (`%11,11`) |
|
| 130 |
+
| Test | 50 / 51 (`%98,04`) | 10 / 51 (`%19,61`) |
|
| 131 |
+
|
| 132 |
+
Mention oranının yüksek olması modelin `@kullanıcı` biçimini öğrenmesine yardımcı
|
| 133 |
+
olabilir; aynı zamanda modelin gereksiz mention üretme riski bulunduğu için bu
|
| 134 |
+
davranış ayrıca değerlendirilmelidir. URL içeren hedefler de modelin link benzeri
|
| 135 |
+
metin üretmesini teşvik edebilir. Üretimde gerçek dışı kullanıcı adı veya URL
|
| 136 |
+
oluşturmayı engellemek için post-processing ve güvenlik kontrolü gerekir.
|
| 137 |
+
|
| 138 |
+
### Eğitim ortamı
|
| 139 |
+
|
| 140 |
+
Notebook çıktısında kaydedilen ortam:
|
| 141 |
+
|
| 142 |
+
| Bileşen | Değer |
|
| 143 |
+
|---|---|
|
| 144 |
+
| GPU | NVIDIA Tesla T4 |
|
| 145 |
+
| GPU sayısı | 1 |
|
| 146 |
+
| Toplam GPU belleği | 14.563 GB |
|
| 147 |
+
| Platform | Linux / Google Colab |
|
| 148 |
+
| Unsloth | 2026.7.4 |
|
| 149 |
+
| Transformers | 4.56.2 |
|
| 150 |
+
| PyTorch | 2.11.0+cu128 |
|
| 151 |
+
| CUDA Toolkit | 12.8 |
|
| 152 |
+
| Triton | 3.6.0 |
|
| 153 |
+
| Xformers | 0.0.34 |
|
| 154 |
+
| Bfloat16 | Kullanılmadı |
|
| 155 |
+
| Eğitim hassasiyeti | Unsloth tarafından float32'ye geçirildi |
|
| 156 |
+
|
| 157 |
+
Notebook, Unsloth'un `trl`, `transformers` ve `peft` paketlerinden önce import
|
| 158 |
+
edilmesi gerektiğine dair bir uyarı üretmiştir. Eğitim tamamlanmış olsa da tekrar
|
| 159 |
+
çalıştırmada `import unsloth` satırını diğer ilgili importlardan önce çalıştırmak
|
| 160 |
+
performans ve patch tutarlılığı açısından daha güvenlidir.
|
| 161 |
+
|
| 162 |
+
Gemma 3 bu ortamda float16 eğitimle çalışmadığı için Unsloth eğitimi float32'ye
|
| 163 |
+
geçirmiştir. Temel model belleğe 4-bit yüklenmiş, güncelleme LoRA adaptörleri
|
| 164 |
+
üzerinden yapılmıştır.
|
| 165 |
+
|
| 166 |
+
### Model ve LoRA yapılandırması
|
| 167 |
+
|
| 168 |
+
| Parametre | Değer |
|
| 169 |
+
|---|---|
|
| 170 |
+
| Gerçek temel model | `unsloth/gemma-3-1b-it` |
|
| 171 |
+
| Maksimum dizi uzunluğu | 2.048 token |
|
| 172 |
+
| Temel model yükleme | 4-bit |
|
| 173 |
+
| Full fine-tuning | Kapalı |
|
| 174 |
+
| Yöntem | PEFT / LoRA |
|
| 175 |
+
| LoRA rank (`r`) | 8 |
|
| 176 |
+
| LoRA alpha | 8 |
|
| 177 |
+
| LoRA dropout | 0 |
|
| 178 |
+
| Bias | `none` |
|
| 179 |
+
| Vision katmanları | Eğitilmedi |
|
| 180 |
+
| Language katmanları | Eğitildi |
|
| 181 |
+
| Attention modülleri | Eğitildi |
|
| 182 |
+
| MLP modülleri | Eğitildi |
|
| 183 |
+
| Random seed | 3407 |
|
| 184 |
+
| Toplam parametre | 1.006.408.832 |
|
| 185 |
+
| Eğitilebilir parametre | 6.522.880 |
|
| 186 |
+
| Eğitilen oran | `%0,65` |
|
| 187 |
+
|
| 188 |
+
Model parametrelerinin yalnız yaklaşık `%0,65`i güncellenmiştir. Bu yaklaşım,
|
| 189 |
+
tam fine-tuning'e kıyasla eğitilebilir parametre ve adaptör boyutunu azaltır.
|
| 190 |
+
Notebook ayrıca adaptörü yaklaşık 26,1 MB olarak Hub'a göndermiş, ardından
|
| 191 |
+
adaptörleri temel modele birleştirerek yaklaşık 2,00 GB'lık 16-bit model exportu
|
| 192 |
+
hazırlamıştır.
|
| 193 |
+
|
| 194 |
+
### SFT yapılandırması
|
| 195 |
+
|
| 196 |
+
| Parametre | Değer |
|
| 197 |
+
|---|---|
|
| 198 |
+
| Kullanılan train örneği | 823 |
|
| 199 |
+
| Trainer tarafından gösterilen epoch aralığı | 1 |
|
| 200 |
+
| Gerçek tamamlanan örnek oranı | Yaklaşık `0,29 epoch` |
|
| 201 |
+
| Toplam step | 30 |
|
| 202 |
+
| Cihaz başına batch | 2 |
|
| 203 |
+
| Gradient accumulation | 4 |
|
| 204 |
+
| Etkin batch | 8 |
|
| 205 |
+
| Yaklaşık örnek sunumu | 240 |
|
| 206 |
+
| Learning rate | `2e-4` |
|
| 207 |
+
| Warmup | 5 step |
|
| 208 |
+
| Optimizer | `adamw_8bit` |
|
| 209 |
+
| Weight decay | `0.001` |
|
| 210 |
+
| LR scheduler | Linear |
|
| 211 |
+
| Logging | Her step |
|
| 212 |
+
| Eval dataset | Yok |
|
| 213 |
+
| Chat template | Gemma 3 |
|
| 214 |
+
| Loss kapsamı | Yalnız assistant reply'ları |
|
| 215 |
+
|
| 216 |
+
30 step × etkin batch 8 = yaklaşık 240 örnek sunumu eder. 240 / 823 ≈ `0,292`
|
| 217 |
+
olduğu için eğitim tüm train datasetini bir kez dolaşmamıştır. Trainer “Num
|
| 218 |
+
Epochs = 1” yazsa da progress widgetın `Epoch 0/1` göstermesi ve hesaplanan oran,
|
| 219 |
+
çalıştırmanın yaklaşık `%29`luk bir epoch olduğunu doğrular.
|
| 220 |
+
|
| 221 |
+
Notebook açıklamasında şablondan kalan “60 steps” ifadesi bulunur; fakat gerçek
|
| 222 |
+
`SFTConfig`, trainer logu ve loss tablosu `max_steps=30` olduğunu açıkça gösterir.
|
| 223 |
+
Bu raporda gerçek çalıştırma olan 30 step esas alınmıştır.
|
| 224 |
+
|
| 225 |
+
`train_on_responses_only`, user/instruction tokenlarını `-100` ile maskeleyerek
|
| 226 |
+
loss hesabını yalnız assistant reply tokenlarına uygulamıştır.
|
| 227 |
+
|
| 228 |
+
### Training loss
|
| 229 |
+
|
| 230 |
+

|
| 231 |
+
|
| 232 |
+
| Step | Loss | Step | Loss | Step | Loss |
|
| 233 |
+
|---:|---:|---:|---:|---:|---:|
|
| 234 |
+
| 1 | 7.6616 | 11 | 4.4814 | 21 | 5.1123 |
|
| 235 |
+
| 2 | 7.0608 | 12 | 4.7906 | 22 | 4.5131 |
|
| 236 |
+
| 3 | 7.2619 | 13 | 4.8918 | 23 | 4.6284 |
|
| 237 |
+
| 4 | 6.7793 | 14 | 5.3079 | 24 | 5.0723 |
|
| 238 |
+
| 5 | 5.6427 | 15 | 4.8563 | 25 | 4.8645 |
|
| 239 |
+
| 6 | 6.2805 | 16 | 4.6873 | 26 | 4.7345 |
|
| 240 |
+
| 7 | 5.7062 | 17 | 4.6974 | 27 | 5.0140 |
|
| 241 |
+
| 8 | 5.2605 | 18 | 4.7686 | 28 | 5.2000 |
|
| 242 |
+
| 9 | 4.8390 | 19 | 4.6959 | 29 | **4.4656** |
|
| 243 |
+
| 10 | 5.5344 | 20 | 4.7131 | 30 | 4.7589 |
|
| 244 |
+
|
| 245 |
+
Özet:
|
| 246 |
+
|
| 247 |
+
| Metrik | Değer |
|
| 248 |
+
|---|---:|
|
| 249 |
+
| İlk step loss | 7.6616 |
|
| 250 |
+
| Son step loss | 4.7589 |
|
| 251 |
+
| İlk–son düşüş | `%37,89` |
|
| 252 |
+
| İlk 5 step ortalaması | 6.8813 |
|
| 253 |
+
| Son 5 step ortalaması | 4.8346 |
|
| 254 |
+
| İlk 5 / son 5 ortalama düşüşü | `%29,74` |
|
| 255 |
+
| Minimum loss | 4.4656 — step 29 |
|
| 256 |
+
| 30 step ortalaması | 5.2760 |
|
| 257 |
+
|
| 258 |
+
Loss ilk 10 stepte hızlı biçimde düşmüş, sonraki bölümde yaklaşık `4,5–5,2`
|
| 259 |
+
bandına yerleşmiştir. Son step ilk stepten `%37,89`, son beş step ortalaması ise
|
| 260 |
+
ilk beş ortalamasından `%29,74` daha düşüktür. Bu, yalnız train datası açısından
|
| 261 |
+
optimizerın reply hedeflerine uyum sağlamaya başladığını gösteren olumlu bir
|
| 262 |
+
sinyaldir.
|
| 263 |
+
|
| 264 |
+
Eğri monoton değildir ve son bölümde belirgin dalgalanma sürer. Üstelik eğitim
|
| 265 |
+
train splitinin yalnız yaklaşık `%29`una karşılık gelen örnek sunumuyla
|
| 266 |
+
sonlanmıştır. Bu nedenle loss platosunun kalıcı olup olmadığı veya daha fazla
|
| 267 |
+
stepte iyileşmenin sürüp sürmeyeceği bu çalışmadan belirlenemez.
|
| 268 |
+
|
| 269 |
+
Validation ve test splitleri eğitim datasında mevcut olduğu halde trainer'a
|
| 270 |
+
bağlanmadığı için validation loss, perplexity veya reply kalite metriği yoktur.
|
| 271 |
+
Training loss düşüşü tek başına görülmemiş gönderilere daha iyi reply üretildiğini
|
| 272 |
+
kanıtlamaz.
|
| 273 |
+
|
| 274 |
+
### Süre ve GPU belleği
|
| 275 |
+
|
| 276 |
+
| Metrik | Değer |
|
| 277 |
+
|---|---:|
|
| 278 |
+
| Trainer tarafından raporlanan süre | 359.0106 saniye |
|
| 279 |
+
| Dakika | 5.98 dakika |
|
| 280 |
+
| Başlangıçta ayrılmış bellek | 1.512 GB |
|
| 281 |
+
| Peak reserved memory | 1.869 GB |
|
| 282 |
+
| Eğitim/LoRA için ek reserved memory | 0.357 GB |
|
| 283 |
+
| Peak / toplam GPU belleği | `%12,834` |
|
| 284 |
+
| Ek eğitim belleği / toplam | `%2,451` |
|
| 285 |
+
|
| 286 |
+
Progress widget `30/30 02:56` gösterirken `trainer_stats` toplam süreyi 359.0106
|
| 287 |
+
saniye olarak raporlar. Bu raporda resmi toplam süre olarak trainer metriği
|
| 288 |
+
kullanılmıştır; widget yalnız step döngüsünün farklı bir bölümünü ölçüyor olabilir.
|
| 289 |
+
|
| 290 |
+
### Eğitim sonrası cevaplar
|
| 291 |
+
|
| 292 |
+
Notebookta üç genel amaçlı inference örneği kaydedilmiştir. Önemli sınırlama:
|
| 293 |
+
**eğitim sonrası gerçek bir Türkçe X reply promptu çalıştırılmamıştır.** Bu nedenle
|
| 294 |
+
notebook çıktılarından modelin ana hedef olan reply kalitesini doğrudan ölçmek
|
| 295 |
+
mümkün değildir.
|
| 296 |
+
|
| 297 |
+
#### 1. Fibonacci dizisi
|
| 298 |
+
|
| 299 |
+
Prompt:
|
| 300 |
+
|
| 301 |
+
```text
|
| 302 |
+
Continue the sequence: 1, 1, 2, 3, 5, 8,
|
| 303 |
+
```
|
| 304 |
+
|
| 305 |
+
Model cevabı:
|
| 306 |
+
|
| 307 |
+
> The sequence is the Fibonacci sequence. So the next numbers in the sequence
|
| 308 |
+
> are: 13, 21, 34, 55, 89, 144...
|
| 309 |
+
|
| 310 |
+
Cevap doğrudur. Kısa fine-tuning sonrasında temel örüntü tamamlama ve genel bilgi
|
| 311 |
+
yeteneğinin korunduğuna dair olumlu fakat tek örneklik bir sinyaldir.
|
| 312 |
+
|
| 313 |
+
#### 2. Gökyüzü neden mavidir?
|
| 314 |
+
|
| 315 |
+
Prompt:
|
| 316 |
+
|
| 317 |
+
```text
|
| 318 |
+
Why is the sky blue?
|
| 319 |
+
```
|
| 320 |
+
|
| 321 |
+
Kaydedilen cevap:
|
| 322 |
+
|
| 323 |
+
> Okay, let's break down why the sky is blue! It's a fascinating phenomenon that
|
| 324 |
+
> boils down to a combination of physics and light. Here's the explanation:
|
| 325 |
+
> **1. Sunlight and its Colors:** Sunlight, which appears white to us, is
|
| 326 |
+
> actually made up of all the...
|
| 327 |
+
|
| 328 |
+
Cevap fizik ve ışık açıklamasına doğru yönde başlamıştır; ancak
|
| 329 |
+
`max_new_tokens=64` sınırında tamamlanmamıştır. Bu çıktı reply fine-tuning
|
| 330 |
+
kalitesini değil, genel İngilizce açıklama davranışının tamamen kaybolmadığını
|
| 331 |
+
gösterir.
|
| 332 |
+
|
| 333 |
+
#### 3. Gemma 3 nedir?
|
| 334 |
+
|
| 335 |
+
Prompt:
|
| 336 |
+
|
| 337 |
+
```text
|
| 338 |
+
What is Gemma-3?
|
| 339 |
+
```
|
| 340 |
+
|
| 341 |
+
Model Gemma 3'ü açık ağırlıklı bir dil modeli ailesi olarak açıklamaya doğru
|
| 342 |
+
başlamış, fakat cevap yine 64 yeni token sınırında kesilmiştir. Tek örnekle
|
| 343 |
+
olgusal doğruluk veya catastrophic forgetting ölçülemez.
|
| 344 |
+
|
| 345 |
+
### Sonuç
|
| 346 |
+
|
| 347 |
+
Teknik eğitim akışı başarıyla tamamlanmıştır:
|
| 348 |
+
|
| 349 |
+
- 30/30 step çalışmıştır.
|
| 350 |
+
- Loss genel olarak belirgin biçimde düşmüştür.
|
| 351 |
+
- Yalnız `%0,65` parametre LoRA üzerinden eğitilmiştir.
|
| 352 |
+
- Peak reserved GPU belleği toplam T4 belleğinin `%12,834`ünde kalmıştır.
|
| 353 |
+
- Fibonacci örneği doğru cevaplanmıştır.
|
| 354 |
+
- Adaptör ve birleştirilmiş 16-bit model Hugging Face'e gönderilmiştir.
|
| 355 |
+
|
| 356 |
+
Bu sonuçlar, düşük maliyetli kısa bir LoRA koşusunun train reply hedeflerine uyum
|
| 357 |
+
sağlamaya başladığını ve temel genel yeteneklerin en azından örneklenen sorularda
|
| 358 |
+
korunduğunu gösteren olumlu sinyallerdir. Buna karşın gerçek bir X-reply inference
|
| 359 |
+
testi ve eval metriği olmadığı için modelin hedef davranışta ne kadar geliştiği
|
| 360 |
+
henüz gösterilmemiştir. Bu bir başarısızlık değil, **teknik pipeline'ı ve öğrenme
|
| 361 |
+
sinyalini doğrulayan ilk deneydir**; bir sonraki aşama hedef-domain evaluation
|
| 362 |
+
olmalıdır.
|
| 363 |
+
|
| 364 |
+
### Önerilen sonraki deney
|
| 365 |
+
|
| 366 |
+
1. Mevcut 126 validation ve 51 test örneğini gerçekten kullanmak.
|
| 367 |
+
2. Base model ve fine-tuned modeli aynı 30–50 Türkçe X gönderisinde kör biçimde
|
| 368 |
+
karşılaştırmak.
|
| 369 |
+
3. Bağlam uygunluğu, doğal Türkçe, kısalık, özgünlük, toxicity ve spam için insan
|
| 370 |
+
veya LLM-as-judge rubriği oluşturmak.
|
| 371 |
+
4. Mention doğruluğu ve uydurma kullanıcı adı oranını ayrı ölçmek.
|
| 372 |
+
5. Gerçek dışı URL üretimini kontrol eden bir metrik eklemek.
|
| 373 |
+
6. Temperature etkisini ayırmak için greedy/low-temperature ve sampling
|
| 374 |
+
sonuçlarını birlikte raporlamak.
|
| 375 |
+
7. Validation loss izlemeden learning rate veya step sayısını artırmamak.
|
| 376 |
+
8. Tam epoch, daha düşük learning rate ve farklı LoRA rank değerleriyle küçük
|
| 377 |
+
ablation deneyleri yapmak.
|
| 378 |
+
9. Reply promptlarını inference notebookuna eklemek ve çıktıları kaydetmek.
|
| 379 |
+
|
| 380 |
+
### Güvenlik ve kullanım sınırlamaları
|
| 381 |
+
|
| 382 |
+
- Dataset gerçek sosyal medya metinlerinden türetilmiştir; telif, platform
|
| 383 |
+
koşulları, yeniden dağıtım ve model eğitimi izinleri kullanım senaryosuna göre
|
| 384 |
+
ayrıca değerlendirilmelidir.
|
| 385 |
+
- Model kullanıcı adı, URL, iddia veya kişisel bilgi uydurabilir.
|
| 386 |
+
- Model taciz, hedefleme, taklit, spam veya manipülatif etkileşim üretmek için
|
| 387 |
+
kullanılmamalıdır.
|
| 388 |
+
- Üretim çıktıları yayımlanmadan önce toxicity, gizlilik, doğruluk ve insan
|
| 389 |
+
denetiminden geçirilmelidir.
|
| 390 |
+
- Notebookta gerçek Hugging Face tokenı tutulmaz; credentiallar environment
|
| 391 |
+
variable veya Colab Secrets üzerinden sağlanmalıdır.
|
| 392 |
+
|
| 393 |
+
---
|
| 394 |
+
|
| 395 |
+
## English
|
| 396 |
+
|
| 397 |
+
### Objective
|
| 398 |
+
|
| 399 |
+
This experiment adapts the general-purpose Gemma 3 1B Instruct model to the
|
| 400 |
+
style of short Turkish X replies. The intended behavior is to respond directly
|
| 401 |
+
to the context of a parent post, use natural and concise Turkish, and preserve
|
| 402 |
+
the distinction between reply and quote-post behavior. It does not promise
|
| 403 |
+
virality or engagement.
|
| 404 |
+
|
| 405 |
+
### Dataset
|
| 406 |
+
|
| 407 |
+
The source is
|
| 408 |
+
[`berkbirkan/turkish-x-engagement-replies`](https://huggingface.co/datasets/berkbirkan/turkish-x-engagement-replies),
|
| 409 |
+
with 823 train, 126 validation, and 51 test examples. Every row contains one
|
| 410 |
+
two-turn `messages` conversation: the user asks for a contextually appropriate
|
| 411 |
+
reply to a parent X post, and the assistant message contains the selected reply.
|
| 412 |
+
|
| 413 |
+
Only the 823-example train split was loaded by the notebook. Although validation
|
| 414 |
+
and test data exist, `eval_dataset=None` was used, so this run has no validation
|
| 415 |
+
loss or test-quality metric.
|
| 416 |
+
|
| 417 |
+
Train replies average 140.01 characters and 18.63 words; their median is 111
|
| 418 |
+
characters and 15 words. 743 of 823 train replies (90.28%) contain an `@mention`,
|
| 419 |
+
and 111 (13.49%) contain a URL. These patterns are relevant to the target style
|
| 420 |
+
but also create risks of unnecessary mentions and fabricated handles or links.
|
| 421 |
+
|
| 422 |
+
### Training configuration
|
| 423 |
+
|
| 424 |
+
| Component | Value |
|
| 425 |
+
|---|---|
|
| 426 |
+
| Actual base model | `unsloth/gemma-3-1b-it` |
|
| 427 |
+
| Framework | Unsloth 2026.7.4 / TRL SFTTrainer |
|
| 428 |
+
| GPU | 1× NVIDIA Tesla T4, 14.563 GB |
|
| 429 |
+
| Maximum sequence length | 2,048 tokens |
|
| 430 |
+
| Base-model loading | 4-bit |
|
| 431 |
+
| Training precision | Switched to float32 by Unsloth |
|
| 432 |
+
| Method | PEFT / LoRA |
|
| 433 |
+
| LoRA rank / alpha / dropout | 8 / 8 / 0 |
|
| 434 |
+
| Tuned modules | Language, attention, and MLP |
|
| 435 |
+
| Vision layers | Disabled |
|
| 436 |
+
| Trainable parameters | 6,522,880 / 1,006,408,832 |
|
| 437 |
+
| Trainable ratio | 0.65% |
|
| 438 |
+
| Available train examples | 823 |
|
| 439 |
+
| Steps / effective batch | 30 / 8 |
|
| 440 |
+
| Approximate example presentations | 240 |
|
| 441 |
+
| Effective completed epoch fraction | About 0.29 |
|
| 442 |
+
| Learning rate | `2e-4` |
|
| 443 |
+
| Warmup | 5 steps |
|
| 444 |
+
| Optimizer | `adamw_8bit` |
|
| 445 |
+
| Weight decay | `0.001` |
|
| 446 |
+
| Scheduler | Linear |
|
| 447 |
+
| Loss masking | Assistant replies only |
|
| 448 |
+
| Evaluation dataset | None |
|
| 449 |
+
|
| 450 |
+
The trainer banner displays one epoch because the step-limited run falls within
|
| 451 |
+
the first epoch. In practice, 30 steps × effective batch 8 = about 240 example
|
| 452 |
+
presentations, or 240 / 823 ≈ 0.292 of the training split. The progress widget
|
| 453 |
+
accordingly reports `Epoch 0/1`.
|
| 454 |
+
|
| 455 |
+
A template markdown cell still says “60 steps,” but the executed `SFTConfig`,
|
| 456 |
+
trainer output, and loss table all show `max_steps=30`; 30 is authoritative.
|
| 457 |
+
|
| 458 |
+
The Gemma 3 chat template was applied, and `train_on_responses_only` masked user
|
| 459 |
+
tokens so that loss was calculated only over assistant replies.
|
| 460 |
+
|
| 461 |
+
### Training-loss analysis
|
| 462 |
+
|
| 463 |
+

|
| 464 |
+
|
| 465 |
+
| Metric | Value |
|
| 466 |
+
|---|---:|
|
| 467 |
+
| Step 1 loss | 7.6616 |
|
| 468 |
+
| Step 30 loss | 4.7589 |
|
| 469 |
+
| First-to-last decrease | 37.89% |
|
| 470 |
+
| Mean of first 5 steps | 6.8813 |
|
| 471 |
+
| Mean of last 5 steps | 4.8346 |
|
| 472 |
+
| First-5 to last-5 decrease | 29.74% |
|
| 473 |
+
| Minimum loss | 4.4656 at step 29 |
|
| 474 |
+
| Mean across all 30 steps | 5.2760 |
|
| 475 |
+
|
| 476 |
+
Loss dropped rapidly during the first ten steps and then fluctuated mainly in
|
| 477 |
+
the 4.5–5.2 range. The final loss is 37.89% below the first step, while the last
|
| 478 |
+
five-step mean is 29.74% below the first five-step mean. This is a positive
|
| 479 |
+
training-only signal that optimization began adapting to the reply targets.
|
| 480 |
+
|
| 481 |
+
It does not establish out-of-sample reply quality. Only about 29% of one epoch
|
| 482 |
+
was completed, the late-stage curve remains noisy, and no validation loss was
|
| 483 |
+
recorded.
|
| 484 |
+
|
| 485 |
+
### Runtime and memory
|
| 486 |
+
|
| 487 |
+
| Metric | Value |
|
| 488 |
+
|---|---:|
|
| 489 |
+
| Trainer-reported runtime | 359.0106 seconds |
|
| 490 |
+
| Runtime in minutes | 5.98 minutes |
|
| 491 |
+
| Initial reserved memory | 1.512 GB |
|
| 492 |
+
| Peak reserved memory | 1.869 GB |
|
| 493 |
+
| Additional reserved training memory | 0.357 GB |
|
| 494 |
+
| Peak / total GPU memory | 12.834% |
|
| 495 |
+
| Additional training memory / total | 2.451% |
|
| 496 |
+
|
| 497 |
+
The progress widget displayed `30/30 02:56`, whereas `trainer_stats` reported
|
| 498 |
+
359.0106 seconds. This report uses the trainer metric as the official total
|
| 499 |
+
runtime; the widget may represent only a narrower portion of the step loop.
|
| 500 |
+
|
| 501 |
+
### Post-training responses
|
| 502 |
+
|
| 503 |
+
The notebook records three general-purpose prompts but **does not run an actual
|
| 504 |
+
Turkish X reply inference prompt after training**. Therefore, its outputs cannot
|
| 505 |
+
directly establish improvement on the target task.
|
| 506 |
+
|
| 507 |
+
#### Fibonacci sequence
|
| 508 |
+
|
| 509 |
+
For `Continue the sequence: 1, 1, 2, 3, 5, 8,`, the model correctly identified
|
| 510 |
+
the Fibonacci sequence and continued with `13, 21, 34, 55, 89, 144`. This is a
|
| 511 |
+
small positive signal that a basic general capability remained intact.
|
| 512 |
+
|
| 513 |
+
#### Why is the sky blue?
|
| 514 |
+
|
| 515 |
+
The answer started in a scientifically relevant direction by discussing
|
| 516 |
+
sunlight, colors, physics, and light, but was truncated at the 64-new-token
|
| 517 |
+
limit. This tests retained general English explanation behavior rather than X
|
| 518 |
+
reply quality.
|
| 519 |
+
|
| 520 |
+
#### What is Gemma-3?
|
| 521 |
+
|
| 522 |
+
The model began a plausible explanation of Gemma 3 as an open-weight model
|
| 523 |
+
family, again truncated at 64 new tokens. One sample is insufficient to evaluate
|
| 524 |
+
factual accuracy or catastrophic forgetting.
|
| 525 |
+
|
| 526 |
+
### Conclusion
|
| 527 |
+
|
| 528 |
+
The technical pipeline completed successfully: all 30 steps ran, training loss
|
| 529 |
+
decreased substantially, only 0.65% of parameters were updated, peak reserved
|
| 530 |
+
memory stayed at 12.834% of the T4 capacity, and the Fibonacci example remained
|
| 531 |
+
correct. The adapter and merged 16-bit model were uploaded to Hugging Face.
|
| 532 |
+
|
| 533 |
+
These are encouraging signs for a short, resource-efficient LoRA run. However,
|
| 534 |
+
because no domain-specific reply inference and no evaluation metrics were
|
| 535 |
+
recorded, the improvement on real Turkish X reply generation remains unproven.
|
| 536 |
+
This should be treated as a **successful pipeline and learning-signal
|
| 537 |
+
experiment**, followed by a target-domain evaluation phase.
|
| 538 |
+
|
| 539 |
+
### Recommended next experiment
|
| 540 |
+
|
| 541 |
+
1. Use the existing 126-example validation and 51-example test splits.
|
| 542 |
+
2. Compare the base and fine-tuned models blindly on the same 30–50 Turkish X
|
| 543 |
+
posts.
|
| 544 |
+
3. Score context relevance, natural Turkish, brevity, originality, toxicity,
|
| 545 |
+
and spam risk.
|
| 546 |
+
4. Measure mention accuracy and fabricated-handle rate.
|
| 547 |
+
5. Measure fabricated or invalid URL generation.
|
| 548 |
+
6. Compare greedy/low-temperature decoding with sampling.
|
| 549 |
+
7. Do not increase steps or learning rate without validation-loss monitoring.
|
| 550 |
+
8. Run small ablations over full-epoch training, learning rate, and LoRA rank.
|
| 551 |
+
9. Add and save real reply-generation prompts in the inference section.
|
| 552 |
+
|
| 553 |
+
### Safety and limitations
|
| 554 |
|
| 555 |
+
- The source contains real social-media text; users must independently evaluate
|
| 556 |
+
platform terms, copyright, redistribution, privacy, and training permissions.
|
| 557 |
+
- The model may fabricate handles, URLs, claims, or personal information.
|
| 558 |
+
- Do not use it for harassment, impersonation, spam, targeting, or manipulative
|
| 559 |
+
engagement.
|
| 560 |
+
- Apply toxicity, privacy, factuality, and human-review checks before publishing
|
| 561 |
+
generated replies.
|
| 562 |
+
- Keep Hugging Face credentials in environment variables or Colab Secrets,
|
| 563 |
+
never in notebook cells, outputs, or Git history.
|
| 564 |
|
| 565 |
+
## Reproduction
|
| 566 |
|
| 567 |
+
Open the notebook in a Tesla T4 Google Colab runtime and run the cells in order.
|
| 568 |
+
Import Unsloth before TRL/Transformers/PEFT, configure Hugging Face credentials
|
| 569 |
+
through Colab Secrets or environment variables, and add target-domain inference
|
| 570 |
+
and evaluation cells before treating the model as production-ready.
|