Skip to main content

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 style are:

  • anonymizing the author of a text
  • protecting the identity of whistleblowers and activists
  • see more use cases 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 workflows

  1. Locally serve a Large Language Model server with ollama:
$ ollama serve
  1. Make sure a potent model is served, e.g. a version of nous-hermes2:
$ ollama run nous-hermes2:10.7b-solar-q6_K
  1. Mask your writing style by transforming it into a different one:
$ llmask -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.

Piping input and output

For larger-scale text work, the text input and output can also be piped:

$ cat input.txt | llmask > output.txt

Getting started

System requirements

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

Please note that this project is tested most thoroughly on Apple Silicon hardware.

Installation

This command line tool can be installed with: pipx install llmask

Usage options

$ llmask --help

Usage: llmask [OPTIONS]

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

Options:
  -t, --transformations TEXT    Sequence of transformations to apply in order,
                                e.g. 'tsp' for the steps 'thesaurus ->
                                simplify -> persona', where 't' applies
                                thesaurus, 's' simplifies, and 'p' imitates a
                                persona.  [default: ts]
  -i, --input TEXT              Input text that will be transformed.
  -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]
  -r, --randomness FLOAT RANGE  Higher values make the output more
                                random.Parameter value is passes as 'sampling
                                temperature' to language model.   [default:
                                0.5; 0.0<=x<=2.0]
  -s, --seed INTEGER            Repeated requests with the same `seed` and
                                parameters should return the same result.
                                [default: 42]
  -h, --help                    Show this message and exit.

Development setup

Install development environment

The development environment can be installed via: poetry install.

Roadmap

  • support transformations from and into text files
  • measure success of obfuscation
    • measure success of anonymzation with de-anonymization tools (e.g. faststylometry)
    • check with GPTZero if suspected author is an LLM
  • re-introduce test suite

Metadata

Release files for llmask 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llmask 1.1.0
File Size Uploaded Provenance Actions
llmask-1.1.0.tar.gz 6.5 kB Without provenance Details for llmask-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llmask 1.1.0
File Interpreter ABI Platform Actions
llmask-1.1.0-py3-none-any.whl Python 3 none any Details for llmask-1.1.0-py3-none-any.whl

Total release size: 14.7 kB

Release files / llmask-1.1.0.tar.gz

Download URL llmask-1.1.0.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
eb4fae9fd648d3a2791fa393e604076530a6415ee434d6b8e5cf593a30752541
BLAKE2b-256 checksum
How to use checksums
974a108880b97e2f667200c8f4784d9403fdba8503bd8147ed1070c2c0382fb3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.10.6 Linux/6.9.3-76060903-generic

Release files / llmask-1.1.0-py3-none-any.whl

Download URL llmask-1.1.0-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
62d7080bf46215669ce62bc25dcbfd01fd718874dac3e088017a9e1b07d9e14d
BLAKE2b-256 checksum
How to use checksums
9799f2521cbdc941f0280dfe3a10120af97651dc52e2f707466d9159803c3fc0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.10.6 Linux/6.9.3-76060903-generic

Security for llmask 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page