Lyon28 / caca-250m

huggingface.co
Total runs: 40
24-hour runs: 0
7-day runs: 40
30-day runs: 40
Model's Last Updated: December 09 2025
text-generation

Introduction of caca-250m

Model Details of caca-250m

caca-250M

๐Ÿค– CACA-250M

Tiny/Small - Arsitektur Transformer Modern

Hugging Face License PyPI GitHub Stars



๐Ÿ”ฌ RESEARCH PROJECT

Arsitektur Transformer Modern dengan GQA, RoPE, SwiGLU & Flash Attention

โš ๏ธ PERHATIAN: MODEL BELUM DI-TRAIN

Model ini memiliki bobot random dan memerlukan pretraining sebelum digunakan.

  • โŒ Tidak bisa langsung digunakan untuk inference
  • โš ๏ธ Ini adalah eksperimen arsitektur, belum divalidasi untuk production
  • ๐Ÿ“š Cocok untuk penelitian, pembelajaran, dan custom pretraining
  • โœ… Siap untuk training dengan data Anda sendiri

๐Ÿ“Š Spesifikasi Model
๐Ÿ”ข Total Parameters 257,081,216 (0.26B)
๐Ÿ’พ Memory (FP16) ~0.5 GB
๐Ÿ’พ Memory (FP32) ~1.0 GB
๐Ÿ“ Context Length 8,192 tokens
๐ŸชŸ Sliding Window 2,048 tokens
๐ŸŽฏ Use Case Eksperimen cepat, edge devices, pembelajaran
๐Ÿ–ฅ๏ธ Recommended GPU GTX 1060+ / RTX 2060+

๐ŸŽฏ Fitur Utama

Arsitektur Caca menggabungkan teknik-teknik modern terbaik dari berbagai model state-of-the-art:

Fitur Deskripsi Manfaat
๐Ÿ”„ Grouped Query Attention Ratio 7:1 (Query:KV) Inference 2-3x lebih cepat, KV cache lebih kecil
๐ŸŒ€ RoPE Embeddings ฮธ = 10,000.0 Extrapolasi lebih baik untuk sequence panjang
โšก SwiGLU Activation Gated activation function Performa superior dalam language modeling
๐Ÿ“Š RMSNorm ฮต = 1e-06 Normalisasi lebih efisien dan stabil
๐ŸชŸ Sliding Window Window = 2,048 tokens Efisiensi memori untuk context panjang
๐Ÿ’ซ Flash Attention Opsional dengan auto-fallback 2-4x speedup jika tersedia
๐Ÿ”„ KV Cache Built-in support Efficient autoregressive generation

๐Ÿš€ Quick Start
๐Ÿ’ป Instalasi
# Install library utama
pip install caca-transformers

# Dengan xFormers untuk 3x speedup (recommended)
pip install caca-transformers[xformers]

# Atau install dari source
git clone https://github.com/Lyon-28/caca-transformers
cd caca-transformers
pip install -e .
โšก Optimisasi Performance

Model mendukung berbagai optimization backends dengan auto-fallback :

Method Speedup Instalasi Recommended
Flash Attention 4x Sulit (perlu CUDA, nvcc) โญโญโญ
xFormers 3x pip install xformers โญโญโญ
PyTorch SDPA 2x Built-in (PyTorch 2.0+) โญโญ
Standard 1x Built-in โญ

Model akan otomatis memilih backend terbaik yang tersedia.

# Minimum (2x speedup)
pip install torch>=2.0.0

# Recommended (3x speedup) โญ
pip install xformers

# Maximum (4x speedup) - opsional
pip install flash-attn --no-build-isolation
๐Ÿงช Test Cepat (Tanpa Training)
from caca_transformers import CacaForCausalLM
import torch

# Load model
model = CacaForCausalLM.from_pretrained("Lyon28/caca-250m").eval()

# Test forward pass
input_ids = torch.randint(0, 50000, (2, 128))
with torch.no_grad():
    outputs = model(input_ids)
    
print(f"โœ… Output shape: {outputs['logits'].shape}")
print(f"โœ… Model berfungsi! Siap untuk training.")

# Test KV cache
with torch.no_grad():
    outputs = model(input_ids, use_cache=True)
    past_kv = outputs['past_key_values']
    print(f"โœ… KV cache: {len(past_kv)} layers")

โš ๏ธ Common Errors & Solutions
๐Ÿ” Input Validation

Model melakukan validasi ketat pada input untuk mencegah error yang sulit di-debug:

โŒ ERROR: Input IDs Negatif
# โŒ SALAH
input_ids = torch.tensor([[1, 2, -1, 4]])
model(input_ids)
# โœ… BENAR
input_ids = torch.tensor([[1, 2, 3, 4]])
model(input_ids)
Error Message:
ValueError: input_ids mengandung nilai negatif: -1
โŒ ERROR: Input IDs >= vocab_size
# โŒ SALAH
input_ids = torch.tensor([[1, 2, 999999]])
model(input_ids)
# โœ… BENAR
# Pastikan < vocab_size
input_ids = torch.tensor([[1, 2, 50000]])
model(input_ids)
Error Message:
ValueError: input_ids mengandung nilai >= vocab_size. Max value: 999999, vocab_size: 100,000
โŒ ERROR: Wrong Dtype
# โŒ SALAH - float dtype
input_ids = torch.tensor([[1.0, 2.0, 3.0]])
model(input_ids)
# โœ… BENAR - integer dtype
input_ids = torch.tensor([[1, 2, 3]], dtype=torch.long)
# Atau
input_ids = input_ids.long()
Error Message:
TypeError: input_ids harus integer dtype, dapat torch.float32. Gunakan input_ids.long() untuk convert.
โš™๏ธ Config Validation

Config juga divalidasi dengan warning untuk suboptimal settings :

โš ๏ธ WARNING: GQA Ratio Terlalu Tinggi
# โš ๏ธ SUBOPTIMAL
config = CacaConfig(
    num_attention_heads=64,
    num_key_value_heads=2,  # Ratio 32:1
)
# โœ… OPTIMAL
config = CacaConfig(
    num_attention_heads=64,
    num_key_value_heads=8,  # Ratio 8:1
)
Warning:
GQA ratio (32:1) sangat tinggi! Recommended maximum: 8:1
โš ๏ธ WARNING: head_dim Terlalu Kecil
# โš ๏ธ SUBOPTIMAL
config = CacaConfig(
    hidden_size=512,
    num_attention_heads=32,  # head_dim = 16
)
# โœ… OPTIMAL
config = CacaConfig(
    hidden_size=2048,
    num_attention_heads=16,  # head_dim = 128
)
Warning:
head_dim (16) sangat kecil! Recommended minimum: 64 (optimal: 128)
โš ๏ธ WARNING: intermediate_size Suboptimal
# โš ๏ธ SUBOPTIMAL
config = CacaConfig(
    hidden_size=2048,
    intermediate_size=4096,  # Terlalu kecil untuk SwiGLU
)
# โœ… OPTIMAL
config = CacaConfig(
    hidden_size=2048,
    intermediate_size=5461,  # ~2.67x hidden_size
)
Warning:
intermediate_size (4096) mungkin terlalu kecil untuk SwiGLU. Recommended: 5461 (โ‰ˆ2.67x hidden_size)
๐Ÿ’ก Helpful Error Messages

Semua error dilengkapi dengan actionable solutions :

# Error dengan solution
config = CacaConfig(
    hidden_size=1000,
    num_attention_heads=16,
)

# ValueError: hidden_size (1000) harus habis dibagi num_attention_heads (16)
# Sisa bagi: 8
# Hint: Gunakan hidden_size yang merupakan kelipatan dari num_attention_heads

โšก Attention Backend (Advanced)
๐Ÿ”„ Automatic Backend Selection

Model secara otomatis memilih backend terbaik yang tersedia dengan fallback chain :

Flash Attention
โšก 4x speedup
โ†’ xFormers
โšก 3x speedup
โ†’ SDPA
โšก 2x speedup
โ†’ Standard
โœ… Always works
๐Ÿ“‹ Fallback Logic
Backend Requirements
1. Flash Attention โœ… HAS_FLASH_ATTN = True
โœ… config.use_flash_attn = True
โœ… attention_mask = None
โœ… GPU device ( cuda )
โœ… dtype float16 atau bfloat16
โœ… Tidak ada previous failure
2. xFormers โœ… HAS_XFORMERS = True
โœ… GPU device ( cuda )
โœ… attention_mask = None
3. SDPA โœ… PyTorch >= 2.0
โœ… torch.backends.cuda.sdp_kernel available
4. Standard โœ… Always available (fallback terakhir)
๐ŸŽ›๏ธ Force Specific Backend
# Force disable Flash Attention
config = CacaConfig(use_flash_attn=False)
model = CacaForCausalLM(config)
# Model akan skip Flash dan langsung ke xFormers/SDPA

# Check backend yang digunakan
import logging
logging.basicConfig(level=logging.INFO)

# Model akan log backend selection saat pertama kali digunakan
dummy_input = torch.randint(0, 1000, (1, 10)).cuda()
_ = model(dummy_input)
# Log: "โœ… Using Flash Attention backend" atau fallback
๐Ÿ“Š Backend Compatibility
Backend CUDA CPU MPS (Mac) Dtype Attention Mask Sliding Window
Flash Attention โœ… โŒ โŒ FP16/BF16 โŒ (None only) โœ… Native
xFormers โœ… โŒ โš ๏ธ Limited All โŒ (None only) โœ… Via mask
SDPA โœ… โœ… โœ… All โœ… โœ… Via mask
Standard โœ… โœ… โœ… All โœ… โœ… Via mask
๐Ÿ”ง Troubleshooting Backend Issues
# Flash Attention gagal dengan error CUDA
# Model akan otomatis fallback dan log warning:
# "โš ๏ธ Flash Attention gagal: <error>, fallback ke backend lain"

# Untuk debug, set logging level:
import logging
logging.basicConfig(level=logging.INFO)

# Model akan log:
# "โœ… Using Flash Attention backend"
# atau
# "โš ๏ธ Fallback to xFormers backend"
# atau
# "โ„น๏ธ Using SDPA backend"
# atau
# "โ„น๏ธ Using Standard attention backend"

๐Ÿ’พ Memory Requirements (Detailed)
๐Ÿ“ Training Memory Formula
Memory = Model_Params ร— Precision_Bytes ร— Training_Overhead

Training_Overhead:
- FP32: 4 bytes ร— 4 (weights + gradients + optimizer states) = 16 bytes/param
- FP16 Mixed: 2 bytes ร— 6 (FP16 + FP32 copy + gradients + optimizer) = 12 bytes/param
- BF16 Mixed: 2 bytes ร— 6 = 12 bytes/param
- 8-bit: ~6 bytes/param (with 8-bit optimizer)

Activations: ~Batch_Size ร— Seq_Length ร— Hidden_Size ร— Num_Layers ร— 8 bytes
๐Ÿงฎ Estimation untuk Model Ini
Component Formula Value
Model Parameters 257,081,216 params 0.26B
Model FP16 257,081,216 ร— 2 bytes 0.5 GB
Training BF16 257,081,216 ร— 12 bytes 3.1 GB
Activations
(batch=4, seq=2048)
4 ร— 2048 ร— 896 ร— 20 ร— 8 1.2 GB
Total Training Model + Optimizer + Activations ~4.3 GB
โœ‚๏ธ Dengan Gradient Checkpointing
Gradient checkpointing mengurangi activation memory ~50-70% tapi menambah compute ~30%
Tanpa Gradient Checkpointing:
Training memory: 4.3 GB
Dengan Gradient Checkpointing:
Training memory: 3.4 GB
Hemat: 0.8 GB
# Enable gradient checkpointing
model.gradient_checkpointing_enable()

# Training dengan GC bisa pakai batch size lebih besar!
๐ŸŽฏ Inference Memory
Component Formula Value
Model (FP16) 257,081,216 ร— 2 bytes 0.5 GB
KV Cache
(batch=1, context=8192)
2 ร— 20 ร— 1 ร— 2 ร— 8192 ร— 64 ร— 2 0.1 GB
Activations
(temporary)
batch ร— seq ร— hidden ร— 2 bytes ~0.1 GB
Total Inference ~0.7 GB
๐Ÿ’ก Tip: GQA mengurangi KV cache 7x dibanding Multi-Head Attention!
MHA KV cache: ~0.6 GB vs GQA: 0.1 GB
๐Ÿ“Š Batch Size Recommendations
GPU VRAM Precision Training BS Inference BS Max Context
RTX 3060 12GB BF16 + GC 1-2 1-4 2K-4K
RTX 3090 24GB BF16 + GC 2-4 4-8 4K-8K
A5000 24GB BF16 + GC 2-4 4-8 4K-8K
A100 40GB 40GB BF16 + GC 4-8 8-16 8K-16K
A100 80GB 80GB BF16 + GC 8-16 16-32 16K-32K

GC = Gradient Checkpointing


๐ŸŽ“ Complete Training Example
๐Ÿ“ฆ 1. Prepare Dataset
from datasets import load_dataset
from transformers import AutoTokenizer

# Load tokenizer (gunakan tokenizer existing)
tokenizer = AutoTokenizer.from_pretrained("gpt2")
tokenizer.pad_token = tokenizer.eos_token

# Load dataset - Indonesian Wikipedia
dataset = load_dataset("wikipedia", "20220301.id")

# Tokenize function
def tokenize_function(examples):
    return tokenizer(
        examples["text"],
        truncation=True,
        max_length=2048,
        padding="max_length",
        return_tensors="pt",
    )

# Tokenize dataset
tokenized_dataset = dataset.map(
    tokenize_function,
    batched=True,
    remove_columns=dataset["train"].column_names,
    desc="Tokenizing dataset",
)

print(f"โœ… Dataset ready: {len(tokenized_dataset['train']):,} samples")
๐Ÿ—๏ธ 2. Initialize Model
from caca_transformers import CacaForCausalLM, CacaConfig

# Create config
config = CacaConfig(
    vocab_size=tokenizer.vocab_size,
    hidden_size=896,
    num_hidden_layers=20,
    num_attention_heads=14,
    num_key_value_heads=2,
    intermediate_size=2432,
    max_position_embeddings=8192,
    sliding_window=2048,
    use_flash_attn=True,  # Auto fallback jika tidak available
)

