Extinction is an ultra-lightweight AI content blocker browser extension powered by regex-based pattern matching and linguistic analysis. It has an average precision of about 80% to 90% in correctly classifying human text, and an average precision of around 80% in detecting AI-generated text.
- Add configurable suspicion threshold
- Create a default exception list for common/trustworthy sites
- Add multi-language support (in the far future)?
The World Wide Web is becoming increasingly plagued with low-quality AI-generated content. The content AI produces is often misleading or blatantly incorrect. While some may not particularly see this is an issue, many people wish to escape from or completely hide such content.
Traditional AI content detectors rely on either heavy machine learning (ML) and/or intensive pretraining for a basic classifier model, which are far from ideal for a mere browser extension. They usually measure values such as perplexity, burstiness, and token probability patterns to determine whether or not a text is generated by AI.
Although, admittedly, regex-based detection mechanisms cannot be as precise as ML-based detection mechanisms, they can reach satisfactory levels when certain exceptions/limitations are implemented.
This section explains Extinction's algorithm and how it classifies text as either human-written or machine-generated.
Extinction is a heuristic, so its only goal is to find a solution that is "good enough" for its purposes. Learn more about heuristics here.
Extinction's default "suspicion threshold" is 0.65 (65%). Any number below this threshold will not trigger a full-page alert. (This number is not configurable yet, but we plan on adding this as a setting soon.)
Extinction uses a precompiled list of regular expressions, where each regex pattern is assigned a certain "point" value depending on how common it appears in machine-generated content.
- Some regexes have a negative score. A negative score indicates that the pattern is more common in human text than in AI text.
- This helps increase accuracy by limiting the impact of outliers in the content.
The TextClassifier.analyze() method is used to analyze a given article using a chunkSize-length sliding window as well as using several other processes to analyze the linguistic characteristics of the given corpus.
- The alpha (score) is a parameter that is accumulated during chunk analysis and later normalized.
- The step, or stride, of the window is equal to
chunkSize.- In each step, the following operations occur:
- Loop through the rules in the
patterns.jsonasset. - Match each regex against the chunk with the flags
/gimus(global, case-insensitive, muiltiline, dot terminators, and unicode). - Count the number of matches for each regex.
- If the number of matches is greater than 0, do the following:
- Increase
alphabypattern.score * min(2, sqrt(count)) ^ alphaScale.
- Increase
- If the number of matches is greater than 0, do the following:
- Split the chunk into tokens using the regex
/\b\w+\b/g. - If the number of tokens is greater than 0, calculate the Type-Token Ratio (TTR) and increase
diversitySumby the TTR. Then, incrementwindowCount.
- Loop through the rules in the
- In each step, the following operations occur:
- The lexical diversity is calculated by dividing
diversitySumbywindowCount. - Next, the burstiness is calculated by analyzing the sentence length variance throughout the corpus.
- The overall fluency score is finally calculated by applying weights to the lexical diversity and burstiness to produce a combined value.
- Finally, a two-item object containing the resulting alpha and the fluency score is returned.
The TextClassifier.normalizeScore() method adjusts the score to account for the size of the corpus (in characters), the fluency score, and a constant adjustment threshold. The function follows the steps:
- Normalize the alpha with the model:
alpha / sqrt(corpusLength)
- Adjust the normalized alpha with the fluency score and the adjustment threshold:
normalizedAlpha - adjustmentThreshold - 0.5 * fluencyScore
The adjustment threshold defines the point above which the score rises significantly and below which the score drops significantly.
- Use a sigmoid function to transform the adjusted alpha:
1 / (1 + e^(-adjustedAlpha))
Sigmoid functions are common in machine learning algorithms, but Extinction uses it for scaling and normalization. (Extinction does not use machine learing.)
The resulting value of this function is returned as the normalized score.
The following guide explains how to install Extinction as a browser extension on Chromium-based and Firefox-based browsers and Safari.
Extinction is live on Firefox Add-ons!
You can install it here: https://addons.mozilla.org/en-US/firefox/addon/extinction.
(This is the only official download link for Extinction outside of this GitHub repository.)
To build from source, follow the instructions below.
You must have the following components installed on your system:
- A modern browser that is either Chromium-based (e.g., Chrome, Edge, Brave, Opera), Firefox-based (e.g., Firefox, LibreWolf, Zen, Floorp), or Safari.
- Node.js and pnpm in order to build the extension from source.
These steps assume you are operating on a Bash shell. Make sure you have already properly installed the requirements listed above.
- Clone the repository
git clone https://github.com/extinctionteam/extinction.git
cd extinction- Install the dependencies
pnpm install- Build the extension
pnpx wxt build -b chrome # for Chromium
pnpx wxt build -b firefox # for Firefox
pnpx wxt build -b safari # for SafariThis will create a .output/ folder containing the packaged extension.
To install Extinction on a Chromium-based browser, make sure you have successfully built the project. Then, follow the steps:
- Open
chrome://extensionsin your browser. - Enable Developer Mode using the toggle.
- Click Load unpacked and select the Chrome output folder generated by the build operation.
After loading the extension, Extinction should appear in your extension list. If you want, you can pin it to your toolbar for easier access to the menu.
To install Extinction on a Firefox-based browser, you should follow the guide:
- Open
about:debugging#/runtime/this-firefoxin your browser. - Click Load Temporary Add-on… and select any file from the Firefox output folder generated by the build operation.
Important
Temporary add-ons in Firefox disappear after the session ends or after the browser restarts.
To install Extinction on Safari, you must allow unsigned extensions in your settings. Then, import the Safari output folder generated by the build operation as a temporary extension.
Important
Temporary add-ons in Safari are automatically removed after 24 hours or you quit Safari.
To report an issue or bug, visit Extinction's issue tracker on GitHub.
To push your features or fixes into this official repository:
- Fork the repository.
- Create a feature branch (
git checkout -b feature/my-feature) or a fix branch (git checkout -b fix/my-fix). - Commit your changes (
git commit -m "feat: add new feature"). Please follow the Conventional Commits guideline when doing so! - Push the branch (
git push origin feature/my-feature). - Open a pull request with
contribas the base branch. Make sure to create a detailed title and description of your change.
Please follow the GitHub flow and Extinction's Code of Conduct when submitting a pull request.
Extinction is free software distributed under the GNU General Public License, version 3.0 or later (GPL-3.0+).
You are free to use, modify, and share the software under the terms of the GPL. For full details, see the GNU General Public License v3.0.