GithubHelp home page GithubHelp logo

naturallanguageprogram's Introduction

Project

This project introduces the Learning to Program (LP) method, which aims to learn the task program in text form from the training set using Large Language Models (LLMs) themselves. The method then uses the learned program to guide LLMs to solve complex tasks. Our method only requires access to LLMs and does not need to update their parameters. Unlike previous self-critiquing methods, this method attempts to improve task performance by learning task programs from the training datapoints provided by humans. It also allows LLMs to learn and utilize new knowledge from the training set.

Also, we hope that our new learning diagram can inspire the research community to investigate learning algorithms based on natural language. The learned task experience in this kind of learning algorithm is written in natural language, making it understandable to humans. Additionally, the learned content may provide insights into understanding the behavior of LLMs.

This project is still a work in progress.

Requirements

please install these packages first.

pip install openai
pip install numpy
pip install backoff

Then put your openai API in the api_dict of the openai_public.py file (Line 13).

Training

We provide 10 tasks from the AMPS dataset here (paper: Measuring Mathematical Problem Solving With the MATH Dataset). You can find the details of the tasks in Table 1 of our paper: Learning to Program with Natural Language.

python learning_to_program.py --name 1 --model --path xxx
                              --epoch 10 --batch_size 32 --valid_size 3 
                              --T 5 --threshold 1.0 --few False  
                              ## name:task id; model:LLMs; path: the file path; 
                              ## T:the number of revision candidates; few #whether activate the few-shot CoT setting

Checking the learned task program

During the training process, the validation performance, test performance and current task program would be printed.

After the training process, you can check the learned task program in the file: khan_topic_{task_id}.npy.

naturallanguageprogram's People

Contributors

gydpku avatar microsoftopensource avatar microsoft-github-operations[bot] avatar

Stargazers

Brad avatar

Watchers

 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.