Files
weight-steering/src/ws/steer.py
T
wassname 4ad6971038 tidy
2026-04-25 19:27:53 +08:00

9 lines
346 B
Python

"""Apply scaled weight diff at inference time via baukit hooks.
We don't mutate the base model's weights. Instead, for each affected nn.Linear,
register a forward hook that adds (alpha * w_layer @ x) to the output. This
lets us sweep alpha cheaply without re-loading the model.
Reference: baukit.TraceDict (see davidbau/baukit/nethook.py).
"""