This reminds me of control vectors, especially this line in the linked DwarfStar repo:
> y = y - scale * direction[layer] * dot(direction[layer], y)
From https://vgel.me/posts/representation-engineering/
> A control vector is a vector (technically a list of vectors, one per layer) that you can apply to model activations during inference to control the model's behavior without additional prompting