Enhance open LLM outputs with precision rotation edits.
Project details
Laplace’s Scissors enables meticulous manipulation of LLM outputs through readout rotation. By diagnosing weak directions and preserving successful generations, it refines AI responses while leveraging Rust and Triton on CUDA/HIP, ensuring accuracy in scaling analysis and repairs.
Laplace's Scissors is an advanced tool designed for open LLMs (Large Language Models) that implements output matrix rotations for meaningful edits while safeguarding successful answers. This repository leverages Rust, Triton, and CUDA/HIP to effectively address the challenges of weak output directions, rectify flawed outputs, and analyze deviations across model scaling.
probe command to identify directions with low discrimination, assess cancellation effects across layers, and trace weight coordinates contributing to the model responses.diagnose command identifies potential plane or joint rotations to fix erroneous outputs in line with expected answer strings, ensuring the preservation of successful generations through GPU validations.The process begins with fetching a model, inspecting its structure, and tracing weak discrimination directions using:
cargo run --release -- fetch Qwen/Qwen3-0.6B
cargo run --release -- inspect Qwen/Qwen3-0.6B --out "$LAPLACE_CACHE/graph.json"
Subsequently, users can diagnose potential rotations and propose fixes by comparing expected outputs:
cargo run --release -- diagnose Qwen/Qwen3-0.6B ...
Finally, you can generate output using the original or modified model:
cargo run --release -- generate Qwen/Qwen3-0.6B ...
| Purpose | Command | Outputs |
|---|---|---|
| Fetch model details | fetch, inspect | Structure and execution graph |
| Trace weak directions | probe | Diagnostic outputs |
| Repair outputs | diagnose | Rotations and proposals |
| Generate responses | generate | Answers based on edits |
| Export edits | export | New model checkpoint |
| Analyze scaling | scale | Loss curves and weight contributions |
Laplace's Scissors provides a powerful infrastructure for enhancing LLM outputs through innovative editing techniques. By integrating diagnostic capabilities and rigorous analysis workflows, this tool ensures the generation of high-quality responses while maintaining the necessary safeguards for existing successful outputs.
For full functionality, review additional documentation such as DESIGN.md for computation contracts and core design principles.
Comments
0Start the conversation
Share the first comment.