skainet
0.33.0indexedOpen-source deep learning framework simplifies creation of modern AI applications, adhering to GitFlow for branching and Semantic Versioning for release management.
Open-source deep learning framework simplifies creation of modern AI applications, adhering to GitFlow for branching and Semantic Versioning for release management.
Click the diagram for the full architecture reference, or read the short ARCHITECTURE.md.
SKaiNET is a Kotlin Multiplatform AI framework. New here? Choose the path that matches what you want to try first.
Working in Java? SKaiNET ships first-class Java support — see the Java getting-started guide.
[!NOTE] Looking for LLM inference? Llama, Qwen, Gemma, Apertus, BERT embeddings and GGUF chat models live in SKaiNET-transformers — this repository is the engine underneath it (tensors, NN DSL, compiler, CPU/native backends, GGUF/SafeTensors IO). Depend on the
sk.ainet.transformersartifacts, pinned together by the transformers BOM.
Use the version shown in this README as the source of truth for first-run snippets. If another page shows a different version, please open an issue or PR.
Add the core dependencies (Gradle Kotlin DSL):
dependencies {
// Recommended: import the umbrella BOM and drop versions on the engine modules.
implementation(platform("sk.ainet:skainet-bom:0.65.0"))
implementation("sk.ainet.core:skainet-lang-core")
implementation("sk.ainet.core:skainet-backend-cpu")
}
val model = nn {
input(28 * 28)
dense(out = 128)
relu()
dense(out = 10)
}
val a = tensor(shape(2, 2)) { float(1f, 2f, 3f, 4f) }
val b = tensor(shape(2, 2)) { float(5f, 6f, 7f, 8f) }
val c = a matMul b
val d = c.relu()
// Recommended: streaming reader — memory-efficient, supports quantized types
val source = JvmRandomAccessSource.open("model.gguf")
StreamingGGUFReader.open(source).use { reader ->
println("Tensors: ${reader.tensorCount}")
// Load specific tensor on demand (no whole-file loading)
val bytes = reader.loadTensor("token_embd.weight")
// Or get a view over the tensor's bytes: its format, and values decoded on read
val view = reader.loadTensorView("token_embd.weight")
}
More examples: SKaiNET-examples | SKaiNET-notebook
SKaiNET is a modular ecosystem. While this repository contains the core engine, specialized high-level libraries are maintained in standalone repositories:
| Project | Description |
|---|---|
| SKaiNET-transformers | Pre-built transformer architectures and layers |
| SKaiNET-examples | Sample projects and integration demos |
First time here? Three links are all you need:
Small fixes can go straight through the normal contribution flow described in CONTRIBUTING.md and GITFLOW.adoc.
Non-trivial work goes through one of two processes:
SKaiNET ships an official Phoronix-Test-Suite-compatible benchmark
program for the compute engine. See the
methodology and replay docs,
the release manifest, and the
CI workflow. Smoke runs fire
on every PR via ubuntu-latest; full publishable runs fire on a
self-hosted Linux x86 runner on release.
Quick local replay:
./gradlew :skainet-backends:benchmarks:jvm-cpu-publish:shadowJar
./scripts/run_engine_smoke.sh
SKaiNET is built around one path: a model is defined once in the Kotlin DSL, then either compiled or executed eagerly — without rewriting it.
StableHLO/MLIR is therefore one code-generation backend among siblings — the IREE/native path next to the C99/Arduino and Minerva MCU paths — not a separate pipeline.
flowchart LR
DSL["Model — Kotlin DSL"] --> Graph["Tape / DAG (ComputeGraph)"]
Graph --> Eager["Eager backend (JVM, …)"]
Graph -->|code generation| HLO["StableHLO / MLIR"]
Graph -->|code generation| C99["Arduino / C99"]
Graph -->|code generation| Minerva["Minerva"]
HLO --> Native["IREE → native / edge / accelerator"]
C99 --> MCU["Microcontroller"]
Minerva --> SecMCU["Secure-MCU bundle"]
The same DSL model feeds every path: eager execution for development and JVM deployment, and the code-generation backends — StableHLO/MLIR (→ IREE), Arduino/C99, and Minerva — as sibling alternatives for native, edge, and secure-MCU targets.
SKaiNET now includes a Minerva export backend for secure MCU deployment. It is a sibling to StableHLO and Arduino/C99 export: it starts from a supported ComputeGraph, lowers static MLPs to a Minerva compiler input, invokes libminerva when configured, and packages generated weights, host fixtures, firmware skeletons, and a fingerprinted manifest.json.
Start here:
Runnable examples:
./gradlew :skainet-compile:skainet-compile-minerva:runMinervaSecureMcuExamples
./gradlew :skainet-compile:skainet-compile-minerva:runMinervaSecureMcuExamples \
-Pminerva.example=sensor-classifier
safe-lowbit, balanced, experimental-max. See for integration guide.nn { input(); dense(); relu(); dense() }dag { } for ResNet-style skip connections and multi-scale detector headsfile://, https://, , and val raw = JvmDataSourceResolver().rawDataset {
from("hf://datasets/org/repo@main/train.jsonl")
format(DataFormat.JSON_LINES)
cachePolicy(CachePolicy.Use)
}
val withoutLabel = dataPipeline<RawDataset>()
.stage(
dataTransformer(
name = "drop-label",
outputSchema = { schema -> DataSchema(schema.columns - "label") }
) { dataset ->
val columns = dataset.schema.columns - "label"
dataset.copy(
schema = DataSchema(columns),
rows = dataset.rows.map { row ->
RawDataRow(row.values.filterKeys { key -> key in columns })
}
)
}
)
.execute(raw)
HloGeneratorOne storage model: weights stay in their packed form from the file to the kernel, and the old storage layer is removed (SKEEP-003). This release has breaking changes; the changelog gives the migration for each removed type.
See CHANGELOG.md for full release notes, including every prior release.
We love contributions! Whether it's a new operator, documentation, or a bug fix:
Browse the full codebase documentation on DeepWiki.
If you use SKaiNET in your research, please cite it. Citation metadata lives in
CITATION.cff (GitHub's Cite this repository button exports BibTeX and APA
from it). Ready-to-paste BibTeX:
@misc{skainet,
author = {Harakal, Michal and {SKaiNET-developers contributors}},
title = {{SKaiNET}: A {Kotlin} Multiplatform {AI} Framework},
year = {2026},
note = {Version 0.65.0. MIT License},
howpublished = {\url{https://github.com/SKaiNET-developers/SKaiNET}}
}
Please include the version you used (each release is tagged).
MIT — see LICENCE.
| Goal | Start here | Time |
|---|
| Run tensor operations | Quickstart (below) | 2–5 min |
| Build and train a neural net | Hello Neural Net (below) | 5 min |
| Run a local GGUF model | SKaiNET Transformers starter | 5 min after model setup |
| Export a secure MCU bundle | Minerva getting started | 10 min without firmware flashing |
| Read low-bit weights (4-bit, ternary) | Weights at 1.7 bits | 10 min |
| Goal | Start here |
|---|
| Examples and sample projects | SKaiNET-examples |
| Interactive notebooks | SKaiNET-notebook |
| Eager backends & kernels (what runs where) | Backends & kernels map |
| Design proposals and long-lived API decisions | SKEEP proposals |
| Memory & storage architecture (storage, views, scopes, planning) | The memory model · Packed weight layout |
skill:android, skill:numerics (no Kotlin), skill:docs, or by size: size:xs.[Lane N · skill] title prefix means.docs/modules/skeep/pages/nn { } / dag { }).ComputeGraph.ComputeGraph through one of several
sibling code-generation backends, each emitting code for a different target
from the same graph:
HloGenerator) → IREE-compilable, for native / edge /
accelerator targets and the wider MLIR ecosystem.TurboQuantUsagehf+https://hf://....jsonl, .ndjson)StreamingGGUFReader and StreamingSafeTensorsReader return a
TensorView (loadTensorView, loadTensorViewMapped) over a tensor's bytes, without decoding or copying them.
view.format says what the bytes are (Float32/Q4_0, Float32/TQ1_0, Float16/Dense(2B)), get and
toFloatArray decode on read, and a mapped view works for a tensor above 2 GB.matmul with a packed weight looks its kernel up by KernelKey from the
two views, on every backend. The ops no longer check the data's class: 162 downcasts became 8, and a build task
keeps the count from rising.TensorData<FP32, Float>; get returns the decoded
value and getCode the stored code. view.requantizeTo(encoding) is the lossy conversion, materialize() the
lossless one.TensorEncoding.Opaque, a BlockDecoder and a ViewKernel add a weight format and its
matmul kernel from outside the library.TensorStorage, BufferHandle, LogicalDType, SlicedTensorView and the old TensorView
marker, loadTensorStorage*, the two MemorySegment packed weight classes. slice() and sliceView { }
return a Tensor.QuantizedMatmul and TernaryMatmul; use ops.matmul(input, weight).Shape, a debug-mode warning for element reads of a packed view, activation
ids for eager execution in debug mode, and a fix for ops.matmul with a ternary right-hand weight.Surfaced from shared tags and platforms — no rankings paid for.