Skip to content

Repository files navigation

Logo


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.

Roadmap

  • Add configurable suspicion threshold
  • Create a default exception list for common/trustworthy sites
  • Add multi-language support (in the far future)?

The Problem

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.

How It Works

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.)

Point-Based Pattern Matching

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.

Corpus Analysis

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:
      1. Loop through the rules in the patterns.json asset.
      2. Match each regex against the chunk with the flags /gimus (global, case-insensitive, muiltiline, dot terminators, and unicode).
      3. Count the number of matches for each regex.
        • If the number of matches is greater than 0, do the following:
          • Increase alpha by pattern.score * min(2, sqrt(count)) ^ alphaScale.
      4. Split the chunk into tokens using the regex /\b\w+\b/g.
      5. If the number of tokens is greater than 0, calculate the Type-Token Ratio (TTR) and increase diversitySum by the TTR. Then, increment windowCount.
  • The lexical diversity is calculated by dividing diversitySum by windowCount.
  • 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.

Normalization

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:

  1. Normalize the alpha with the model:
alpha / sqrt(corpusLength)
  1. 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.

  1. 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.

Setup

The following guide explains how to install Extinction as a browser extension on Chromium-based and Firefox-based browsers and Safari.

Installing From AMO (Firefox Browsers)

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.)

Manual Installation

To build from source, follow the instructions below.

Prerequisites

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.

Building From Source

These steps assume you are operating on a Bash shell. Make sure you have already properly installed the requirements listed above.

  1. Clone the repository
git clone https://github.com/extinctionteam/extinction.git
cd extinction
  1. Install the dependencies
pnpm install
  1. Build the extension
pnpx wxt build -b chrome    # for Chromium
pnpx wxt build -b firefox   # for Firefox
pnpx wxt build -b safari    # for Safari

This will create a .output/ folder containing the packaged extension.

Manual Installation on Chromium Browsers

To install Extinction on a Chromium-based browser, make sure you have successfully built the project. Then, follow the steps:

  1. Open chrome://extensions in your browser.
  2. Enable Developer Mode using the toggle.
  3. 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.

Manual Installation on Firefox Browsers

To install Extinction on a Firefox-based browser, you should follow the guide:

  1. Open about:debugging#/runtime/this-firefox in your browser.
  2. 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.

Manual Installation on Safari

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.

Contributing

Reporting Issues

To report an issue or bug, visit Extinction's issue tracker on GitHub.

Pull Requests

To push your features or fixes into this official repository:

  1. Fork the repository.
  2. Create a feature branch (git checkout -b feature/my-feature) or a fix branch (git checkout -b fix/my-fix).
  3. Commit your changes (git commit -m "feat: add new feature"). Please follow the Conventional Commits guideline when doing so!
  4. Push the branch (git push origin feature/my-feature).
  5. Open a pull request with contrib as 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.

License

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.

About

A fast, accurate, and lightweight browser extension that blocks machine-generated pages using pattern matching.

Topics

Resources

Code of conduct

Stars

1 star

Watchers

0 watching

Forks

Releases

Contributors

Languages