dibrale / webui_autonomics

Dynamic parameter modulation for oobabooga's text-generation-webui that adjusts generation parameters to better mirror user affect.
GNU General Public License v3.0
34 stars 3 forks source link

Emotional State Mirroring via Parameter Adjustment

Introduction

Interaction with an AI chat agent proceeds more smoothly when it can mirror the emotional state of the user. Adjusting text generation parameters can influence the formality, verbosity, excitement level and affect conveyed by the response. This extension for oobabooga's text-generation-webui locally queries Emotion English DistilRoBERTa-base in order to obtain a sentiment evaluation of the input, then calculates a score that is used to adjust model parameters within a given range.

Rather than conveying input sentiment directly via the prompt, this scoring system and subsequent parameter adjustment simulates an autonomic response to the input. This adjustment then helps the chat agent mirror user affect as it generates a response. Insofar as the literature allows, scoring function component calculations are inspired by known autonomic response curves to human emotion. The balance of the scoring function is a work in progress.

The parameter ranges built into the model are calibrated for LLaMA-13B variant models, but can be adjusted by the user at runtime.

Installation

  1. Make a new directory under text-generation-webui/extensions (eg.: text-generation-webui/extensions/autonomics).
  2. Copy script.py from this repository into the new directory.
  3. Start server.py with the --extensions autonomics flag.
  4. The extension will download DistilRoBERTa to run it locally, and will then be ready for use. It will proceed to create the text-generation-webui/parameter_ranges/ directory if it is not present, as well as the files Autonomic_Buffer_A.txt and Autonomic_Buffer_B.txt in the text-generation-webui/presets/ directory when it performs parameter updates.

Usage

The UI of this extension, shown here with an abbreviated number of parameter sliders, looks like this:

autonomic2