# Initialize model dengan random weights
model = CacaForCausalLM(config)

# Enable gradient checkpointing untuk hemat memory
model.gradient_checkpointing_enable()

# Model info
print(f"โœ… Model created")
print(f"   Parameters: {model.num_parameters():,}")
print(f"   Size (FP16): {model.num_parameters() * 2 / 1e9:.2f} GB")
print(f"   Architecture: 20 layers, 14 heads")
โš™๏ธ 3. Setup Training
from transformers import Trainer, TrainingArguments, DataCollatorForLanguageModeling

# Data collator untuk causal LM
data_collator = DataCollatorForLanguageModeling(
    tokenizer=tokenizer,
    mlm=False,  # Causal LM, bukan masked LM
)

# Training arguments
training_args = TrainingArguments(
    output_dir="./caca-indo-caca-250m",
    
    # === Training Schedule ===
    num_train_epochs=3,
    per_device_train_batch_size=4,
    gradient_accumulation_steps=32,  # Effective BS = 4 ร— 32 = 128
    
    # === Learning Rate ===
    learning_rate=3e-4,              # Standard untuk pretrain
    lr_scheduler_type="cosine",      # Cosine decay
    warmup_steps=2000,               # 5-10% dari total steps
    
    # === Optimization ===
    bf16=True,                       # Mixed precision (recommended)
    gradient_checkpointing=True,     # Hemat memory
    max_grad_norm=1.0,               # Gradient clipping
    weight_decay=0.1,                # Regularization
    optim="adamw_torch",             # Optimizer
    
    # === Logging & Saving ===
    logging_steps=10,
    logging_first_step=True,
    save_steps=1000,
    save_total_limit=3,              # Keep 3 latest checkpoints
    
    # === Evaluation ===
    evaluation_strategy="steps",
    eval_steps=1000,
    
    # === Performance ===
    dataloader_num_workers=4,
    dataloader_pin_memory=True,
    remove_unused_columns=True,
    
    # === Reporting (optional) ===
    # report_to="wandb",             # Untuk Weights & Biases
    # run_name="caca-caca-250m-pretrain",
)

# Initialize trainer
trainer = Trainer(
    model=model,
    args=training_args,
    train_dataset=tokenized_dataset["train"],
    eval_dataset=tokenized_dataset["validation"],
    data_collator=data_collator,
    tokenizer=tokenizer,
)

print("โœ… Trainer initialized")
print(f"   Total steps: {trainer.state.max_steps:,}")
print(f"   Warmup steps: {training_args.warmup_steps:,}")
print(f"   Effective batch size: {training_args.per_device_train_batch_size * training_args.gradient_accumulation_steps}")
๐Ÿš€ 4. Start Training
# Start training
print("๐Ÿš€ Starting training...")
trainer.train()

# Save final model
print("๐Ÿ’พ Saving final model...")
trainer.save_model("./caca-indo-caca-250m-final")
tokenizer.save_pretrained("./caca-indo-caca-250m-final")

print("โœ… Training complete!")
๐Ÿ“Š 5. Monitor Training
Dengan Weights & Biases
# Install & login
pip install wandb
wandb login
# Di training_args
training_args = TrainingArguments(
    ...
    report_to="wandb",
    run_name="caca-pretrain",
)
Dengan TensorBoard
# Launch TensorBoard
tensorboard --logdir ./caca-indo-caca-250m/runs
# Di training_args
training_args = TrainingArguments(
    ...
    report_to="tensorboard",
)
๐Ÿ”„ 6. Resume Training
# Resume dari checkpoint
trainer.train(resume_from_checkpoint="./caca-indo-caca-250m/checkpoint-1000")

# Atau auto-resume dari last checkpoint
trainer.train(resume_from_checkpoint=True)
โ˜๏ธ 7. Push to Hub
# Login ke Hugging Face
from huggingface_hub import login
login()

# Push model
model.push_to_hub("your-username/caca-indo-caca-250m")
tokenizer.push_to_hub("your-username/caca-indo-caca-250m")

print("โœ… Model uploaded to Hugging Face Hub!")

๐ŸŽจ Text Generation Examples
๐Ÿ”ค Basic Generation
from caca_transformers import CacaForCausalLM
from transformers import AutoTokenizer
import torch

# Load model & tokenizer
model = CacaForCausalLM.from_pretrained("your-username/caca-indo-caca-250m")
tokenizer = AutoTokenizer.from_pretrained("your-username/caca-indo-caca-250m")

model.eval()
model.cuda()

# Prepare input
prompt = "Ibu kota Indonesia adalah"
input_ids = tokenizer(prompt, return_tensors="pt").input_ids.cuda()

# Generate
with torch.no_grad():
    outputs = model.generate(
        input_ids,
        max_length=100,
        temperature=0.7,
        top_p=0.9,
        do_sample=True,
        use_cache=True,  # KV cache untuk speedup
    )

# Decode
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(generated_text)
๐ŸŽฏ Advanced Generation Parameters
Method Code
Greedy Decoding
Deterministik, cepat
outputs = model.generate(
    input_ids,
    max_length=100,
    do_sample=False,
    use_cache=True,
)
Beam Search
Kualitas lebih baik, lebih lambat
outputs = model.generate(
    input_ids,
    max_length=100,
    num_beams=5,
    early_stopping=True,
    use_cache=True,
)
Top-k + Top-p Sampling
Balanced, recommended
outputs = model.generate(
    input_ids,
    max_length=100,
    do_sample=True,
    top_k=50,
    top_p=0.95,
    temperature=0.8,
    use_cache=True,
)
Dengan Repetition Penalty
Kurangi pengulangan
outputs = model.generate(
    input_ids,
    max_length=100,
    do_sample=True,
    temperature=0.7,
    top_p=0.9,
    repetition_penalty=1.2,
    use_cache=True,
)
๐Ÿ“ฆ Batch Generation
prompts = [
    "Ibu kota Indonesia adalah",
    "Presiden pertama Indonesia adalah",
    "Bahasa pemrograman Python adalah",
]

# Tokenize batch
inputs = tokenizer(prompts, return_tensors="pt", padding=True).to("cuda")

# Generate batch
with torch.no_grad():
    outputs = model.generate(
        **inputs,
        max_length=100,
        temperature=0.7,
        top_p=0.9,
        do_sample=True,
        use_cache=True,
        pad_token_id=tokenizer.pad_token_id,
    )

# Decode
generated_texts = tokenizer.batch_decode(outputs, skip_special_tokens=True)
for i, text in enumerate(generated_texts):
    print(f"=== Prompt {i+1} ===")
    print(text)
    print("-" * 50)
๐Ÿ“ก Streaming Generation
from transformers import TextIteratorStreamer
from threading import Thread

streamer = TextIteratorStreamer(tokenizer, skip_special_tokens=True)

generation_kwargs = dict(
    input_ids=input_ids,
    max_length=100,
    temperature=0.7,
    top_p=0.9,
    do_sample=True,
    streamer=streamer,
    use_cache=True,
)

# Generate di thread terpisah
thread = Thread(target=model.generate, kwargs=generation_kwargs)
thread.start()

# Stream output token by token
print("Generating: ", end="", flush=True)
for text in streamer:
    print(text, end="", flush=True)
