Giter Club home page Giter Club logo

explanation_based_ethical_reasoning's Introduction

Enhancing Ethical Explanations of Large Language Models through Iterative Symbolic Refinement

An increasing amount of research in Natural Language Inference (NLI) focuses on the application and evaluation of Large Language Models (LLMs) and their reasoning capabilities. Despite their success, however, LLMs are still prone to factual errors and inconsistencies in their explanations, offering limited control and interpretability for inference in complex domains. In this paper, we focus on ethical NLI, investigating how hybrid neuro-symbolic techniques can enhance the logical validity and alignment of ethical explanations produced by LLMs. Specifically, we present an abductive-deductive framework named Logic-Explainer, which integrates LLMs with an external backward-chaining solver to refine step-wise natural language explanations and jointly verify their correctness, reduce incompleteness and minimise redundancy. An extensive empirical analysis demonstrates that Logic-Explainer can improve explanations generated via in-context learning methods and Chain-of-Thought (CoT) on challenging ethical NLI tasks, while, at the same time, producing formal proofs describing and supporting models' reasoning. As ethical NLI requires commonsense reasoning to identify underlying moral violations, our results suggest the effectiveness of neuro-symbolic methods for multi-step NLI more broadly, opening new opportunities to enhance the logical consistency, reliability, and alignment of LLMs.

framework

Installation

To get the libraries:

pip install -r requirements.txt

Reproducibility

This project use the Prolog interpreter sProlog as the neuro-symbolic solver.

You can set your OPENAI_KEY in ./config.json

Run:

python logic_reasoning.py -data DATASET_NAME

The results will be recorded into ./results/DATASET_NAME

Data

The annotated corpus ExplainETHICS can be found at ./data/simple_question.csv for easy moral scenarios and ./data/hard_question.csv for challenging moral scenarios.

ExplainETHICS provides a gold explanatory chain leading to a moral violation identified in specific moral scenarios, which are originally sourced from the paper Aligning AI With Shared Human Values.

If you find this repository useful, please consider citing our paper.

@misc{quan2024enhancing,
      title={Enhancing Ethical Explanations of Large Language Models through Iterative Symbolic Refinement}, 
      author={Xin Quan and Marco Valentino and Louise A. Dennis and André Freitas},
      year={2024},
      eprint={2402.00745},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}

explanation_based_ethical_reasoning's People

Contributors

xinquan42 avatar

Stargazers

Darya Baranouskaya avatar

Watchers

Danilo S. Carvalho avatar Marco Valentino avatar Kostas Georgiou avatar

Forkers

dipsec

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.