Coder Social home page Coder Social logo

llmask's Introduction

LLMask [ɛl ɛl 'ma:sk]

A command-line tool for masking authorship of text, by changing the writing style with a Large Language Model.

The main use cases of masking an author's writing sytle are:

  • anonymizing who is the author of a text
  • protecting the identity of whistleblowers and activists
  • see more at Adversarial Stylometry

Disclaimer

⚠️ This project currently is just a demo of what LLMs can do for authorship anonymization.
⚠️ There is no strong evidence yet that this tool can beat state of the art de-anonymization methods!

Known Limitations

Despite it's pre-production status, this library has several known limitations:

  1. Only a limited number of transformations are implemented (see transform.py).
  2. Long chains of transformations have observed to make the LLM output artifacts.
  3. Sensitive content can trigger an LLMs censoring, and thus ruin the output.
    In this case it is advised to try uncensored LLMs, e.g. of the wizard-vicuna-uncensored type.
  4. Currently, unique names of places or persons are not removed/anonymized.

Example workflow

  1. Locally serve a Large Language Model server with ollama:
$ ollama serve
  1. Make sure a potent model is downloaded, e.g. a version of nous-hermes2:
$ ollama pull nous-hermes2:10.7b-solar-q6_K
  1. Mask your writing style by transforming it into a different one:
$ llmask transform -v -i "this was a triumph. i'm making a note here: huge success."


User-provided input:

> this was a triumph. i'm making a note here: huge success.


Result after applying transformation 'thesaurus':

> This was an astonishing achievement. I'll jot down: extraordinary victory.


Result after applying transformation 'simplify':

> This was a great success. I'll write down: wonderful win.

Getting started

System requirements

LLMs can run on ordinary CPUs, e.g. with ollama. However, GPU acceleration greatly accelerates execution speed.

This project is best tested on Apple Silicon hardware.

Installation

This command line tool can be installed with pipx install.

Usage options

$ llmask --help

Usage: llmask [OPTIONS]

  Transform input text with chained transformations by a Large Language Model.

Options:
  -t, --transformations TEXT  Compact representation of operations (e.g. 'tsi'
                              for the steps 'thesaurus -> simplify ->
                              imitate')  [default: ts]
  -i, --input TEXT            Input text that will be transformed.  [required]
  -p, --persona TEXT          Name of persona whose writing style to imitate.
                              [default: Ernest Hemingway]
  -m, --model TEXT            Name of model to use (as known to model server).
                              [default: nous-hermes2:10.7b-solar-q6_K]
  -u, --url TEXT              URL of Open AI compatible model API.  [default:
                              http://localhost:11434/v1]
  -v, --verbose               Verbosity level. At default, only the final
                              output is returned.  [default: 0]
  -h, --help                  Show this message and exit.

Development setup

Install development environment

The development environment can be installed via: poetry install.

Run test suite

To execute this project's test suite, run pytest tests/

Roadmap

  • support transformations from and into text files
  • measure success of obfuscation (e.g. check with GPTZero if suspected author is an LLM)

llmask's People

Contributors

top-on avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

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.