print()

thread.join()

๐Ÿ—๏ธ Arsitektur Detail
๐Ÿ“ Konfigurasi Teknis
Parameter Nilai
Total Parameters 257,081,216 (~0.26B)
Vocab Size 100,000
Hidden Size 896
Num Layers 20
Attention Heads (Query) 14
KV Heads (GQA) 2
GQA Ratio 7:1 (setiap KV head untuk 7 query heads)
Head Dimension 64
Intermediate Size (FFN) 2,432
Context Length 8,192 tokens
Sliding Window 2,048 tokens
RoPE Theta 10,000.0
RMS Norm Epsilon 1e-06
๐Ÿ” Struktur Layer
Input
  โ”œโ”€ Token Embedding [100,000 โ†’ 896]
  โ”œโ”€ RoPE Position Encoding (ฮธ=10,000.0)
  โ”‚
  โ”œโ”€ Transformer Block ร—20
  โ”‚   โ”œโ”€ RMSNorm (ฮต=1e-06)
  โ”‚   โ”œโ”€ Grouped Query Attention
  โ”‚   โ”‚   โ”œโ”€ Query: 14 heads ร— 64 dim
  โ”‚   โ”‚   โ”œโ”€ Key/Value: 2 heads ร— 64 dim
  โ”‚   โ”‚   โ”œโ”€ Sliding Window: 2,048 tokens
  โ”‚   โ”‚   โ””โ”€ Multi-backend: Flash/xFormers/SDPA/Standard
  โ”‚   โ”œโ”€ Residual Connection
  โ”‚   โ”œโ”€ RMSNorm (ฮต=1e-06)
  โ”‚   โ”œโ”€ SwiGLU FFN
  โ”‚   โ”‚   โ”œโ”€ Gate: [896 โ†’ 2432]
  โ”‚   โ”‚   โ”œโ”€ Up: [896 โ†’ 2432]
  โ”‚   โ”‚   โ”œโ”€ SiLU(gate) ร— up
  โ”‚   โ”‚   โ””โ”€ Down: [2432 โ†’ 896]
  โ”‚   โ””โ”€ Residual Connection
  โ”‚
  โ”œโ”€ Final RMSNorm
  โ””โ”€ LM Head [896 โ†’ 100,000]
๐Ÿ’ก Key Components Explained
๐Ÿ”„ Grouped Query Attention (GQA)

GQA mengurangi jumlah key-value heads sambil mempertahankan query heads penuh.

Keuntungan Detail
โœ… Inference Cepat 2-3x lebih cepat vs Multi-Head Attention
โœ… KV Cache Kecil 7x lebih kecil (~0.1 GB vs ~0.6 GB untuk MHA)
โœ… Kualitas Baik Output quality hampir sama dengan MHA
โœ… Sweet Spot Balance antara MHA (akurat) dan MQA (cepat)

Implementasi:

# Query heads: 14
# KV heads: 2
# Ratio: 7:1

Setiap KV head di-share oleh 7 query heads

key_states = key_states.repeat_interleave(7, dim=1) value_states = value_states.repeat_interleave(7, dim=1)

๐ŸŒ€ RoPE (Rotary Positional Embeddings)

RoPE mengencoding posisi dengan merotasi vector di ruang kompleks.

Keuntungan Detail
โœ… Extrapolasi Baik Bisa handle sequence lebih panjang dari training
โœ… No Learned Params Tidak perlu learned parameters tambahan
โœ… Relative Position Natural relative positioning
โœ… KV Cache Support Support position offset untuk caching

Formula:

q' = q * cos(mฮธ) + rotate(q) * sin(mฮธ)
k' = k * cos(mฮธ) + rotate(k) * sin(mฮธ)

ฮธ = 10,000.0 m = position index

Terbukti efektif di: LLaMA, GPT-NeoX, PaLM, Mistral

โšก SwiGLU Activation

Variant dari Gated Linear Unit dengan Swish activation.

Keuntungan Detail
โœ… Performa Superior Lebih baik dari ReLU/GELU dalam language modeling
โœ… Ekspresif Gating mechanism meningkatkan representasi
โœ… SOTA Models Digunakan di LLaMA, PaLM, GPT-4

Formula:

SwiGLU(x) = Swish(Wโ‚ยทx) โŠ— (Wโ‚‚ยทx)
Swish(x) = x ยท sigmoid(ฮฒx)

Gate projection: Wโ‚ [896 โ†’ 2432] Up projection: Wโ‚‚ [896 โ†’ 2432] Down projection: Wโ‚ƒ [2432 โ†’ 896]

๐Ÿ“Š RMSNorm

Root Mean Square Normalization - alternatif sederhana dari LayerNorm.

Keuntungan Detail
โœ… Lebih Cepat Tidak perlu hitung mean (hanya RMS)
โœ… Lebih Stabil Training lebih stabil dibanding LayerNorm
โœ… Hasil Sama Kualitas hampir identik dengan LayerNorm

Formula:

RMSNorm(x) = x / RMS(x) * ฮณ
RMS(x) = sqrt(mean(xยฒ) + ฮต)

ฮต = 1e-06

๐ŸชŸ Sliding Window Attention

Membatasi attention hanya pada N token terdekat.

Keuntungan Detail
โœ… Memory Efficient O(nยฒ) โ†’ O(nยทw) complexity
โœ… Long Context Bisa "melihat" jauh via stacked layers
โœ… SOTA Usage Digunakan di Mistral, Longformer

Window Size: 2,048 tokens per layer

Effective Receptive Field:

# Layer 1: 2,048 tokens
# Layer 2: 4,096 tokens
# Layer 20: 40,960 tokens

Model bisa "melihat" sampai 40,960 tokens ke belakang!


๐Ÿ’ป Kebutuhan Hardware
๐ŸŽ“ Training Requirements
Precision Memory Recommended GPU Est. Batch Size
FP32 ~1.0 GB GTX 1060+ / RTX 2060+ 1-2
FP16/BF16 ~0.5 GB GTX 1060+ / RTX 2060+ 2-4
FP16/BF16 + GC ~0.3 GB Mid-tier GPUs 4-8
8-bit ~0.3 GB Lower tier possible 8-16
4-bit (QLoRA) ~0.1 GB Consumer GPUs 16-32

GC = Gradient Checkpointing

๐Ÿš€ Inference Requirements
Precision Memory Est. Speed GPU
FP16 ~0.5 GB Fast GTX 1060+ / RTX 2060+
FP16 + Flash Attn ~0.5 GB 4x Faster GTX 1060+ / RTX 2060+ (CUDA)
8-bit ~0.3 GB Medium Mid-tier GPUs
4-bit (GPTQ/AWQ) ~0.1 GB Medium-Fast Consumer GPUs
๐Ÿ’ก Tip: Dengan gradient checkpointing, memory training bisa turun 30-50% tapi compute time naik ~30%
๐Ÿ“Š GPU Recommendations by Use Case
Use Case Min GPU Recommended GPU Optimal GPU
Eksperimen / Testing GTX 1060 6GB RTX 3060 12GB RTX 3090 24GB
Fine-tuning RTX 3060 12GB RTX 3090 24GB A100 40GB
Pretraining RTX 3090 24GB A100 40GB 8ร— A100 80GB
Production Inference RTX 3060 12GB A5000 24GB A100 40GB

