/docs/latentscript
A small, typed DSL for latent-space manipulation — with explicit inputs/outputs, deterministic validation, and safety gates.
Design goal
Auditable latent ops
No hidden side-effects. Every transform is explicit.
Core idea
Typed vector spaces
Dimensions + space tags are validated.
Safety
Constraints + gated emit
No decode/emit unless constraints pass.
LATENTSCRIPT is typed, validator-first, and built for ML engineers doing prompt steering, embedding/activation engineering, and latent-vector pipelines.
Minimal example
set max_norm = 20.0;
let p : prompt = "Make this more formal";
let v = encode(p, encoder="emb:my-encoder") @space("emb:my-encoder");
let dir = encode("more formal", encoder="emb:my-encoder") @space("emb:my-encoder");
let v2 = shift(v, dir, alpha=1.0);
constraint bounded : norm(v2) <= 20.0;
emit v2 as "json"; Value types
Core built-ins
Safety model (validator-first)
Most teams start with notebooks, prompt templates, or ad-hoc vector scripts. That works — until you need audits, reproducibility, and safety gates across environments.
| Approach | What it's great for | Where it breaks | LATENTSCRIPT advantage |
|---|---|---|---|
| Raw prompt engineering | Fast iteration, simple style steering | Hard to quantify, brittle, no typed safety gates | Explicit transforms + constraints; reproducible intent |
| Notebooks + Python scripts | Research prototypes, full flexibility | Difficult to audit; policy enforcement is ad-hoc | Small surface area; validator-friendly; portable pipelines |
| LCEL / orchestration graphs | Tool routing, chains, agent workflows | Not a first-class language for latent geometry | Geometry primitives (project/orthogonalize) as core |
| Activation steering scripts | Feature-level control, SAE/probing workflows | Opaque policy; difficult to describe + share safely | Space tags + hard bounds + gated emit for safer sharing |
Operational win
Auditability
A small DSL is easier to diff, review, and gate than free-form code.
Engineering win
Portability
Same program can target embeddings, activations, or SAE spaces via runtime backends.
Safety win
Constraint-first
Hard bounds and explicit emit gating are built into the language.
This in-browser playground runs a lightweight validator + compiler preview (no model calls). It shows how a runtime would interpret bindings, settings, and emissions.
Program (.ls)
Tip: the preview compiler understands set, let, constraint, emit, and simple annotations like @space("...").
Preview output
Validation
Compiled manifest (preview)
Validator-first tooling is free. Production runtimes (model backends, policy modules, and governance) are available as hosted or enterprise deployments.
LATENTSCRIPT v0.1 tiers (draft)
Starter
$0
Parser + validator for local workflows.
Pro (hosted)
$99/seat/mo
Production runtime with backend connectors.
Enterprise
Custom
On-prem + governance integrations.
Pricing shown is a draft for presentation purposes. Final tiers depend on which model backends, vector spaces, and compliance requirements your deployment needs.