Spark and AI models

Spark is a language for creating and modifying AI models efficiently — not a pile of training scripts and SDK glue. Model work, gateway routing, retrieval, and AI coding live in plain .spark files you can diff, dry-run, and ship.

What Spark means for model create / modify

GoalSpark todayHonest limits
Analyze model analyze "alias" -> report Dry-run fixtures — not live leaderboards
Compare model compare […] on suite "…" Fixture metrics; optional model probe for discovery
Improve model improve … prefer quality Heuristic blueprint — you review before training
Build model build blueprint into "…" Markdown plan only — never starts train@*
Auto alias use auto Bootstrap heuristics in dry-run
Live ask ask "…" + --live Bifrost via AI_GATEWAY_URL
model code
model analyze "fast" -> report
model compare ["fast", "code", "best"]
  on suite "examples/eval_suite.json" -> comparison
model improve from report prefer quality -> blueprint
model build blueprint into "out/my-model.md"
./spark --dry-run examples/model_improve.spark

Dry-run today (no keys)

./spark --dry-run and CI use offline fixtures for model ops, ask, classify, playbooks, and IDE traces. Primary loop before live inference spend.

Live gateway (wired today)

  • Bifrost — OpenAI-compatible chat; aliases fast, code, best
  • Encrypt-to-model — optional sealed prompts at the gateway boundary
  • Model probe — read-only alias + local vLLM discovery (make model-probe)
export AI_GATEWAY_URL=http://127.0.0.1:4000
export AI_GATEWAY_URL=http://127.0.0.1:4000  # optional SPARK_GATEWAY_KEY
./spark --live examples/ask_live.spark

Retrieval stack — [roadmap]

Spark does not ship first-class retrieve / embed statements yet. Integration targets:

  • Embeddings — Bifrost embed / embed-rag → TEI
  • RAG — rag-gateway POST /v1/retrieve
  • CRAG — gateway-side grade + rewrite for operator audience

Do not claim in-process CRAG until ops and tests exist.

AI coding + Spark IDE

include "lib/ai.spark" + playbooks (playbook catalog in repo), review / builder / implement, and verified ide ops — see IDE status.

Not primary positioning

Generic CLI automation, voice bots, and “replace Python + OpenAI SDK” framing are not Spark’s product story. Voice ops remain documented in the language reference for speech pipelines.

Contributor internals

Bytecode VM and self-host paths: Contributor internals only.