immutable_explainable_bbr

This repository includes the required code for an accountability and a explainability architecture implemented for ROS 2-based robots. It is based on the use of blockchain to guarantee immutability and integrates Retrieval-Augmented Generation approach for Large Language Models solution to generate natural language explanations.

https://github.com/laurafbec/immutable_explainable_bbr

Science Score: 57.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in README
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.1%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

This repository includes the required code for an accountability and a explainability architecture implemented for ROS 2-based robots. It is based on the use of blockchain to guarantee immutability and integrates Retrieval-Augmented Generation approach for Large Language Models solution to generate natural language explanations.

Basic Info
  • Host: GitHub
  • Owner: laurafbec
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 365 KB
Statistics
  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created over 2 years ago · Last pushed about 1 year ago
Metadata Files
Readme Citation

README.md

Immutable & Explainable Black Box Recorder

This repository includes a ROS 2 accountability and explainability solution based on the use of Rosbag2, Blockchain and Large Language Models. This approach provide an immutable and explainable Black Box Recorder, indentifying the causes that have triggered a set of specific events and providing natural and meaningful explanations to non-expert users.

Software artifacts

ROS 2 Humble

RB1 simulator for ROS 2

AWS RoboMaker Hospital World ROS package available here.

The following images show the floor plan of the scenario used in the development of this work, including in the second one an obstacle in the route initially calculated to reach the goal destination. This obstacle will force the change of the pre-computed path.

imagen

imagen Screenshot from 2024-02-19 17-45-53

npm v9.6.7

Node.js v18.17.0

Ganache v2.7.1

Solidity v0.8

LocalGPT

Usage

Accountability approach

Recording service

After starting the simulation, immutable black-box recording information service can be started with the command ros2 launch tamper_proof_bag_recorder tp_bag_recorder.launch.py The previous recording service can be started and stopped by running ros2 service call /tp_bag_recorder_srv std_srvs/srv/SetBool data:\ true ros2 service call /tp_bag_recorder_srv std_srvs/srv/SetBool data:\ false Output example [INFO] [tp_bag_recorder_srv-1]: process started with pid [15535] [tp_bag_recorder_srv-1] [INFO] [1700671326.257738212] [tp_bag_recorder_srv]: Initial nonce 92fcd02be0566fb23f8aff37ec7fd4900fcd96b7973623ab80cf2f23742e9e4e [tp_bag_recorder_srv-1] [INFO] [1700671365.555115050] [tp_bag_recorder_srv]: Sending transaction...

Solidity contract deployment

The deployment of the Solidity contract containing the blockchain logic can be done through the command ros2 run tamper_proof_bag_recorder contract_deployment After every deployment, the contract address muy be updated here.

Output example Contract Address: 0x7223a08911947C7351B75EA41266Cb695c72124e

Hash chain generation

Hash chain can be generated by using the command ros2 launch tamper_proof_bag_recorder bag_reader_chained_proofs.launch.py Output example [INFO] [bag_reader_chained_proofs-1]: process started with pid [33763] [bag_reader_chained_proofs-1] [INFO] [1704890660.493952991] [bag_reader_chained_proofs]: URI: /home/laura/ros2_ws/rosbag_output/bag_20240109-1958675830/bag_20240109-1958675830_0.mcap [bag_reader_chained_proofs-1] [INFO] [1704890660.494336704] [bag_reader_chained_proofs]: Initial nonce: 71b31d8ca5ea07527f39dcb391e0852cdf0fc77f8475d92672fc9888924a40bc [bag_reader_chained_proofs-1] [INFO] [1704890660.538509840] [bag_reader_chained_proofs]: Stored hash: c3066d23ed8ea92b7f40d6526f48b772aaa1e17e45b14bbf3fa61cee3c2d1970 [bag_reader_chained_proofs-1] [INFO] [1704890660.539432615] [bag_reader_chained_proofs]: Stored hash: a9be65ea92a8827fc7f38ab9936455a8d0542eedaf1d3e03f1418b207217d0bb [bag_reader_chained_proofs-1] [INFO] [1704890660.622635528] [bag_reader_chained_proofs]: Stored hash: be7d1f5720e985ddf4dc54cfd06ac5cb4d1663a33be030727ce1e9499c6a55b4 [bag_reader_chained_proofs-1] [INFO] [1704890660.687805750] [bag_reader_chained_proofs]: Stored hash: b1ad4602af653f04726942bbe9eb26e223435cf8f06f7566860391592e2bf804 [bag_reader_chained_proofs-1] [INFO] [1704890660.803056400] [bag_reader_chained_proofs]: Stored hash: d69fdb8348b87353013b89970f105b4a0fbc333816f215df4e1dd9ed06dba47c [bag_reader_chained_proofs-1] [INFO] [1704890660.805142535] [bag_reader_chained_proofs]: Stored hash: 5171ba85ce3f3ab6fece2c855bfbb62e4403747175ad69a3407d438ee03520f5 [bag_reader_chained_proofs-1] [INFO] [1704890660.813931821] [bag_reader_chained_proofs]: Stored hash: f704fd34db8c52d8df98222ba57d757f0c1bc746c54e4df866f087c6d536ca30 [bag_reader_chained_proofs-1] [INFO] [1704890660.815299259] [bag_reader_chained_proofs]: Stored hash: 3b0f6e4996dbad2c36fb3f6920408cffb65feac574dbdc87141f3a7376b44375 [bag_reader_chained_proofs-1] [INFO] [1704890660.901192472] [bag_reader_chained_proofs]: Stored hash: c3066d23ed8ea92b7f40d6526f48b772aaa1e17e45b14bbf3fa61cee3c2d1970 ....

Hash verification

The storagement of a hash value in blockchain ca be checked by running ros2 launch tamper_proof_bag_recorder proof_checker.launch.py ``` ros2 service call /proofchecker custominterfaces/srv/ProofCheckerServiceMessage "proof: 'c3066d23ed8ea92b7f40d6526f48b772aaa1e17e45b14bbf3fa61cee3c2d1970'" requester: making request: custominterfaces.srv.ProofCheckerServiceMessageRequest(proof='c3066d23ed8ea92b7f40d6526f48b772aaa1e17e45b14bbf3fa61cee3c2d1970')

response: custominterfaces.srv.ProofCheckerServiceMessageResponse(answer='The hash value is stored in the block number 3946 on the Blockchain network') ```

Log curation service

Log curation and Rosbag raw data processing can be performed by running ros2 launch bag_interpreter bag_interpreter.launch.py Ouput example ... 1697364961 Reached the goal! 1697364961 Goal succeeded 1697364961 Navigation to the goal number 1 has succeeded. 1697364961 Navigation to the goal number 2 has started. 1697364961 Navigation to the goal number 2 is in progress. 1697364961 Begin navigating from current location to (-9.22, -25.83) 1697364961 Planned path has changed when trying to achieve goal pose number 2 because there was an obstacle. 1697364961 Received a goal, begin computing control effort. 1697364962 Position: -8.033873568508627, -5.402810116401644. Orientation: -0.5349317741800156,0.8448952579891905 1697364962 Position: -8.00169543883381, -5.4981517190531815. Orientation: -0.6180766464102208,0.7861178405063041 1697364962 Position: -7.984887035142159, -5.636550782605349. Orientation: -0.6988069948819524,0.7153102710740669 1697364962 The trajectory has been replanned in order to achieve the goal pose. ... Service parameters are set here.

Explainability evaluation

