Giter Club home page Giter Club logo

era-cot's Introduction

ERA-CoT: Improving Chain-of-Thought through Entity Relationship Analysis

This is the codebase of the paper: ERA-CoT: Improving Chain-of-Thought through Entity Relationship Analysis.

Framework of ERA-CoT

[2024/05/17]πŸ”₯ We are happy to announce ERA-CoT has been accepted to ACL 2024 main conference!

[2024/03/28]πŸ”₯ We are releasing the version 1.0 for running on Llama2 model.

How to Use

Update your environment for the required dependency.

pip install -r requirement.txt

Get your Llama2 weight on https://huggingface.co/meta-llama/Llama-2-7b-chat-hf/tree/main, set up on default directory: /root/llama-2-7b-chat-hf (You can change the dir on era-cot/config.py)

Running the code:

python main.py --dataset gsm8k \
--engine llama2-7b \
--temperature 0.3

Set up for your dataset

  • Upload your json version of dataset on era-cot/dataset.

  • Setting for loading your dataset on utils.

Example

if args.dataset.lower() == 'commonsenseqa':
      json_res = decoder.raw_decode(line)[0]
      choice = "Answer Choices:"
      for c in json_res["question"]["choices"]:
            choice += " ("
            choice += c["label"]
            choice += ") "
            choice += c["text"]
            q = json_res["question"]["stem"].strip() + " " + choice
            a = json_res["answerKey"]
            id = 'temp_{}'.format(idx)
      questions.append(q)
      answers.append(a)
      ids.append(id)

Different Dataset Results

✨ERA-CoT

  • Entity extraction on text and finds out all the explicit relationships mentioned in the text.
  • Gradually infers the possible implicit relationships involved between entities based on the explicit relationships.
  • Scores and filters the reliability of these implicit relationships.
  • Finally answers questions based on these entity relationships.

Result

Citation

If you found that ERA-CoT helps your work, please cite:

@article{liu2024era,
  title={ERA-CoT: Improving Chain-of-Thought through Entity Relationship Analysis},
  author={Liu, Yanming and Peng, Xinyue and Du, Tianyu and Yin, Jianwei and Liu, Weihao and Zhang, Xuhong},
  journal={arXiv preprint arXiv:2403.06932},
  year={2024}
}

License

For academic and non-commercial use only.The whole project is under the CC-BY-NC 4.0 license. See LICENSE for additional details.

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.