Skip to content

feat: lens and steering in the engine, embeds generation, new protocol methods, and various fixes/optimizations - #34

Merged
hijohnnylin merged 1 commit into
mainfrom
engine-next
Oct 9, 2026
Merged

hijohnnylin merged 1 commit into
mainfrom
engine-next

Conversation

@hijohnnylin

Copy link
Copy Markdown
Contributor

Summary

New features for every backend: the lens in the engine, steering in generation and capture, reads of an activation through a LoRA adapter, and a single-model HTTP server. This is a minor release. Nothing is removed. The old APIs that changed remain as deprecated shims.

Added

  • Lens
    • generate_with_lens() on every backend.
    • Named J_bar sets: two Jacobian lenses (for example J and J++) can be loaded together.
    • A faster lens read-out, and a live residual feed.
  • Steering
    • Steer at more than one point with a list of specs (Steering).
    • New ops: NormScaledAddSpec, AblateSpec, SwapSpec.
    • steer() blocks can skip positions, and they reach generation and capture on vLLM too.
    • SteerMethod, steering_from_directions, and the TransformerLens steer mapping.
  • LoRA reads: a PEFT adapter reads one residual vector out as text, on eager and vLLM. The text for each layer can stream.
  • Protocol additions (every backend)
    • describe().
    • A per-token generation stream, and the engine's own tokenize.
    • unembed_rows.
    • generate_steps_from_embeds, and sample_from_embeds (n completions of one embeds prompt in one request).
    • A check for whether the model serves a point.
    • The sampling recommendation from generation_config.json.
  • Capture: capture() is the new name, and run_with_cache stays as an alias. Also new:
    • capture(rows=...);
    • correct positions for padded rows;
    • last-token capture;
    • capture on the speculative engine and on compiled decode steps.
  • HTTP server: python -m interp_engine.server serves one model, with /v1/project and /v1/lens.
  • API manifest: api/engine.yaml generates interp_engine/api.py, with conformance fixtures.

Fixed

  • A vLLM worker that runs out of memory now fails only that request, not the engine.
  • release() frees the engines.
  • select_backend names the backend. It refuses a backend that the machine cannot run before it loads anything.
  • Clearer eager refusals for quantized checkpoints, and for FP8 on transformers 5.11 to 5.16.
  • Tokenize span fixes, and HubMirror read-through.

Deprecated

These still work and give a DeprecationWarning. They will be removed in a later major release.

  • VLLMModel.generate_from_embeds(prompt_embeds, sampling_params): use generate_steps_from_embeds or sample_from_embeds.
  • lens_intervention= on capture_generation, capture_generation_stream and lens_capture_readout_stream: use a steer() block with NormScaledAddSpec / AblateSpec / SwapSpec.

Tooling

  • Validator: Qwen3.5-0.8B and gemma-4-E2B added. The result headings show the engine version.
  • GPU sizer: a speculative drafter field.
  • Visualizer: a point card.
  • The server extra is in the lock file.

Testing

  • CPU: 2641 passed. Validator: 541 passed. ruff, pyright, the API manifest check and the visualizer checks pass.
  • GPU (A100 80GB): the vLLM GPU tests pass, except for 2 failures that also occur before this change. On a production-config pod, tokenize, J and J++ lens, LoRA read and steering gave the same answers as the current production engine.

Comment thread interp_engine/server/app.py Dismissed
@hijohnnylin
hijohnnylin marked this pull request as ready for review October 9, 2026 23:27
@hijohnnylin
hijohnnylin merged commit 3f7e4fd into main Oct 9, 2026
10 checks passed
@hijohnnylin
hijohnnylin deleted the engine-next branch October 9, 2026 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants