Text Generation
Transformers
Safetensors
PyTorch
Indonesian
English
caca
causal-lm
transformer
untrained
mla
multi-token-prediction
qk-norm
rope
yarn
swiglu
rmsnorm
sliding-window-attention
indonesian
bilingual
custom_code
Instructions to use Lyon28/caca-650M-untrained with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Lyon28/caca-650M-untrained with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Lyon28/caca-650M-untrained", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Lyon28/caca-650M-untrained", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Lyon28/caca-650M-untrained with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Lyon28/caca-650M-untrained" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Lyon28/caca-650M-untrained", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Lyon28/caca-650M-untrained
- SGLang
How to use Lyon28/caca-650M-untrained with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Lyon28/caca-650M-untrained" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Lyon28/caca-650M-untrained", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Lyon28/caca-650M-untrained" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Lyon28/caca-650M-untrained", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Lyon28/caca-650M-untrained with Docker Model Runner:
docker model run hf.co/Lyon28/caca-650M-untrained
| license: apache-2.0 | |
| language: | |
| - id | |
| - en | |
| tags: | |
| - text-generation | |
| - pytorch | |
| - causal-lm | |
| - transformer | |
| - untrained | |
| - mla | |
| - multi-token-prediction | |
| - qk-norm | |
| - rope | |
| - yarn | |
| - swiglu | |
| - rmsnorm | |
| - sliding-window-attention | |
| - indonesian | |
| - bilingual | |
| library_name: transformers | |
| pipeline_tag: text-generation | |
| widget: | |
| - text: "Jakarta adalah ibu kota" | |
| example_title: "๐ฎ๐ฉ Pelengkapan Teks (ID)" | |
| - text: | | |
| Pertanyaan: Apa itu kecerdasan buatan? | |
| Jawaban: | |
| example_title: "๐ฎ๐ฉ Tanya Jawab (ID)" | |
| - text: "The capital of Indonesia is" | |
| example_title: "๐ฌ๐ง Text Completion (EN)" | |
| - text: | | |
| User: Halo! Siapa kamu? | |
| Assistant: | |
| example_title: "๐ฌ Format Chat (ID)" | |
| inference: | |
| parameters: | |
| max_new_tokens: 100 | |
| temperature: 0.7 | |
| top_p: 0.9 | |
| top_k: 50 | |
| do_sample: true | |
| repetition_penalty: 1.1 | |
| datasets: [] | |
| metrics: | |
| - perplexity | |
| model-index: | |
| - name: caca-650M-untrained | |
| results: [] | |
| <div align="center"> | |
| <img src="https://i.postimg.cc/MTSj073X/logo.png" width="400" alt="caca-650M-untrained"/> | |
| # ๐ค caca-650M-untrained | |
| ### Arsitektur Transformer dengan Multi-head Latent Attention (MLA) | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| <img src="https://img.shields.io/badge/Status-Untrained%20(Weights%20Ready)-orange?style=for-the-badge" alt="Status"/> | |
| **526,860,267** parameters โข **527M** โข **20 layers** โข **8,192 tokens** (efektif **32,768** dgn YaRN) | |
| [๐ Dokumentasi](#-dokumentasi) โข [๐ป Usage](#-cara-penggunaan) โข [โ๏ธ Konfigurasi](#-spesifikasi-model) โข [๐ฌ Arsitektur](#-struktur-arsitektur-lengkap) | |
| </div> | |
| --- | |
| ## โ ๏ธ PENTING: Model Belum Dilatih (Untrained) | |
| <div style="background:#fff3cd;border-left:4px solid #ffc107;padding:12px;margin:16px 0;"><strong>โ ๏ธ PERHATIAN</strong>: Bobot model ini adalah <strong>random initialization</strong> (belum melalui proses training apa pun). Output yang dihasilkan akan <strong>tidak bermakna dan acak</strong>.</div> | |
| **Status Model:** | |
| - ๐ด **Belum dilatih** โ Bobot masih random init (`initializer_range=0.02`) | |
| - ๐ก **Untuk riset & eksperimen** โ Arsitektur sudah siap, tinggal train dari nol | |
| - ๐ข **Base architecture release** โ Titik awal pretraining | |
| | โ Bisa | โ Belum Bisa | | |
| |---------|----------------| | |
| | Load model architecture | Generate teks bermakna | | |
| | Test forward pass | Menjawab pertanyaan | | |
| | Measure memory & speed | Reasoning & understanding | | |
| | Mulai pretraining dari nol | Production deployment | | |
| --- | |
| ## ๐ Deskripsi | |
| **Caca** adalah arsitektur Large Language Model (LLM) yang menggabungkan **Multi-head Latent Attention (MLA)** ala DeepSeek-V2/V3, **Multi-Token Prediction (MTP)**, **QK-Normalization**, dan **sliding window attention** berselang-seling โ dirancang untuk efisiensi KV cache dan skalabilitas dari model kecil (~650M) sampai sangat besar (1T+). | |
| <blockquote style="border-left:4px solid #4A90E2;padding-left:16px;margin:16px 0;background:#f8f9fa;padding:12px;"> | |
| <p><strong>๐ Tentang Project Caca</strong></p> | |
| <p><em>Caca</em> adalah eksperimen open-source Indonesian LLM yang dibuat dari nol secara individual dan bertahap. Bukan kompetitor siapa-siapa, cuma pengen eksplorasi apa yang bisa dilakukan dengan budget terbatas, passion unlimited, dan mindset collaborative.</p> | |
| <p>Kalau berguna buat orang lain, alhamdulillah. Kalau enggak, ya tetap fun kok.</p> | |
| <p>โ <strong>Lyon</strong>, Creator</p> | |
| </blockquote> | |
| ### ๐ Mengapa Caca? | |
| 1. **๐ฎ๐ฉ Fokus pada Bahasa Indonesia** โ dirancang bilingual ID/EN | |
| 2. **๐พ KV Cache Sangat Hemat** โ MLA menekan KV cache ~81% dibanding attention standar setara | |
| 3. **๐ฏ Multi-Token Prediction** โ prediksi 1 token ke depan sekaligus, potensi throughput lebih baik | |
| 4. **๐ Long Context via YaRN** โ RoPE scaling dari 8,192 ke 32,768 token | |
| 5. **๐ช Sliding Window Berselang-seling** โ 10 full-attention layer + 10 sliding-window layer | |
| --- | |
| ## ๐ Spesifikasi Model | |
| <table> | |
| <tr><td><strong>Parameter</strong></td><td><strong>Value</strong></td><td><strong>Parameter</strong></td><td><strong>Value</strong></td></tr> | |
| <tr><td>Total Parameters</td><td><code>526,860,267</code></td><td>Vocab Size</td><td><code>32,000</code></td></tr> | |
| <tr><td>Hidden Size</td><td><code>1280</code></td><td>Intermediate Size</td><td><code>5120</code></td></tr> | |
| <tr><td>Num Layers</td><td><code>20</code></td><td>Attention Heads</td><td><code>10</code></td></tr> | |
| <tr><td>Max Context Length</td><td><code>8,192</code></td><td>Efektif (YaRN)</td><td><code>32,768</code></td></tr> | |
| <tr><td>RoPE Base (ฮธ)</td><td><code>10,000</code></td><td>Tie Embeddings</td><td><code>True</code></td></tr> | |
| <tr><td>Model Size (FP16)</td><td><code>1.05 GB</code></td><td>Formatted Size</td><td><code>527M</code></td></tr> | |
| </table> | |
| --- | |
| ## ๐พ Kebutuhan Memory | |
| ### Training Requirements | |
| <table> | |
| <tr><th>Configuration</th><th>Model Weights</th><th>+ Optimizer States</th><th>Total Training</th></tr> | |
| <tr><td><strong>FP32 (AdamW)</strong></td><td>2.11 GB</td><td>+6.32 GB</td><td><strong>8.43 GB</strong></td></tr> | |
| <tr><td><strong>Mixed Precision</strong></td><td>1.05 GB</td><td>+7.38 GB</td><td><strong>8.43 GB</strong></td></tr> | |
| <tr><td><strong>+ Gradient Checkpointing</strong></td><td colspan="2">Menghemat ~30-50% activation memory</td><td><strong>~5.06 GB</strong></td></tr> | |
| </table> | |
| ### Inference Requirements (MLA KV Cache) | |
| <table> | |
| <tr><th>Precision</th><th>Model Size</th><th>KV Cache (2K ctx)</th><th>Total Memory</th></tr> | |
| <tr><td><strong>FP16 / BF16</strong></td><td>1.05 GB</td><td>0.020 GB</td><td><strong>1.07 GB</strong></td></tr> | |
| <tr><td><strong>INT8</strong></td><td>0.53 GB</td><td>0.020 GB</td><td><strong>0.55 GB</strong></td></tr> | |
| <tr><td><strong>INT4 (NF4)</strong></td><td>0.26 GB</td><td>0.020 GB</td><td><strong>0.28 GB</strong></td></tr> | |
| </table> | |
| > ๐ก KV cache MLA jauh lebih kecil drpd attention standar karena cuma nyimpen `kv_lora_rank + qk_rope_head_dim` (245 dim) per token, bukan `num_heads ร head_dim` penuh. Pada 8K context, KV cache ~0.080 GB. | |
| ### Performance Estimates | |
| <table> | |
| <tr><th>Metric</th><th>Value</th><th>Notes</th></tr> | |
| <tr><td><strong>FLOPs per Token</strong></td><td>1,053,720,534</td><td>Forward pass only</td></tr> | |
| <tr><td><strong>TFLOPs per Token</strong></td><td>0.0011</td><td>โ 6ร untuk backward</td></tr> | |
| </table> | |
| --- | |
| ## ๐ป Cara Penggunaan | |
| ### Basic Loading | |
| ```python | |
| from transformers import AutoConfig, AutoModelForCausalLM | |
| import torch | |
| config = AutoConfig.from_pretrained("Lyon28/caca-650M-untrained", trust_remote_code=True) | |
| model = AutoModelForCausalLM.from_pretrained( | |
| "Lyon28/caca-650M-untrained", | |
| config=config, | |
| trust_remote_code=True, | |
| torch_dtype=torch.bfloat16, | |
| device_map="auto" | |
| ) | |
| print(f"Model loaded: {model.num_parameters():,} parameters") | |
| print("โ ๏ธ Model ini UNTRAINED โ output belum bermakna") | |
| ``` | |
| ### Quantized Loading (4-bit) | |
| ```python | |
| from transformers import AutoModelForCausalLM, BitsAndBytesConfig | |
| import torch | |
| bnb_config = BitsAndBytesConfig( | |
| load_in_4bit=True, | |
| bnb_4bit_quant_type="nf4", | |
| bnb_4bit_compute_dtype=torch.bfloat16, | |
| bnb_4bit_use_double_quant=True | |
| ) | |
| model = AutoModelForCausalLM.from_pretrained( | |
| "Lyon28/caca-650M-untrained", | |
| trust_remote_code=True, | |
| quantization_config=bnb_config, | |
| device_map="auto" | |
| ) | |
| print(f"Memory footprint: ~0.28GB (4-bit)") | |
| ``` | |
| ### Mulai Pretraining | |
| ```python | |
| from transformers import TrainingArguments, Trainer | |
| training_args = TrainingArguments( | |
| output_dir="./output", | |
| per_device_train_batch_size=1, | |
| gradient_accumulation_steps=16, | |
| learning_rate=3e-4, | |
| max_steps=10000, | |
| lr_scheduler_type="cosine", | |
| warmup_steps=500, | |
| bf16=True, | |
| gradient_checkpointing=True, | |
| ) | |
| trainer = Trainer(model=model, args=training_args, train_dataset=train_dataset) | |
| trainer.train() | |
| ``` | |
| --- | |
| ## ๐ฆ Isi Repo | |
| Weight tersimpan dalam satu file <code>model.safetensors</code>. | |
| ## ๐๏ธ Status Training | |
| Tidak ada metrik training (loss, wandb, tensorboard) โ ini adalah **base architecture release** untuk dipakai sebagai titik awal pretraining dari nol. | |
| --- | |
| ## ๐ License | |
| Model ini dirilis di bawah **Apache License 2.0** โ bebas dipakai, dimodifikasi, dan didistribusikan (dengan attribution), disediakan "as is" tanpa warranty. | |
| --- | |
| ## ๐ฅ Team & Contact | |
| - **Lyon** โ Architecture design & implementation | |
| - ๐ง cacatransformers@gmail.com | |
| - ๐ฌ [Discussions](https://huggingface.co/Lyon28/caca-650M-untrained/discussions) | |
| --- | |
| <div align="center"> | |
| <sub>Model ini adalah bagian dari <b>Caca Project</b> โ eksplorasi Indonesian LLM dari nol.<br/> | |
| Dibuat oleh <a href="https://huggingface.co/Lyon28">@Lyon28</a> | Licensed under Apache 2.0 | Built with ๐ค Transformers</sub> | |
| **๐ "Dari nol, untuk semua" ๐** | |
| </div> | |