LaminarNet 437M Turkish Base
LaminarNet 437M, 3 Strata (Hiyerarşik Akış) mimarisi kullanılarak sıfırdan eğitilmiş, Türkçe diline optimize edilmiş bir taban (base) dil modelidir. Bu model, klasik Transformer mimarilerinden farklı olarak hiyerarşik bir yapı kullanarak hem hızı hem de bağlam yakalama yeteneğini optimize eder.
Model Detayları
- Geliştirici: Uunan
- Parametre Sayısı: ~437.6 Milyon Parametre
- Mimari: LaminarNet (v0.7.11) - 3 Strata, 8 Layers, 12 Heads
- Eğitim Verisi: ~9.56 Milyar Token (VNGRS Web Corpus)
- Tokenizasyon:
google/mt5-base(250,100 Vocab Size)
Önemli Not
Bu model LaminarNet mimariiyle eğitilmiş bir Base Model'dir. Bir chatbot gibi talimatları yerine getirmek yerine, verilen metni en mantıklı şekilde tamamlamaya odaklanır. En yüksek performans için girdi sonundaki EOS token'ın temizlenmesi önerilir.
Eğitim Süreci
Aşağıdaki grafik, LaminarNet 437M modelinin VNGRS Web Corpus (~9.56 milyar token) üzerinde yapılan ön eğitim sırasında kayıp (loss) değerinin zaman içindeki değişimini göstermektedir.
Kullanım (Inference)
Modeli kullanmak için laminarnet kütüphanesinin kurulu olması gerekmektedir:
pip install laminarnet
import torch
import torch.nn.functional as F
from transformers import AutoTokenizer
from huggingface_hub import hf_hub_download
from laminarnet import LaminarNet, LaminarNetConfig
# 1. Ayarlar
REPO_ID = "Uunan/LaminarNet_437M_Turkish_Base"
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
print("🔤 Tokenizer ve Model yükleniyor...")
tokenizer = AutoTokenizer.from_pretrained("google/mt5-base")
# 2. Mimari Konfigürasyonu
config = LaminarNetConfig(
vocab_size = tokenizer.vocab_size,
d_model = 768,
n_heads = 12,
n_layers = 8,
d_ff = 3072,
n_strata = 3,
strata_ratios = (1, 2, 4),
seq_len = 2048
)
model = LaminarNet(config).to(DEVICE)
# 3. Ağırlıkları Hugging Face'den Çek ve Yükle
model_path = hf_hub_download(repo_id=REPO_ID, filename="pytorch_model.bin")
checkpoint = torch.load(model_path, map_location=DEVICE, weights_only=False)
model.load_state_dict(checkpoint['model'])
model.eval()
print(f"✅ Model hazır!")
# 4. Optimize Metin Üretme Fonksiyonu
def generate_text(prompt, max_new_tokens=50, temperature=0.75, top_k=40):
input_ids = tokenizer.encode(prompt, return_tensors="pt").to(DEVICE)
# mt5 tokenizer sonuna otomatik EOS ekler, bağlamın sürmesi için siliyoruz
if input_ids[0, -1].item() == tokenizer.eos_token_id:
input_ids = input_ids[:, :-1]
with torch.no_grad():
with torch.amp.autocast('cuda') if torch.cuda.is_available() else torch.inference_mode():
for _ in range(max_new_tokens):
logits = model(input_ids)
next_token_logits = logits[0, -1, :] / temperature
if top_k > 0:
indices_to_remove = next_token_logits < torch.topk(next_token_logits, top_k)[0][..., -1, None]
next_token_logits[indices_to_remove] = -float('Inf')
probs = F.softmax(next_token_logits, dim=-1)
next_token = torch.multinomial(probs, num_samples=1).unsqueeze(0)
input_ids = torch.cat([input_ids, next_token], dim=1)
if next_token.item() == tokenizer.eos_token_id:
break
return tokenizer.decode(input_ids[0], skip_special_tokens=True)
# Örnek Kullanım
prompt = "Yapay zeka ve makine öğrenmesi arasındaki temel fark"
print(f"🚀 Çıktı: {generate_text(prompt)}")
Paper
The architecture behind this model is described in the following paper:
LaminarNet: Linear-Time Multi-Scale State Propagation for Efficient Language Modeling
Zenodo Preprint
https://zenodo.org/records/19098762
HAL Preprint
https://hal.science/hal-05544646
If you use this model, please cite:
@article{colak2026laminarnet,
title = {LaminarNet: Linear-Time Multi-Scale State Propagation for Efficient Language Modeling},
author = {Colak, Ugurhan},
year = {2026},
journal = {HAL Preprint},
url = {https://hal.science/hal-05544646}
}
