Docs Home

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

Language

CLI

  • CLI Reference — every command with flags, examples, and exit codes

Tutorials

Data

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
  • Toolingkynml fmt formatter and kynml lsp diagnostics server

Deployment

  • Servingkynml.serving.generate_service: FastAPI app, Dockerfile, inference endpoint
  • MCP Integrationpython -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