Git Product home page Git Product logo

probes's Introduction

Probes

Workflow for Supervised Probes

For supervised probes, the code is largely based on Azaria and Mitchell's implementation for their paper `The Internal State of an LLM Knows When It's Lying.'. Datasets used were also theirs, or based on theirs.

  1. GenerateEmbeddings.py or LLaMa_generate_embeddings.py on selected datasets to get the embeddings for the last token at specified layer(s) for a specified model. You can use config.json or commandline arguments. Will save CSV files with the embeddings. Make sure to get embeddings for labeled datasets so the probes can be trained. The latter file implements functionality for LLaMA, but since those models aren't fully publicly available, the implementation won't work generally.
  2. TrainProbes.py to train the probes on selected datasets that contain embeddings. You can specify lots of parameters in the config file or with commandline flags. The script will test the probes on a different dataset from the training datasets and save the best (by accuracy) probes.
  3. If you want to use the trained probes on a new dataset (with embeddings), run Generate_Embeddings.py with that dataset selected. Make sure the layer, model, etc. line up with the probes you want to use. It will save the predictions along with the average prediction.

Workflow for CCS (Unsupervised)

For unsupervised probes, the code is almost entirely based on Burn's et al.'s implementation

  1. Again, run GenerateEmbeddings.py but make sure you use ones with negative and positive paired examples. Right now, those are neg_facts_true_false.csv and neg_companies_true_false.csv.
  2. Run Train_CCSProbe.py with the relevant datasets that include embeddings. These are specified in the companion config file CCS_config.json. This will save the CCS probes and also the predictions for the datasets used.
  3. If you want to use the trained probes on a new dataset (that includes embeddings), run Generate_CCS_predictions.py with that dataset specified in the config file. As always, make sure the model, layer, etc. line up with the probe.

probes's People

Contributors

balevinstein avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.