GPT-4 evaluation over LocalGPT can be executed by running python assisted_evaluation.py Ouput example ``` ... 2024-02-06 19:42:37,276 - INFO - assistedevaluation.py:121 - Running on: cpu 2024-02-06 19:42:37,276 - INFO - assistedevaluation.py:122 - Display Source Documents set to: False 2024-02-06 19:42:37,276 - INFO - assistedevaluation.py:123 - Use history set to: False 2024-02-06 19:42:39,696 - INFO - SentenceTransformer.py:66 - Load pretrained SentenceTransformer: hkunlp/instructor-xl load INSTRUCTORTransformer maxseqlength 512 2024-02-06 19:42:51,418 - INFO - runlocalGPT.py:63 - Loading Model: TheBloke/Llama-2-7b-Chat-GGUF, on: cpu 2024-02-06 19:42:51,418 - INFO - runlocalGPT.py:64 - This action can take a few minutes! 2024-02-06 19:42:51,418 - INFO - loadmodels.py:38 - Using Llamacpp for GGUF/GGML quantized models ggmlinit_cublas: found 1 CUDA devices: ... Question: Has the robot re-planned an alternative trajectory at any time during navigation? Real Answer: Yes, the robot has re-planned an alternative trajectory at least once during navigation. Predicted Answer: Yes, based on the provided context, the robot has re-planned an alternative trajectory at least once during navigation. This is indicated by the message "Planned path has changed when trying to achieve goal pose number 2 because there was an obstacle." in the context. Predicted Grade: CORRECT


{'reasoning': "The assistant's response is accurate and aligns perfectly with the question asked by the user. The assistant correctly identified and confirmed that the robot had re-planned an alternative trajectory during navigation. The response is concise with no superfluous information and is well-structured and coherent. The assistant's response is also very helpful as it confirms and explains the occurrence of the robot's navigation behavior.\n\nAccuracy: [[10]]\nConciseness: [[10]]\nCoherence: [[10]]\nHelpfulness: [[10]]", 'score': 1.0} ```

Acknowledgments

DMARCE_logo drawio

DMARCE (EDMAR+CASCAR) Project: EDMAR PID2021-126592OB-C21 -- CASCAR PID2021-126592OB-C22 funded by MCIN/AEI/10.13039/501100011033 and by ERDF A way of making Europe

DMARCE_EU eu_logo

TESCAC

Owner

  • Login: laurafbec
  • Kind: user

Citation (CITATION.cff)

cff-version: 1.2.0
title: "Enhancing Trust in Autonomous Agents: An Architecture for Accountability and Explainability through Blockchain and Large Language Models"
message: "If you use this repository, please cite it using the metadata
  from this file."
type: dataset
authors:
  - family-names: "Fernández-Becerra"
    given-names: "Laura"
    email: inflfb00@estudiantes.unileon.es
    orcid: "https://orcid.org/0009-0004-0819-7132"
  - family-names: "González-Santamarta"
    given-names: "Miguel Ángel"
    orcid: "https://orcid.org/0000-0002-7658-8600"
  - family-names: "Guerrero-Higueras"
    given-names: "Ángel Manuel"
    orcid: "https://orcid.org/0000-0001-8277-0700"
  - family-names: "Rodríguez-Lera"
    given-names: "Francisco Javier"
    orcid: "https://orcid.org/0000-0002-8400-7079"
  - family-names: "Matellán Olivera"
    given-names: "Vicente"
    orcid: "https://orcid.org/0000-0001-7844-9658"
identifiers:
  - type: doi
    value: arXiv.2403.09567
abstract: >-
  The deployment of autonomous agents in environments involving human interaction has increasingly raised security concerns. Consequently, understanding the circumstances behind an event becomes critical, requiring the development of capabilities to justify their behaviors to non-expert users. Such explanations are essential in enhancing trustworthiness and safety, acting as a preventive measure against failures, errors, and misunderstandings. Additionally, they contribute to improving communication, bridging the gap between the agent and the user, thereby improving the effectiveness of their interactions. This work presents an accountability and explainability architecture implemented for ROS-based mobile robots. The proposed solution consists of two main components. Firstly, a black box-like element to provide accountability, featuring anti-tampering properties achieved through blockchain technology. Secondly, a component in charge of generating natural language explanations by harnessing the capabilities of Large Language Models (LLMs) over the data contained within the previously mentioned black box. The study evaluates the performance of our solution in three different scenarios, each involving autonomous agent navigation functionalities. This evaluation includes a thorough examination of accountability and explainability metrics, demonstrating the effectiveness of our approach in using accountable data from robot actions to obtain coherent, accurate and understandable explanations, even when facing challenges inherent in the use of autonomous agents in real-world scenarios.
keywords:
  - Robotics
  - Accountability
  - Explainability
  - Blockchain
  - Large Language Models
  - Forensics

GitHub Events

Total
  • Watch event: 1
  • Push event: 4
Last Year
  • Watch event: 1
  • Push event: 4

Dependencies

bag_interpreter/setup.py pypi
  • setuptools *
bag_reader/setup.py pypi
  • setuptools *
tamper_proof_bag_recorder/setup.py pypi
  • setuptools *