LispM LLM — Open-Vocabulary Dual-Tower Command Router for Emacs

Route natural-language English into open-vocabulary Emacs and LispM actions (one or two distinct operations per request) using a local Dual-Tower Bi-Encoder (biencoder/, 264,322 parameters) alongside the preserved 48-action reference classifier (184,625 parameters). Rust + tch-rs / LibTorch handles local inference, dynamic catalog indexing, silent continual learning, training and evaluation.

Built for bounded command routing in an Emacs agent harness:

  • Open ActionCatalog (biencoder/): encodes both user clauses and action descriptors (ActionSpec) with a shared word + 2,048-bucket character n-gram Transformer and scale-invariant lexical-subword alignment, routing across the 48 core actions, dynamically harvested lispm-kit-define-commands tables, and registered Emacs commands without architectural changes or evaluators.
  • Silent continual learning (lispm-llm-learn-mode): combines instant sub-millisecond episodic recall (episodic.json), a poison-resistant join-semilattice quarantine ledger (Consistent | Conflicted), automatic PII literal scrubbing, idle background retraining, and an online circuit breaker.
  • Safety boundary: no model-generated S-expression is ever read or evaled; every target symbol is checked against a strict public-symbol grammar, mode scope, typed argument contract, and evaluator/shell denylist.

Explore the wider LispM agent environment at lispm.ai · Technical Paper (PDF) · Paper (Markdown).

Quick start

Clone this repository and install Rust. On macOS Apple Silicon, fetch verified LibTorch 2.9.0 native libraries without Python:

bash scripts/setup-libtorch.sh
export LIBTORCH="$PWD/.libtorch/2.9.0/torch"

# Open-vocabulary Dual-Tower Bi-Encoder (supports --catalog and --mode)
cargo run --release --locked -- infer --model biencoder 'save the current buffer'
cargo run --release --locked -- infer --model biencoder 'open file "notes.el"' --format json

# Preserved 48-action closed classifier
cargo run --release --locked -- infer --model . 'save the current buffer'

See the Rust build guide for other platforms. Bi-encoder artifacts consist of config.json, model.safetensors, and catalog.json.

Emacs users: build the Rust FFI module and install lispm-llm-0.3.0.tar (containing lispm-llm.el, lispm-llm-catalog.el, lispm-llm-learn.el, and lispm-llm-train.el). Enable lispm-llm-learn-mode to harvest active Emacs and lispm-kit commands into <workspace>/catalog.json and learn from corrections automatically. See the Emacs setup guide, Training workflow, and Continuous collection skill.

Request Lisp output Source
save the current buffer (save-buffer) Core 48 catalog
open file "notes.el" then split right (progn (find-file "notes.el") (split-window-right)) Two-clause composition
open the 1password vault (lispm-1password) Zero-shot open catalog
open magit git status (magit-status) Harvested Emacs command
copy the totp verification code (in lispm-1password-mode) (lispm-1password-copy-totp) Mode-scoped lispm-kit

Evaluation

The root 48-action checkpoint (.) remains untouched for provenance stability. biencoder/ (264,322 parameters) and semantic-trained/ (189,425 parameters) are evaluated on identical frozen 48-action regression, blind, and real Emacs task suites. Supported rows show correct / wrong / rejected:

Benchmark Default 48-cls (.) semantic-trained/ Open biencoder/
Supported wording regression (286) 266 / 6 / 14 271 / 6 / 9 256 / 2 / 28
Two-action recombinations (2,256) 2,028 / 19 / 209 2,071 / 8 / 177 2,050 / 34 / 172
Independent blind single actions (118) 107 / 1 / 10 114 / 1 / 3 100 / 1 / 17
Independent blind two-action requests (71) 54 / 2 / 15 62 / 0 / 9 66 / 1 / 4
Unsupported regression: false accepts (126) 11 6 7
Blind unsupported: false accepts (88) 2 1 4
Real Emacs 31.1 task execution (30) 30 / 30 30 / 30 30 / 30

Real Emacs tasks: all three models reach 30/30 goal states on Emacs 31.1 (21 single-action, nine two-action) in isolated batch Emacs processes. Unlike the closed classifiers, biencoder/ additionally routes newly registered or harvested lispm-kit and Emacs actions zero-shot without retraining, and supports continual workspace consolidation over extended catalogs. Three-or-more-step plans, conditions and loops remain unsupported. Benchmark methods, reports and reproduction

Technical Paper (PDF) · Paper (Markdown) · Core & open action catalog · Rust training and validation · Reusable training skill · Hugging Face artifacts and optional Python API · LispM API mapping

Code, synthetic data and weights: AGPL-3.0-only.

Downloads last month
88
Safetensors
Model size
185k params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support