๐Ÿ“š Model Family

Tersedia 30 ukuran model dari 10M hingga 1T parameters:

๐Ÿฃ Tiny & Small (10M - 500M) - Eksperimen cepat, edge devices
Model Params Hidden Layers Heads KV Context Memory
caca-10M 10M 256 8 8 2 8K 0.02 GB
caca-50M 50M 512 12 8 2 8K 0.1 GB
caca-100M 100M 768 12 12 3 8K 0.2 GB
caca-250M 250M 896 20 14 2 8K 0.5 GB
caca-500M 500M 1,024 24 16 4 8K 1.0 GB
๐Ÿฆ… Medium (1B - 10B) - Production apps, fine-tuning
Model Params Hidden Layers Heads KV Context Memory
caca-1B 1B 2,048 24 16 4 8K 2 GB
caca-2B 2B 2,560 32 20 5 8K 4 GB
caca-3B 3B 3,072 32 24 6 8K 6 GB
caca-5B 5B 4,096 32 32 8 8K 10 GB
caca-7B 7B 4,096 48 32 8 8K 14 GB
caca-8B 8B 4,096 40 32 8 8K 16 GB
caca-10B 10B 5,120 48 40 8 8K 20 GB
๐Ÿฆ Large (13B - 100B) - Research, high-performance
Model Params Hidden Layers Heads KV Context Memory
caca-13B 13B 5,120 64 40 8 16K 26 GB
caca-20B 20B 6,144 64 48 8 16K 40 GB
caca-30B 30B 7,168 64 56 8 16K 60 GB
caca-40B 40B 8,192 72 64 8 16K 80 GB
caca-50B 50B 8,192 80 64 8 32K 100 GB
caca-60B 60B 8,192 88 64 8 32K 120 GB
caca-70B 70B 8,192 96 64 8 32K 140 GB
caca-100B 100B 10,240 96 80 8 32K 200 GB
๐Ÿ‹ Extra Large (150B - 500B) - Advanced research
Model Params Hidden Layers Heads KV Context Memory
caca-150B 150B 12,288 96 96 12 32K 300 GB
caca-200B 200B 12,288 120 96 12 32K 400 GB
caca-300B 300B 14,336 128 112 14 64K 600 GB
caca-400B 400B 16,384 128 128 16 64K 800 GB
caca-500B 500B 16,384 144 128 16 64K 1 TB
๐Ÿฆ• Ultra (600B - 1T) - Cutting-edge research
Model Params Hidden Layers Heads KV Context Memory
caca-600B 600B 18,432 144 144 18 64K 1.2 TB
caca-700B 700B 19,456 148 152 19 64K 1.4 TB
caca-800B 800B 20,480 152 160 20 128K 1.6 TB
caca-900B 900B 21,504 156 168 21 128K 1.8 TB
caca-1T 1T 24,576 160 192 24 128K 2 TB


๐Ÿ”ฌ Model Introspection & Debugging
๐Ÿ“Š Check Model Info
from caca_transformers import CacaForCausalLM

model = CacaForCausalLM.from_pretrained("Lyon28/caca-250m")

# Parameter count
total_params = model.num_parameters()
trainable_params = model.num_parameters(only_trainable=True)

print(f"โœ… Total parameters: {total_params:,}")
print(f"โœ… Trainable parameters: {trainable_params:,}")

# Model size
model_size_fp16 = total_params * 2 / 1e9
model_size_fp32 = total_params * 4 / 1e9

print(f"โœ… Model size (FP16): {model_size_fp16:.2f} GB")
print(f"โœ… Model size (FP32): {model_size_fp32:.2f} GB")

# Architecture info
config = model.config
print(f"\n๐Ÿ“ Architecture:")
print(f"   Hidden size: {config.hidden_size:,}")
print(f"   Num layers: {config.num_hidden_layers}")
print(f"   Attention heads: {config.num_attention_heads}")
print(f"   KV heads: {config.num_key_value_heads}")
print(f"   GQA ratio: {config.num_attention_heads // config.num_key_value_heads}:1")
print(f"   Head dim: {config.head_dim}")
print(f"   Context length: {config.max_position_embeddings:,}")
print(f"   Sliding window: {config.sliding_window:,}")
โšก Check Attention Backend
import logging
logging.basicConfig(level=logging.INFO)

# Check available backends
attn_layer = model.model.layers[0].self_attn

print("๐Ÿ” Available backends:")
print(f"   Flash Attention: {attn_layer.has_flash_attn}")
print(f"   xFormers: {attn_layer.has_xformers}")
print(f"   SDPA: {attn_layer.has_sdpa}")

# Run dummy forward untuk lihat backend yang digunakan
dummy_input = torch.randint(0, 1000, (1, 10)).cuda()
model = model.cuda()

print("\n๐Ÿš€ Running forward pass...")
_ = model(dummy_input)
# Log akan muncul: "โœ… Using Flash Attention backend" atau fallback
๐Ÿ’พ Memory Profiling
import torch

model = model.cuda().eval()

# Warmup
print("๐Ÿ”ฅ Warming up...")
for _ in range(5):
    with torch.no_grad():
        _ = model(torch.randint(0, 1000, (1, 512)).cuda())

# Profile
print("๐Ÿ“Š Profiling memory...")
torch.cuda.reset_peak_memory_stats()
torch.cuda.empty_cache()

with torch.no_grad():
    _ = model(torch.randint(0, 1000, (1, 2048)).cuda())

peak_memory = torch.cuda.max_memory_allocated() / 1e9
current_memory = torch.cuda.memory_allocated() / 1e9

print(f"โœ… Peak memory: {peak_memory:.2f} GB")
print(f"โœ… Current memory: {current_memory:.2f} GB")
โฑ๏ธ Speed Benchmark
import time
import torch

model = model.cuda().eval()
batch_size = 1
seq_length = 512
input_ids = torch.randint(0, 1000, (batch_size, seq_length)).cuda()

# Warmup
print("๐Ÿ”ฅ Warming up...")
for _ in range(10):
    with torch.no_grad():
        _ = model(input_ids)

# Benchmark
print("โฑ๏ธ Benchmarking...")
torch.cuda.synchronize()
start = time.time()

num_runs = 100
for _ in range(num_runs):
    with torch.no_grad():
        _ = model(input_ids)

torch.cuda.synchronize()
elapsed = time.time() - start

# Calculate metrics
total_tokens = num_runs * seq_length
tokens_per_sec = total_tokens / elapsed
ms_per_token = (elapsed * 1000) / total_tokens
samples_per_sec = num_runs / elapsed

print(f"โœ… Throughput: {tokens_per_sec:.0f} tokens/sec")
print(f"โœ… Latency: {ms_per_token:.2f} ms/token")
print(f"โœ… Samples/sec: {samples_per_sec:.1f}")
print(f"โœ… Total time: {elapsed:.2f}s for {num_runs} runs")
๐Ÿ” Layer-wise Analysis

# Analyze each layer
print("๐Ÿ“Š Layer-wise parameter count:\n")

