- TypeScript 41.3%
- Rust 36.2%
- Svelte 18.2%
- CSS 3.8%
- HTML 0.5%
| extension | ||
| wasm | ||
| .gitignore | ||
| Makefile.toml | ||
| README.md | ||
| rust-toolchain.toml | ||
firaid-moz
Disclaimer:
The software provided as-is, without warranty of any kind, express or implied. This project is an educational proof-of-concept experiment.
To clarify:
- I am not responsible for your judgement on content origin (AI/human/assisted)
- I am not responsible for your attitude towards AI/human/assisted content
- I am not responsible for any consequences of such a judgement
Classifications performed by this extension are not based on private or social opinions. This extension does not rely on reputations, lists, filters, etc.
The only method used by this extension to determine origin of content is a bunch of linear algebra in a black-box, aka "ML model", which decisions may or may not be biased - depending on training dataset, which is out of scope of this project.
A simple local webextension, which can run a bunch of small ML models to infer some properties of DOM content, such as:
- Probability of text being AI/Human created
- Probability of image being AI/Human created
AI/Human classification
NONE of ML/AI/whatever models is 100% accurate by the very fundamental design. Every "AI" simply pretends to posess some information. So this extension pretends to know which content is AI-generated and which is not - with a certain degree of accuracy.
If you don't trust the "AI slop" - you should not completely trust this extension also!
False-positives - Possible
False-negatives - Probably
User discretion - Highly advised
I hate the slop - when the entire "technical guide" article is nothing more then a bunch of AI ejacuation. But how do I know that slop is a slop?
Yeah.. I have to read it. And I had enough of reading. So I want to see a warning badge like "its AI" - to help me navigate through text/image content.
AI/Human classification can be done in three modes:
- (lite): Lightweight model
- (mixed): Lightweight model runs first, but when its decision is weak - heavier model takes the task. This is usually faster, but requires both lite and heavy models to be loaded thus eating lots of RAM
- (hard): Heavier and more accurate model takes all tasks, lightweight model is disabled
The lite mode requires ~80Mb of RAM for text classification
The mixed mode requires ~380Mb of RAM for text classification
The hard mode requires ~300Mb of RAM for text classification
Installation
Building from source
This webextension can be built from source. The following instrumentation is required:
cargo+cargo-make+wasm-pack(cargo-make will install it automatically)pnpm
To build both firefox and chrome release versions, run the release task:
cargo make -p production release
If you do not have wasm-pack (cargo) installed, cargo-make will install it for you.
Models
To only build models, clone the repo, and run models task within production environment:
cargo make -p production models
This will compile all implemented models into WASM packages, which are later used by webextension.
NPM-ready packages for both ai-text models will be located under <repo>/wasm/pkg directory
Using different models for inference
You can build the text classification with any ONNX model from huggingface.
Following env variables are required:
_MK_MODEL_AI_TEXT: name of the huggingface repository (e.g. "onnx-community/text-ai-detection")_MK_MODEL_AI_TEXT_ONNX: name of the onnx model file under the repository (e.g. "onnx/model.onnx")
Following env variables are optional:
_MK_MODEL_AI_TEXT_ATTENTION: set toyesor1if your model uses attention mask_MK_MODEL_AI_TEXT_TYPES: set toyesor1if your model uses token types tensor
Not every model will work, and not every model which works will compute valid results. Major constraints are:
- FP32 or FP16 weights (quantizations, int8, etc will be available when implemented by burn/burn-onnx)
- Sane size, 500Mb is your soft ceiling (browsers would likely refuse to load enormous WASM)
- Two label classification, where label
[0]is Human and[1]is AI - Output is
[0, 2]sized tensor of logits
If you encounter compilation error, and compiler complains about invalid forward function arguments,
most likely you set the wrong _MK_MODEL_AI_TEXT_ATTENTION and _MK_MODEL_AI_TEXT_TYPES values.
Extension
You must build models before running this
To only build the extension, clone the repo, build models, then you can run following tasks:
extension: build and zip firefox and chrome extensionsextension_moz: only build firefox extensionextension_chro: only build chrome extensiondev: run wxt dev server (chrome variant)