A collection of experimental web apps to inspect & engineer the activations of LLMs.
It is a WIP, some apps are not functional yet.
The human / LLM detector is improving though.
The package is available on pypi:
pip install -U psaiopsAll the apps run on a single GPU and can be launched from a Google Colab notebook.
They are showcased in the demo notebook.
To run a given application all you need is to call the associated app.py:
python psaiops/compose/contrast/app.pyAll the apps run with the model gpt-oss-20b by default so it is highly recommanded to use a GPU.
Some of the apps are specific to gpt-oss-20b but most can be used with another model.
You can look at the section __main__ at the bottom of the file app.py for more details on the setup.
A straightforward implementation of the technique contrastive activation addition is available in psaiops.compose.contrast.app.
Pushing the idea of CAA further, psaiops.compose.maths.app allows to compose several prompts in the latent space with maths operators.
Like CAA you can do the difference between prompts, but also multiply, project, average, etc.
The app psaiops.combine.app allows to draw from several datasets to form new samples and datasets.
It is useful to create pairs of prompts and form specific latent directions with the contrastive steering technique.
To support the creation of apps that operate in the latent space, I've used several tools that allow to view the internals of the models.
In particular, you can take apart LLM generated text from human text:
- in the Hugging Face hub
- or by running the app
psaiops.score.human.app
It is using techniques scattered over several other apps that:
- use a LLM as critic to estimate how surprising each token is
- score the input tokens according to the attention they get during the generation
- view the expert logits and associate the routing with the input tokens
- view the flow of residuals and assess the contribution of the layers to the final output
Licensed under the AGPLv3.