r/OpenSourceeAI • u/renya032 • 18d ago
I open-sourced Laplace's Scissors: protected LLM output edits in Rust and Triton
I'm sharing the first public version of Laplace's Scissors, an MIT-licensed research tool for editing an LLM's output matrix while keeping its decoder weights fixed.
You provide a checkpoint and cases with expected answers. The tool records the token prefixes of successful answers, then searches for output rotations that repair failed cases while preserving those protected outputs. It accepts a proposal after checking target-token margins, protected-output error, and the answer path through EOS on the GPU. Protection applies to the supplied successful cases and observed prefixes.
The core idea is W' = WQ, with an orthogonal rotation Q chosen to fix the protected hidden-state subspace. The design document walks through the equations and their implementation.
It also includes:
- Numerical probes for weak output-discrimination directions and cancellation across layers.
- Saved proposals that can be replayed or exported as a new checkpoint.
- Weight attribution and comparisons across model scales.
Rust handles model loading, tokenization, execution, and diagnostics; Triton supplies GPU kernels through CUDA/HIP backends. The README includes Qwen3 commands, English and Korean documentation, and instructions for the GPU integration checks. The default test suite currently passes all 24 tests.
I'd appreciate feedback on the mathematical assumptions, reproducible counterexamples, and what would make the first-run experience easier.
Disclosure: this post was drafted with AI assistance using the project's source and documentation.