vgel / repeng

A library for making RepE control vectors
https://vgel.me/posts/representation-engineering/
MIT License
419 stars 30 forks source link

vllm implementation #31

Open raywanb opened 2 months ago

raywanb commented 2 months ago

I'm trying to implement control vector into vllm codebase for mixtral model, but I was wondering where should I add the control vector to the layer. Should it be added before attention, fully connected, or after? Thanks @vgel

https://github.com/vllm-project/vllm/blob/a53222544c6385ee314a26fdf42eb14f5b4e5ad9/vllm/model_executor/models/mixtral.py#L270

vgel commented 2 months ago

Awesome, very excited for VLLM support! The control vector gets added after the MLP/FC layer. However, I noticed you linked to Mixtral, not sure if that was intentional but FYI (I should note this more clearly in the README) control vectors don't work on MoEs currently, probably best to implement for dense models only.

raywanb commented 2 months ago

Ok, got it thanks. btw is there a proper way of saving control vectors so ppl can upload them onto HuggingFace?

rexarski commented 2 months ago

Ok, got it thanks. btw is there a proper way of saving control vectors so ppl can upload them onto HuggingFace?

This might help! https://github.com/vgel/repeng/issues/23

vgel commented 1 month ago

@raywanb

Ok, got it thanks. btw is there a proper way of saving control vectors so ppl can upload them onto HuggingFace?

There's an official way now, see #34 !