Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding topic steering on layers #5119

Closed
benxh1995 opened this issue Jan 24, 2024 · 4 comments
Closed

Adding topic steering on layers #5119

benxh1995 opened this issue Jan 24, 2024 · 4 comments
Labels
enhancement New feature or request stale

Comments

@benxh1995
Copy link

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • [ x ] I am running the latest code. Development is very rapid so there are no tagged versions as of now.
  • [ x ] I carefully followed the README.md.
  • [ x ] I searched using keywords relevant to my issue to make sure that I am creating a new issue that is not already open (or closed).
  • [ x ] I reviewed the Discussions, and have a new bug or useful enhancement to share.

Feature Description

Add the ability to set/apply steers on a layer by layer basis in order to ensure alignment with specific concepts, tokens or words.

Motivation

Based on recent papers and research on LLM steerability through applying steers on specific layers, I believe that llama.cpp would greatly benefit from incorporating a feature like this.

The colab in the section below should provide a very interesting application which results in far higher reasoning abilities, for example from a 3B.

Possible Implementation

Links to known implementations:
https://github.com/Mihaiii/llm_steer
https://colab.research.google.com/github/Mihaiii/llm_steer/blob/main/demo/llm_steer_demo.ipynb

And

https://github.com/nrimsky/LM-exp/tree/main/steering

@benxh1995 benxh1995 added the enhancement New feature or request label Jan 24, 2024
@Engininja2
Copy link
Contributor

Fyi there was draft PR experimenting with steering vectors #1472.

@peerschuett
Copy link

peerschuett commented Feb 6, 2024

I took a look at #1472 , but the structure of llama.cpp changed in the meantime too much. In #1472 the steering was done in this function https://github.com/ggerganov/llama.cpp/blob/95dc4d7270e04bef3792a61be9bb045cb74a9fc4/llama.cpp#L1132 , but the whole function doesn't exist in this form any more.

Copy link
Contributor

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Mar 18, 2024
Copy link
Contributor

github-actions bot commented Apr 2, 2024

This issue was closed because it has been inactive for 14 days since being marked as stale.

@github-actions github-actions bot closed this as completed Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale
Projects
None yet
Development

No branches or pull requests

3 participants