Giter Club home page Giter Club logo

self-icl's Introduction

Self-ICL: Zero-Shot In-Context Learning with Self-Generated Demonstrations

This is the official repository of our paper Self-ICL: Zero-Shot In-Context Learning with Self-Generated Demonstrations, EMNLP 2023.

TL;DR: This work presents Self-ICL, a prompting framework bootstrapping LLMsʼ intrinsic task understanding ability to perform in-context learning via self-generated pseudo-demonstrations.


The Self-ICL prompting framework

Given the [task_description] and a corresponding [test_input], Self-ICL consists of three steps:

  1. Construction of pseudo-inputs.

    • Prompt template (the same prompt is use in both direct prompting and chain-of-thought prompting).
    • Prompt the LLM to generate [num_shot] pseudo-inputs, conditioned on the [task_description] and [test_input].
  2. Construction of pseudo-labels.

  3. In-context learning with pseudo-demonstrations.

Steps to Reproduce Paper Experiments

One may follow the steps below to reproduce the experiments. As an example, the following steps reproduce the text-bison-001 column in Table 3.

Setup API Keys

Set the corresponding environment variables to your API keys. For example, GOOGLE_API_KEY for PaLM-2, and OPENAI_API_KEY for GPT models.

export GOOGLE_API_KEY=<your_api_key>

Configure the Experiment Settings

Set the configuration file in ./configs to your experiment settings. For example, the ./configs/config_template_standard.yml file records the settings for running the ZS-Direct prompting method using the text-bison-001 API endpoint.

Run the Prompting Script

Run the following script to run different prompting methods and log output to log_path in the YAML file:

python experiment.py \
  --config_path ./configs/config_template_standard.yml \
  --label_type "class"

Note that one may need to configure other command line arguments in other experiments (please refer to experiment.py for more details).

Run the Evaluation Script

After finishing the previous step, you may evaluate the performance by running:

python experiment.py \
  --config_path ./configs/config_template_standard.yml \
  --label_type "class" \
  --eval

The evaluation results would be stored in the log_path along with model outputs from the previous step.

self-icl's People

Contributors

brian-ckwu avatar wlchen0206 avatar

Stargazers

Xinlin Zhuang avatar

self-icl's Issues

Reproduce help: What is your augmented dataset?

Hi! Your work is excellent. And I want to reproduce your work.

However, the seeds and selection methods of subset are unknown. Besides, the outputs of OpenAI API are random which makes it hard to compare your method.

If you have a whole augmented dataset and complete code, it would be nice.

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.