layer_total = 0  # โœ… Ganti nama variable biar gak bentrok
for name, module in model.named_modules():
    if isinstance(module, (torch.nn.Linear, torch.nn.Embedding)):
        params = sum(p.numel() for p in module.parameters())
        layer_total += params
        print(f"{name:50s}: {params:>12,} params")

print(f"\n{'='*65}")
print(f"{'Total':50s}: {layer_total:>12,} params")  # โœ… Use layer_total

# Check gradient status
print("\n๐ŸŽฏ Gradient status:")

print(f"   Trainable: 257,081,216 (100.0%)")
print(f"   Frozen: 0 (0.0%)")

โ“ FAQ (Frequently Asked Questions)
Q: Apakah model ini sudah di-train?

A: Tidak. Semua model dirilis dengan bobot random dan memerlukan pretraining. Model ini adalah arsitektur kosong yang siap untuk di-train dengan data Anda sendiri.

Model ini cocok untuk:

  • โœ… Custom pretraining dengan data domain-spesifik
  • โœ… Penelitian arsitektur transformer
  • โœ… Pembelajaran tentang LLM
  • โŒ TIDAK untuk inference langsung
Q: Berapa lama waktu pretraining?

A: Sangat tergantung ukuran model dan hardware:

Model Size Hardware Est. Time
10M-100M 1 GPU (RTX 3090) 1-3 hari
500M-1B 4 GPU (RTX 3090) 1-2 minggu
2B-7B 8 GPU (A100 40GB) 2-4 minggu
13B-30B 32 GPU (A100 80GB) 1-2 bulan
50B-70B 128 GPU (A100 80GB) 2-4 bulan
100B+ 512+ GPU cluster 3-6 bulan

Estimasi untuk pretraining dengan ~100B-1T tokens

Q: Dataset apa yang recommended?

A: Untuk Bahasa Indonesia:

Dataset Size rows Source
Corpus Indonesia Clean ~1.9 GB ~19.5 M Lyon28/Corpus-Indonesia
Indonesian Wikipedia ~584 MB ~666 K wikipedia/20220301.id
Common Crawl ID null null Common Crawl filtered
CC100 Indonesian ~8.9 GB ~90 M cc100/id
Oscar Indonesian null null oscar/unshuffled_deduplicated_id
mC4 Indonesian null null mc4/id

Minimum: 10B tokens untuk model 1B+

Quality > Quantity:

  • โœ… Hapus duplikat (MinHash LSH)
  • โœ… Filter text berkualitas rendah
  • โœ… Balance domains (news, books, web, code)
Q: GPU apa yang dibutuhkan?

A: Minimum requirements by model size:

Model Training (BF16+GC) Inference (FP16) GPU
10M-100M 2-4GB <1GB GTX 1060+
500M-1B 8-16GB 4GB RTX 3060+
2B-7B 24-48GB 16GB RTX 3090 / A5000
13B-30B 48GB+ 32GB+ A100 40GB
50B-70B Multi-GPU Multi-GPU 8ร— A100 80GB
100B+ Large cluster Large cluster 32+ A100 80GB

GC = Gradient Checkpointing untuk hemat memory

Q: Apakah Flash Attention wajib?

A: Tidak wajib! Flash Attention opsional untuk speedup 2-4x.

Model memiliki auto-fallback chain :

Flash Attention (4x) โ†’ xFormers (3x) โ†’ SDPA (2x) โ†’ Standard (1x)

Model akan otomatis memilih backend terbaik yang tersedia.

# Model akan jalan dengan/tanpa Flash Attention
config = CacaConfig(use_flash_attn=True)  # Auto fallback
model = CacaForCausalLM(config)

Jika Flash Attention tidak bisa di-install:

# Gunakan xFormers (masih 3x speedup)
pip install xformers

Atau gunakan SDPA built-in (2x speedup)

Tidak perlu install apapun, PyTorch 2.0+ sudah include

Q: Kenapa Flash Attention tidak bisa di-install?

A: Flash Attention memerlukan:

  • โœ… CUDA 11.6+
  • โœ… PyTorch 2.0+
  • โœ… GPU compute capability 7.5+ (V100, A100, H100, RTX 3090+)
  • โœ… Build tools (gcc, nvcc)

Solusi:

Option 1: Skip Flash, Gunakan xFormers
pip install xformers
# Masih dapat 3x speedup!
Option 2: Disable Manual
config = CacaConfig(
    use_flash_attn=False
)
model = CacaForCausalLM(config)
# Fallback ke SDPA/Standard
Q: Bagaimana cara menggunakan KV cache?

A: KV cache otomatis digunakan saat generation:

# Automatic dengan .generate()
outputs = model.generate(
    input_ids,
    max_length=100,
    use_cache=True,  # Enable KV cache
)

# Manual forward pass
outputs = model(input_ids, use_cache=True)
past_kv = outputs['past_key_values']

# Next token dengan cache
next_token_ids = torch.tensor([[next_token]])
next_outputs = model(
    next_token_ids,
    past_key_values=past_kv,
    use_cache=True,
)

Keuntungan KV cache:

  • โœ… Tidak perlu recompute key/value untuk token sebelumnya
  • โœ… Speedup 10-100x untuk autoregressive generation
  • โœ… Memory efficient dengan GQA (7x lebih kecil)
Q: Apakah sliding window benar diimplementasikan?

A: Ya! Sliding window diimplementasikan di semua backends:

Backend Implementation
Flash Attention Native window support via window_size parameter
xFormers Custom attention mask dengan distance-based masking
SDPA Custom attention mask dengan distance-based masking
Standard Custom attention mask dengan distance-based masking

Window size model ini: 2,048 tokens

Effective receptive field:

  • Layer 1: 2,048 tokens
  • Layer 2: 4,096 tokens
  • Layer 20: 40,960 tokens
Q: Bagaimana cara fine-tune?

A: Setelah pretrain, fine-tune dengan learning rate lebih kecil :

from transformers import Trainer, TrainingArguments

# Load pretrained model
model = CacaForCausalLM.from_pretrained("Lyon28/caca-250m")

# Fine-tuning args (LR lebih kecil dari pretrain)
training_args = TrainingArguments(
    output_dir="./caca-finetuned",
    learning_rate=1e-5,          # Lebih kecil dari pretrain (3e-4)
    num_train_epochs=3,
    per_device_train_batch_size=4,
    gradient_accumulation_steps=8,
    warmup_steps=100,
    bf16=True,
    gradient_checkpointing=True,
)

trainer = Trainer(
    model=model,
    args=training_args,
    train_dataset=your_task_dataset,
)

trainer.train()

Tips fine-tuning:

  • โœ… Learning rate: 1e-5 hingga 5e-5 (10x lebih kecil dari pretrain)
  • โœ… Epoch: 3-5 epoch (jangan terlalu banyak)
  • โœ… Warmup: 5-10% dari total steps
  • โœ… Monitor validation loss untuk early stopping
Q: Apakah ada pretrained weights?

A: Belum ada saat ini. Kami sedang merencanakan pretrain untuk:

  • ๐Ÿ‡ฎ๐Ÿ‡ฉ Bahasa Indonesia - Wikipedia, Common Crawl, mC4
  • ๐ŸŒ Multilingual - Indonesia + English
  • ๐Ÿ’ป Code - GitHub, Stack Overflow
  • ๐ŸŽฏ Instruction-tuned - Chat variants

