In the evolving landscape of natural language processing (NLP), the ability to discern the nuances of human communication stands as an open challenge. One area I’m particularly interested in is nonviolent communication (NVC), a practice that emphasizes compassion, nonjudgmental observation, and understanding in interactions. With the advent of large language models (LLMs), we now might be able to create the tools to analyze and categorize statements based on their adherence to NVC principles, at least on some level. The caveat is that there is some degree of nuance that most likely can be lost if only analyzing the words that are used since human communication also includes body language, tone, etc. This blog post delves into how I created a customized LLM, deployable via Ollama, which is an attempt to distinguish between judgmental and nonjudgmental statements.
Ollama
Ollama is an program that facilitates the deployment and interaction with various LLMs. Its architecture is designed to support a wide range of models, making it an ideal sandbox for experimenting with customized language models locally and privately. With this program, users can quickly run models like llama2, orca, and other open source models.
Customizing the LLM for NVC
Refining an LLM for NVC did not hinge on leveraging an extensive dataset of judgmental and nonjudgmental communications, at least for now. Rather, this initial adaptation involves tweaking an existing Ollama template by adjusting its parameters, such as limiting its state retention capabilities, and providing it with foundational NVC guidelines.
This approach centers less on comprehensive data training and more on nuanced template modifications. By doing so, the model begins to navigate the distinctions between judgmental language, often laden with blame or criticism, and nonjudgmental expressions that share feelings and needs without attributing fault. However, it’s important to note that while the model has made strides towards understanding these communication nuances, it currently has a tendency to classify statements as judgmental even if not worded that way. Although not flawless, this preliminary version lays the groundwork for further enhancements and learning in identifying the subtleties of nonviolent communication.
A Prototype in Action
The ephemeralwaves/nvco
model is a prototype that showcases the potential of customized LLMs in promoting nonviolent communication. It offers a model where individuals can input statements and receive feedback on whether they are considered judgmental or nonjudgmental and the reasoning why. If the statement is found to be judgmental, it also offers an example of a more neutral statement (see examples below). This immediate feedback loop not only aids in personal growth and understanding but also contributes to the broader goal of fostering empathy and compassion in communication.
For those with Gnu/Linux or Mac, you can run it by first installing ollama
curl https://ollama.ai/install.sh | sh
then running this code:
ollama run ephemeralwaves/nvco




If you’d like to run it in a web interface, here is the python code to do so once you have the model on your machine:
import requests
import json
import gradio
def send_prompt_to_ollama(prompt):
result = requests.post("http://localhost:11434/api/generate", json = {
"model": "ephemeralwaves/nvco",
"prompt": prompt
})
result.raise_for_status()
print(result)
full_response = ""
for line in result.iter_lines():
body = json.loads(line)
response = body.get("response", "")
full_response += response
return full_response
def get_user_input_from_web(prompt):
result = send_prompt_to_ollama(prompt)
return result
app = gradio.Interface(fn = get_user_input_from_web,
inputs = "text",
outputs = "text",
title = "NVC Observation Analysis",
description = "Get Judgemental/Nonjudgemental for given inputs")
if __name__ == "__main__":
app.launch(share=True)
Implications and Future Directions
The development and deployment of an LLM focused on nonviolent communication represent a significant step forward in applying AI for social good. By leveraging the capabilities of platforms like Ollama, developers and researchers can bring specialized tools like ephemeralwaves/nvco
to a wider audience, facilitating awareness and practice of NVC.