KynML Wiki
KynML is a declarative ML language: write a .kyn spec, get a production-ready PyTorch training script.
60-Second Quickstart
pip install -e ".[dev]"
dataset Iris:
source = csv("data/iris.csv")
target = "species"
split = 0.8
normalize = true
model IrisNet:
input 4
dense 16 relu
dense 3 linear
train:
model = IrisNet
data = Iris
loss = cross_entropy
optimizer = adam(lr=0.001)
epochs = 30
batch = 32
device = auto
evaluate:
metrics = [accuracy]
# validate
kynml validate iris.kyn
# compile to a runnable Python script
kynml compile iris.kyn --out generated/iris.py
# or compile + run in one shot
kynml train iris.kyn
# format source in canonical form
kynml fmt iris.kyn --write
# run a parameter sweep
kynml sweep iris_sweep.kyn
# inspect adjacent-tool positioning
kynml compare
Table of Contents
Getting Started
- Getting Started — install, first
.kyn, validate/compile/train
Language
- Language Reference — complete grammar, every block, option, layer, and keyword
CLI
- CLI Reference — every command with flags, examples, and exit codes
Tutorials
- Tutorial: Regression — predicting continuous values with MSE/Huber loss
- Tutorial: Binary Classification — sigmoid + BCE, binary accuracy
- Tutorial: Multiclass Classification — cross_entropy, softmax, label encoding
Data
- Datasets and Connectors — CSV, HuggingFace Hub, S3, Cloudflare R2, local Parquet
Performance
- Speed Guide — AMP (fp16/bf16), torch.compile, DataLoader workers, pin_memory, prefetch
- Export Formats — torch state dict, TorchScript, ONNX (with opset control)
Compiler Features (Phase 0/1)
- Shape Inference — auto-inferred in_features, shape validation, loss/output agreement
- Composition — params block, $references, import statements, sweep grid search
- Reproducibility — seed, deterministic mode, config_hash, lock file, run_manifest.json
- Tooling —
kynml fmtformatter andkynml lspdiagnostics server
Deployment
- Serving —
kynml.serving.generate_service: FastAPI app, Dockerfile, inference endpoint - MCP Integration —
python -m kynml.mcp.server, tool schemas, agent usage
Internals
- Architecture — package layout, data flow, IR boundary, backend seam
- Compiler Internals — parse → AST → compose → validate → lower → infer → emit pipeline detail
Reference
- Competitive Map — where KynML fits beside Lightning, Keras, Ludwig, and ZenML
- Cookbook — copy-paste recipes for common patterns
- FAQ — frequently asked questions
- Contributing — dev setup, test suite, adding features
- Roadmap — planned features and priorities
- Changelog — version history