Git Product home page Git Product logo

llm-classifier's Introduction

Self-Hosting LLMs for Unsupervised Data Labeling

Website Medium Blog License: MIT

Description

The accompanying code to produce the results in . Compares various LLMs in their ability to do zero- and few-shot text classification.

Table of Contents

Installation

After cloning this repo and installing Poetry, run poetry install, then, poe accelerate (because poetry struggles with torch)

To download a model run: python utils/download.py hugging-face-model

Usage

Reproduce the experiment results by running the two bash files with bash pretrain_comparison.sh and bash two_stage. This will produce a consolidated file of the perforamnce metrics by run in data/results.csv.

To do an individual pass of data through an LLM, use the following command:

run -f path/to/data -t task -m hugging-face-model

Optionally, you can pass the flags:

  • examples / -e: Whether to use zero or few shot learning.
  • new_tokens \ -n: The number of tokens for the model to generate.

New tasks can be added using the format in utils/prompt.py. Model config is housed in utils/model.py and can be customized there.

To train a self-supervised model on many examples, run:

train -f path/to/data -t task

Optionally, you can pass the flags:

  • -confident / -c: Enables Confident Learning which filters out likely mislabeled data

Results

Accuracy

evaluate

model examples partisanship topic all
gpt-3.5-turbo few 0.46 0.62 0.54
gpt-3.5-turbo zero 0.31 0.64 0.47
TheBloke/Wizard-Vicuna-13B-Uncensored-HF zero 0.34 0.20
nomic-ai/gpt4all-13b-snoozy zero 0.35 0.12 0.23
nomic-ai/gpt4all-13b-snoozy few 0.13 0.33 0.23
NousResearch/Nous-Hermes-13b zero 0.32 0.09 0.20
TheBloke/Wizard-Vicuna-13B-Uncensored-HF few 0.20 0.15 0.17
TheBloke/stable-vicuna-13B-HF zero 0.13 0.16 0.14
NousResearch/Nous-Hermes-13b few 0.17 0.08 0.13
TheBloke/stable-vicuna-13B-HF few 0.19 0.06 0.13
nghuyong_ernie_2.0-base-en many - 0.63 -
nghuyong_ernie_2.0-base-en many_confident - 0.61 -
distilbert-base-uncased many_confident - 0.44 -
distilbert-base-uncased many - 0.39 -

Speed

All models run on a single Nvidia A100

Model Runtime (per)
distilbert-base-uncased 0.0153
nghuyong_ernie_2.0-base-en 0.0155
nomic-ai/gpt4all-13b-snoozy 0.7451
TheBloke/Wizard-Vicuna-13B-Uncensored-HF 0.7485
TheBloke/stable-vicuna-13B-HF 0.7572
NousResearch/Nous-Hermes-13b 0.9320

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.