โญ Star repo untuk mendapatkan update!

๐Ÿ’ก Ingin berkontribusi pretrain?

Kami welcome kolaborasi untuk pretrain model!

๐Ÿ“ง [email protected]

Q: Bagaimana export ke ONNX/GGUF?

A: Export ke ONNX

# Install Optimum
pip install optimum[onnxruntime]

# Export ke ONNX
from optimum.onnxruntime import ORTModelForCausalLM

model = ORTModelForCausalLM.from_pretrained(
    "Lyon28/caca-250m",
    export=True,
    provider="CUDAExecutionProvider",  # Untuk GPU
)

# Save ONNX model
model.save_pretrained("./caca-onnx")

GGUF Support: Coming soon! ๐Ÿšง

Kami sedang mengembangkan converter untuk GGUF format (llama.cpp compatible).

Q: Perbedaan Lyon28 dan Caca-AI?
Lyon28 Caca-AI

๐Ÿ”ฌ Research Repository

  • โœ… Model untrained (random weights)
  • โœ… Base architectures
  • โœ… Untuk custom training dari awal
  • โœ… Eksperimen & penelitian
  • โœ… Pembelajaran arsitektur

๐Ÿš€ Production Repository

  • โœ… Model pretrained
  • โœ… Fine-tuned variants
  • โœ… Production-ready
  • โœ… Siap digunakan inference
  • โœ… RLHF & instruction-tuned

Pilih sesuai kebutuhan:

  • Butuh model untrained untuk training sendiri? โ†’ Lyon28
  • Butuh model siap pakai? โ†’ Caca-AI
Q: Bagaimana cara berkontribusi?

A: Kami sangat welcome kontribusi!

๐Ÿ› Report bugs GitHub Issues
๐Ÿ’ก Suggest features GitHub Issues
๐Ÿ”ง Submit PR GitHub Pull Requests
๐Ÿ“ Improve docs GitHub Repo
โญ Star repo GitHub
๐Ÿ’ฌ Join discussion GitHub Discussions

Areas yang kami butuhkan bantuan:

  • ๐Ÿงช Testing di berbagai hardware
  • ๐Ÿ“Š Benchmarking performance
  • ๐Ÿ“š Dokumentasi bahasa lain
  • ๐ŸŽ“ Tutorial & contoh penggunaan
  • ๐Ÿ› Bug fixes & improvements

๐Ÿ’ก Use Cases
Use Case Detail
๐Ÿ”ฌ Penelitian & Eksperimen
  • Eksperimen arsitektur transformer modern
  • Benchmark comparison dengan model lain
  • Ablation studies untuk komponen
๐ŸŽ“ Pendidikan & Pembelajaran
  • Memahami cara kerja Large Language Model
  • Belajar implementasi attention mechanisms
  • Praktek training model dari scratch
๐Ÿ—๏ธ Custom Pretraining
  • Pretrain untuk domain spesifik (medical, legal, code)
  • Multilingual pretraining Bahasa Indonesia
  • Continual pretraining dari checkpoint
๐Ÿš€ Production Use
  • Fine-tuning untuk task spesifik
  • Instruction tuning & RLHF
  • Deployment dengan quantization/distillation

๐Ÿ“Š Perbandingan dengan Arsitektur Lain
Feature Caca LLaMA 2 Mistral GPT-3
Architecture Decoder-only Decoder-only Decoder-only Decoder-only
GQA โœ… โœ… โœ… โŒ
RoPE โœ… โœ… โœ… โŒ
SwiGLU โœ… โœ… โœ… โŒ (GELU)
RMSNorm โœ… โœ… โœ… โŒ (LayerNorm)
Sliding Window โœ… โŒ โœ… โŒ
Flash Attention โœ… (optional) โœ… โœ… โœ…
Multi-backend โœ… (4 backends) โš ๏ธ (2 backends) โš ๏ธ (2 backends) โŒ
Open Source โœ… โœ… โœ… โŒ

๐Ÿ’ก Tips & Best Practices
๐ŸŽ“ Untuk Training
from transformers import TrainingArguments

# Recommended hyperparameters untuk pretraining
training_args = TrainingArguments(
    # Learning rate
    learning_rate=3e-4,              # Standard untuk pretrain
    lr_scheduler_type="cosine",      # Cosine decay recommended
    warmup_steps=2000,               # 5-10% dari total steps
    
    # Optimization
    max_grad_norm=1.0,               # Gradient clipping
    weight_decay=0.1,                # Regularization
    bf16=True,                       # Mixed precision (recommended)
    
    # Memory
    gradient_checkpointing=True,     # Hemat memory 30-50%
    per_device_train_batch_size=4,   # Adjust sesuai GPU
    gradient_accumulation_steps=32,  # Effective BS = 4 ร— 32 = 128
    
    # Logging
    logging_steps=10,
    logging_first_step=True,
    
    # Saving
    save_steps=1000,
    save_total_limit=3,              # Keep 3 latest checkpoints
)
๐Ÿš€ Untuk Inference
# Enable eval mode
model.eval()

# Use FP16 untuk speedup
model = model.half()

# Generate dengan optimal settings
with torch.no_grad():
    outputs = model.generate(
        input_ids,
        max_length=512,
        temperature=0.7,              # Control randomness
        top_p=0.9,                    # Nucleus sampling
        do_sample=True,
        use_cache=True,               # Penting! KV cache speedup
        pad_token_id=tokenizer.pad_token_id,
    )
๐Ÿ’พ Untuk Hemat Memory
# 1. Gradient checkpointing
model.gradient_checkpointing_enable()

# 2. 8-bit training
from transformers import BitsAndBytesConfig

config = BitsAndBytesConfig(
    load_in_8bit=True,
    llm_int8_threshold=6.0,
)

model = CacaForCausalLM.from_pretrained(
    "Lyon28/caca-250m",
    quantization_config=config,
    device_map="auto",
)

# 3. Clear cache periodically
import torch
torch.cuda.empty_cache()
โšก Untuk Multi-GPU
# Dengan Accelerate
from accelerate import Accelerator

accelerator = Accelerator()
model, optimizer, train_dataloader = accelerator.prepare(
    model, optimizer, train_dataloader
)

# Dengan DeepSpeed
training_args = TrainingArguments(
    deepspeed="ds_config.json",
    ...
)

โš ๏ธ Keterbatasan
Known Limitations
  1. Model Untrained - Semua model dirilis dengan random weights, memerlukan pretraining
  2. No Tokenizer - Belum include tokenizer, anda perlu provide sendiri
  3. Flash Attention Opsional - Mungkin sulit di-install di beberapa environment
  4. Large Model Training - Model 70B+ memerlukan multi-node setup
  5. Memory Intensive - Training memerlukan GPU dengan VRAM besar
Workarounds
# 1. Gunakan tokenizer dari model lain Atau Train Tokenize
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("gpt2")

# 2. Disable Flash Attention jika error
config = CacaConfig(use_flash_attn=False)

# 3. load Model
model = CacaForCausalLM.from_pretrained("Lyon28/caca-250m")

# 4. Gradient checkpointing untuk model besar
model.gradient_checkpointing_enable()

# 5. 8-bit training untuk hemat memory
from transformers import BitsAndBytesConfig
config = BitsAndBytesConfig(load_in_8bit=True)

