:brain: Gemma 3 from scratch — in pure Kotlin, in ...
# kotlindl
m
🧠 Gemma 3 from scratch — in pure Kotlin, in a notebook. The full architecture — RoPE, grouped-query attention, KV cache, RMSNorm, transformer blocks — in ~250 lines of plain Kotlin. Under 450 lines end to end, including SafeTensors weight loading from Hugging Face, tokenizer, and streaming generation. No Python, no NDK, no native libs. ~8 tok/s on CPU in a Kotlin Notebook. The whole setup is two lines:
@file:DependsOn("<http://sk.ainet.app:kotlin-notebook:0.62.9|sk.ainet.app:kotlin-notebook:0.62.9>")
@file:DependsOn("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.11.0")
Tensors, the NN DSL, model I/O — all default-imported and ready. 📓 Notebook: github.com/SKaiNET-developers/skainet-notebook/blob/…/standalone-gemma3-plus-kvcache.ipynb ⚡ Built on SKaiNET, the Kotlin Multiplatform deep-learning framework.
💯 1
👍 1
K 2