Skip to content

Getting Started

Mike Wright edited this page Aug 2, 2026 · 2 revisions

Getting Started

The fastest start is the hosted browser playground. It runs the language and tutorials locally in WebAssembly and requires no account or install.

Five-minute browser tour

  1. Open the playground and stay on the REPL tab.
  2. Enter 1 + 2, then [1, 2, 3] * 10.
  3. Enter X : [batch, feat] = reshape(range(6), [2, 3]).
  4. Run labels(X) and reduce_add(X, "feat").
  5. Pick a demo from Load Demo..., then open the Tutorial and ? documentation dialog.
flowchart TD
    Open[Open playground] --> Try[Evaluate an expression]
    Try --> Demo[Load a worked demo]
    Demo --> Inspect[Inspect values and models]
    Inspect --> Tutorial[Follow a learning path]
    Tutorial --> Native{Need files, servers, or GPU?}
    Native -->|No| Browser[Keep using browser mode]
    Native -->|Yes| Build[Build a native workspace]
Loading

Native prerequisites

  • A current Rust toolchain with Cargo.
  • Git and ordinary platform build tools.
  • Optional: Apple Silicon and the MLX build dependencies for MLX.
  • Optional: Linux x86-64, an NVIDIA GPU, a compatible driver/toolkit, and the CUDA feature for CUDA.

The repository is a cellular monorepo made of several Cargo workspaces, not one root Cargo workspace. Run Cargo from the component that owns the binary or crate.

git clone https://github.com/sw-ml-study/sw-mlpl.git
cd sw-mlpl/components/cli
cargo build
cargo run -p mlpl-repl

Run a script from the CLI workspace while referring to the repository-level demo path:

cd sw-mlpl/components/cli
cargo run -p mlpl-repl -- -f ../../demos/basics.mlpl

Useful first commands inside the REPL:

:help
:vars
:builtins
:describe X
:models
:tags
:wsid
:version

A small model

X = [[0, 0], [0, 1], [1, 0], [1, 1]]
mdl = chain(linear(2, 4, 11), relu_layer(), linear(4, 2, 12))
scores = apply(mdl, X)
softmax(scores)

Use :describe mdl to see its structure and parameters. Continue with Language Tour for syntax and concepts, then Use Cases for complete workflows.

Pick an execution mode

Need Recommended mode
Zero install, tutorials, inline visualization Browser and WASM
Files, trace export, scripting, predictable native performance Native CPU
Metal-backed work on an M-series Mac Apple Silicon and MLX
CUDA-backed work on Linux/NVIDIA NVIDIA and CUDA
Browser UI backed by native CPU or GPU Server and Remote Execution

Troubleshooting expectations

  • Browser mode cannot directly read arbitrary local files or spawn host processes.
  • GPU scopes can fall back to CPU when a backend is absent or an accelerated training shape is unsupported. Read the backend page before interpreting a timing result.
  • Small workloads may be faster on CPU because transfer and launch overhead dominate.
  • Repository commands in older docs may show a former monolithic layout. In the current repository, use the owning component workspace.

Source references: README, usage guide, and REPL guide.

Clone this wiki locally