๐Ÿ“„ Lisensi

Apache License 2.0 - Bebas digunakan untuk keperluan komersial dan penelitian.

Lihat LICENSE untuk detail lengkap.


๐Ÿ“ง Kontak & Support
๐Ÿ“ง Email [email protected]
๐Ÿค— Hugging Face (Main) @Lyon28
๐Ÿข Organization @Caca-AI
๐Ÿ’ป GitHub Lyon-28/caca-transformers
๐Ÿ› Issues GitHub Issues
๐Ÿ’ฌ Discussions GitHub Discussions

๐Ÿ”— Resources
๐Ÿ’ป GitHub Repository ๐Ÿค— Model Hub (Main) ๐Ÿข Organization ๐Ÿ“ฆ PyPI Package

๐Ÿ“Œ Citation

Jika Anda menggunakan arsitektur Caca dalam penelitian atau project, kami sangat menghargai jika Anda cite:

@misc{caca2025,
  author = {Lyon},
  title = {Caca: Modern Transformer Architecture with GQA, RoPE, and SwiGLU},
  year = {2025},
  publisher = {Hugging Face},
  howpublished = {\url{https://huggingface.co/Lyon28/caca-250m}},
  note = {Apache License 2.0}
}

๐Ÿ™ Acknowledgments

Arsitektur Caca terinspirasi dari berbagai penelitian dan implementasi:

  • LLaMA (Meta AI) - GQA dan arsitektur dasar
  • Mistral (Mistral AI) - Sliding Window Attention
  • GPT-NeoX (EleutherAI) - Implementasi RoPE
  • PaLM (Google) - SwiGLU activation
  • Flash Attention (Dao et al.) - Efficient attention implementation

๐Ÿ“ˆ Changelog
v0.0.1 (2025)
  • ๐ŸŽ‰ Initial release
  • โœ… 30 variants (10M - 1T parameters)
  • โœ… GQA, RoPE, SwiGLU, RMSNorm
  • โœ… Sliding Window Attention dengan enforcement
  • โœ… KV cache support
  • โœ… Flash Attention support (opsional)
  • โœ… Multi-backend attention (Flash/xFormers/SDPA/Standard)
  • โœ… Extensive input validation & error handling
  • โœ… Helpful error messages dengan solutions
  • โœ… Config validation dengan warnings
  • โœ… PyPI package: caca-transformers
  • โœ… Hugging Face Hub integration
  • โœ… Gradient checkpointing support
  • โœ… Auto-fallback mechanism

๐ŸŒŸ Star History

๐Ÿ’– Support Project

Jika project ini helpful untuk Anda:

โญ Star repo
di GitHub
๐Ÿ› Report bugs
atau issues
๐Ÿ’ก Suggest features
atau improvements
๐Ÿ“ข Share dengan
komunitas
๐Ÿค Contribute code
atau dokumentasi

Setiap kontribusi sangat berarti! ๐Ÿ™


๐Ÿš€ Built with โค๏ธ for Indonesian AI Community

GitHub Hugging Face Caca-AI PyPI


Dibuat oleh Lyon

Apache 2.0 License | 2025

Transformer architecture untuk semua orang ๐ŸŒ


๐Ÿ”— Quick Links
โš ๏ธ Peringatan ๐Ÿš€ Quick Start ๐ŸŽ“ Training โ“ FAQ ๐Ÿ“ง Kontak

Made with โค๏ธ using modern transformer architectures

GQA โ€ข RoPE โ€ข SwiGLU โ€ข RMSNorm โ€ข Sliding Window โ€ข Flash Attention

โฌ†๏ธ Back to top

Runs of Lyon28 caca-250m on huggingface.co

40
Total runs
0
24-hour runs
18
3-day runs
40
7-day runs
40
30-day runs

More Information About caca-250m huggingface.co Model

More caca-250m license Visit here:

https://choosealicense.com/licenses/apache-2.0

caca-250m huggingface.co

caca-250m huggingface.co is an AI model on huggingface.co that provides caca-250m's model effect (), which can be used instantly with this Lyon28 caca-250m model. huggingface.co supports a free trial of the caca-250m model, and also provides paid use of the caca-250m. Support call caca-250m model through api, including Node.js, Python, http.

caca-250m huggingface.co Url

https://huggingface.co/Lyon28/caca-250m

Lyon28 caca-250m online free

caca-250m huggingface.co is an online trial and call api platform, which integrates caca-250m's modeling effects, including api services, and provides a free online trial of caca-250m, you can try caca-250m online for free by clicking the link below.

Lyon28 caca-250m online free url in huggingface.co:

https://huggingface.co/Lyon28/caca-250m

caca-250m install

caca-250m is an open source model from GitHub that offers a free installation service, and any user can find caca-250m on GitHub to install. At the same time, huggingface.co provides the effect of caca-250m install, users can directly use caca-250m installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

caca-250m install url in huggingface.co:

https://huggingface.co/Lyon28/caca-250m

Url of caca-250m

caca-250m huggingface.co Url

Provider of caca-250m huggingface.co

Lyon28
ORGANIZATIONS

Other API from Lyon28

huggingface.co

Total runs: 449
Run Growth: 449
Growth Rate: 100.00%
Updated:December 11 2025
huggingface.co

Total runs: 255
Run Growth: 255
Growth Rate: 100.00%
Updated:December 11 2025
huggingface.co

Total runs: 202
Run Growth: 202
Growth Rate: 100.00%
Updated:December 11 2025
huggingface.co

Total runs: 125
Run Growth: 125
Growth Rate: 100.00%
Updated:December 09 2025
huggingface.co

Total runs: 123
Run Growth: 123
Growth Rate: 100.00%
Updated:December 09 2025
huggingface.co

Total runs: 27
Run Growth: 27
Growth Rate: 100.00%
Updated:December 09 2025
huggingface.co

Total runs: 8
Run Growth: 0
Growth Rate: 0.00%
Updated:July 08 2025
huggingface.co

Total runs: 7
Run Growth: -2
Growth Rate: -28.57%
Updated:July 11 2025
huggingface.co

Total runs: 6
Run Growth: -10
Growth Rate: -166.67%
Updated:August 14 2025
huggingface.co

Total runs: 6
Run Growth: -7
Growth Rate: -116.67%
Updated:August 12 2025
huggingface.co

Total runs: 6
Run Growth: 3
Growth Rate: 50.00%
Updated:July 01 2025
huggingface.co

Total runs: 5
Run Growth: 5
Growth Rate: 100.00%
Updated:May 19 2025
huggingface.co

Total runs: 5
Run Growth: 2
Growth Rate: 40.00%
Updated:January 06 2026
huggingface.co

Total runs: 2
Run Growth: 2
Growth Rate: 100.00%
Updated:May 19 2025
huggingface.co

Total runs: 1
Run Growth: -2
Growth Rate: -200.00%
Updated:June 28 2025
huggingface.co

Total runs: 1
Run Growth: -2
Growth Rate: -200.00%
Updated:July 01 2025
huggingface.co

Total runs: 1
Run Growth: 1
Growth Rate: 100.00%
Updated:May 19 2025
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:December 05 2025
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:July 26 2025
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:December 03 2025