3 ms·
> We can do this by computing the projection of c out onto ^r, and then subtracting this projection away That looks exactly equivalent to multiplying by a matr
by amluto 3y ago
> We can do this by computing the projection of c out onto ^r, and then subtracting this projection away
That looks exactly equivalent to multiplying by a matrix that nulls out that vector and preserves everything else. (This is trivial linear algebra!) One could presumably multiply such a matrix into the model weights to get exactly the same effect, and then one could run the model using any inference engine.
Of course, the project-and-subtract formulation is faster for each projection, and one could premultiply the matrices by projecting-and-subtracting each row or column (depending on which side one wants to multiply on) using the project-and-subtract trick. This would make computing the new weights very fast, even with a slow CPU and no GPU.
- HanClinto 3y ago> That looks exactly equivalent to multiplying by a matrix that nulls out that vector and preserves everything else. (This is trivial linear algebra!) One could presumably multiply such a matrix into the model weights to get exactly the same effect, and then one could run the model using any inference engine. Oh fascinating -- so almost like LoRa weight-adjustment being added to a fully trained model after-the-fact?
- amluto 3y agoIt’s certainly a low rank fine-tune — the weight difference would be rank 1! But I think it’s more useful to think of it as a multiplicative change, not an additive change.
- HanClinto 3y agoNice, thank you! You're adding to my reading list, and I appreciate that! :) I'm still mulling over how difficult it would be to reimplement this with "stock" llama.cpp. It feels like the first step would be to essentially get the "super-embeddings" for each prompt -- instead of grabbing just the text embeddings (which I understand is usually only the narrowest layer?) -- we would want to store off the activations for every layer. Then save them all to a list, average them together, and then figure out a way to use that to modify the weights of the model -- either at runtime (I imagine this much like a current guidance-vector would be loaded), or else (as you suggested) write a script to bake the modifications into the core model (but using multiplication rather than addition). Does that match your understanding? Thank you very much for helping me think this through!