Roadmap
What has shipped, what is next. Reconciled against docs/roadmap.md.
Shipped — Phase 0/1 (v0.3)
Typed IR, shape inference, composition (params/import/sweep), reproducibility, formatter, and LSP diagnostics.
Typed IR + Shape Inference
- New
kynml/ir/package:types.py(TypeShape, DType),nodes.py(IRModule, IRGraph, IROp hierarchy),builder.py(AST → IR lowering),infer.py(shape/type inference pass),passes.py(pass registry) in_featuresonLinearOpandnum_featuresonBatchNorm1dOpare auto-inferred — users never specify them- Shape mismatches raise
KynMLShapeErrorwith source-located messages at compile/train time - Loss/output agreement enforced:
bcerequires exactly 1 output unit;cross_entropy/nllrequire ≥2 output units - Activation footgun detection:
cross_entropy+softmaxorlog_softmaxemits a warning (not an error) compile_to_ir()inpipeline.pyis the canonical front door for backends and tooling
Schema Validation
kynml/schema.pyvalidates local CSV contracts on demandkynml schema <file>prints rows, raw feature count, encoded feature count, target, and resolved pathkynml validate --data,kynml compile --check-data,kynml train --check-data, andkynml sweep --check-datacatch missing CSVs, target drift, model input mismatches, binary target errors, and multiclass label range issues before generated PyTorch runs
Backend Seam
kynml/codegen/base.py:BackendABC +EmitContext+get_backend()kynml/codegen/pytorch_backend.py:PyTorchBackendreads exclusively fromIRModule(post-inference); never touches the ASTkynml/codegen/pytorch.pyis now a compatibility shim with unchanged public API
Composition
params:block — named values, referenced via$nameinside any blockimport "other.kyn"— mergesdatasetandmodelblocks; cycle detection; duplicate-name errorssweep:block — grid axes;expand_sweep()returns Cartesian product;kynml sweepgenerates per-combo scripts and a sweep orchestrator that writessweep_results.json- CLI
--param key=value(repeatable) overrides params block defaults at compile/run time
Reproducibility
seedanddeterministicfields ontrain:block- Generated scripts emit a source-closure/override
CONFIG_HASH,_set_seed(),
and always writerun_manifest.json kynml/repro/manifest.py:RunManifest,config_hash(),data_hash(),write_manifest()kynml/lock.py:create_lock(),check_lock(),LockMismatchError
Formatter
kynml fmt <file> [--write] [--check]— idempotent canonical formpython -m kynml.format <file>— module entry pointfrom kynml.format.formatter import format_source, format_file
LSP Diagnostics
kynml lsp— starts LSP server over stdio (requirespip install 'kynml[lsp]')python -m kynml.lsp— module entry pointfrom kynml.lsp.diagnostics import diagnose— pure diagnostics API, no pygls required
New CLI subcommands
kynml sweep— expand + run all parameter combinationskynml compare— render the checked-in competitive map as table, Markdown, or JSONkynml schema— validate concrete CSV data against the trained model contractkynml fmt— format sourcekynml lsp— start LSP server
Shipped — Phase 1 (v0.1 → v0.2)
The core compiler and all major CONNECT integrations are live.
Compiler core
- Handwritten indentation-aware parser for all five block types:
dataset,model,train,evaluate,export - Typed frozen-dataclass AST (
ast_nodes.py) - Semantic validator with
difflibtypo suggestions - PyTorch codegen: complete self-contained training scripts, no
import kynmlin the output
Dataset
- CSV sources via
csv("path") normalize,shuffle,split,num_workers,pin_memory,prefetch- Multiclass vs regression detected from loss; targets cast to
longorfloat32accordingly
Model layers
input N,dense N <act>,dropout P,batchnorm [N]- Activations:
relu,leaky_relu,gelu,sigmoid,tanh,softmax,log_softmax,linear
Training
- Losses:
mse,bce,cross_entropy,huber,l1/mae,nll - Optimizers:
adam(lr),adamw(lr, weight_decay),sgd(lr, momentum),rmsprop(lr, momentum) - Schedulers:
step(step_size, gamma),cosine(t_max),onecycle(max_lr) - Early stopping:
early_stop(patience, mode) - Checkpointing:
checkpoint(every_n, path, async_save)with resume on restart - Mixed precision:
precision = fp16 | bf16viatorch.amp.autocast+GradScaler - Graph compilation:
compile = true→torch.compile(model) - Device:
auto,cpu,cuda
Evaluate
- Metrics:
mae,mse,rmse,accuracy
Export
torch(state dict.pt),onnx(configurableopset, default 17),torchscript
CLI
validate,ast,compile,train
CONNECT — Serving
kynml.serving.generate_service(program, model_path, out_dir)emits FastAPI app + Dockerfile- Optional extra:
pip install 'kynml[serve]'(servingremains an alias)
CONNECT — MCP
python -m kynml.mcp.server— stdio MCP server- Tools:
kynml_validate,kynml_compile, and approval-gatedkynml_train - Optional extra:
pip install 'kynml[mcp]'
CONNECT — Integrations
kynml.integrations.huggingface.load_hf_dataset()kynml.integrations.objectstore.load_remote()- Optional extras:
pip install 'kynml[hf]'/'kynml[objectstore]'
Site
- Static site at
kynml.kynetra.devon Cloudflare Pages - Competitive map section comparing KynML's compiler layer against Lightning, Keras, Ludwig, and ZenML
Phase 2 — Image and Text
- Image datasets via PIL/torchvision loaders
- CNN layers:
conv2d,maxpool,flatten - Text datasets: tokenizer integration
- Transformer blocks:
attention,feedforward - Richer parser diagnostics with exact source spans
- First-class
huggingface(...)andobjectstore(...)source keywords in the.kynsyntax
Phase 3 — Production Tooling
- Generated script templates with stable extension hooks for post-processing
- Versioned compiler and reproducibility manifests for platform handoff
Phase 4 — Scale
- JAX backend
- MLIR backend
- Distributed training (DDP)
- Additional ONNX and portable inference targets
Phase 5 — Compiler Experience
- Compiler-aware editor capabilities exposed to Kynetra AIStudio
- Richer local sweep and search strategies
- Interactive compiler playground in the browser (Cloudflare Worker, compile-time PyTorch-free)
- Generated Python inference-service templates
Kynetra Platform Ownership
The following capabilities consume KynML manifests and outputs but are owned
outside this repository:
| Capability | Owner |
|---|---|
| Model registry | Foundry + Kynetra DB |
| Experiment tracking | Foundry |
| Cloud job orchestration | Kynetra Deploy |
| SaaS deployment | Kynetra Forge + Kynetra FX + Kynetra Deploy |
| Visual studio product | Kynetra AIStudio |
| Training approvals | Kynetra Prime |
| Durable artifacts and metrics | Kynetra DB |
See Also
- Changelog — per-version feature log
- Architecture — IR boundary and backend seam for future backends
- Compiler Internals — adding features to the current compiler
- Competitive Map — adjacent-tool positioning and
kynml compare - Schema Validation — CSV contract checks before compile/train
- Shape Inference — typed IR detail
- Composition — params/sweep/import detail