Skip to main content

findllm - Detect AI-generated text by analyzing token prediction patterns using GPT-2.

https://github.com/user-attachments/assets/89d03001-7cef-4b9e-878d-c991bd520f18

Installation

[!IMPORTANT] This project was 99% vibe coded using gemini 3 Pro, sonnet 4.5 and opus 4.5. The model tends to identify AI text as human text more often than the reverse. The metrics can't be fully trusted though, so use everything with caution!

# Run directly with uv
uvx findllm document.md

# With document conversion support (PDF, DOCX, PPTX, etc.)
uvx 'findllm[markitdown]' document.pdf

# Or install into your environment
pip install findllm

# With document conversion support
pip install 'findllm[markitdown]'

Usage

# Analyze a text file (sentence mode by default)
findllm document.md

# Analyze documents (PDF, DOCX, PPTX, XLSX, etc.) - requires markitdown extra
findllm paper.pdf
findllm presentation.pptx
findllm report.docx

# Use token-level analysis
findllm document.md --mode token

# Chunk sentences into smaller batches (e.g., 10 tokens per chunk)
findllm document.md --max-sentence-tokens 10

# Skip short sentences (e.g., less than 5 tokens, default is 3)
findllm document.md --min-sentence-tokens 5

# Use different aggregation methods (mean, max, l2, rmse, median, default is l2)
findllm document.md --aggregation max

# JSON output for programmatic use
findllm document.md --json

Document Support

With the markitdown extra installed, findllm can analyze various document formats:

  • PDF (.pdf)
  • Microsoft Office (.docx, .pptx, .xlsx)
  • HTML (.html, .htm)
  • Rich Text (.rtf)
  • And more - see markitdown for full format support

Documents are automatically converted to markdown in-memory before analysis.

How It Works

The tool analyzes how predictable each token in the text is according to GPT-2:

  • Green = Low probability (unpredictable, human-like)
  • Yellow = Moderate probability
  • Orange = Higher probability
  • Red = High probability (predictable, AI-like)

AI-generated text tends to follow predictable patterns that language models can easily anticipate. Human writing is more variable and surprising.

Metrics

  • Perplexity: How "surprised" the model is overall (lower = more predictable)
  • Burstiness: Variation in complexity (humans tend to write with more variation)
  • Color Distribution: Percentage of green/yellow/orange/red tokens

Evaluation

Evaluation on 150 samples from https://www.kaggle.com/datasets/shanegerami/ai-vs-human-text

Image

Metadata

Release files for findllm 0.1.2

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

Source distribution (sdist)

Source distribution for findllm 0.1.2
File Size Uploaded Provenance
findllm-0.1.2.tar.gz 10.5 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 22.0 kB

Release files / findllm-0.1.2.tar.gz

Download URL findllm-0.1.2.tar.gz
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
9e5ca9a2ae5d850758fa0ff549a1d9679c8082020c4c63252199bc9d3537eebb
BLAKE2b-256 checksum
How to use checksums
eb09f0aee982ada7586cce6f2c1cb3a63817c3a0bb7c938cce09e5ecf9606aa7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.2

Release files / findllm-0.1.2-py3-none-any.whl

Download URL findllm-0.1.2-py3-none-any.whl
Size 11.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a67d68512ec714a1ce24b7e27331050a89c5d8c472a056b510759eb2a2630dea
BLAKE2b-256 checksum
How to use checksums
7293554fcc3ac8fd32081807f5d217b639968fac6b8c672db721b8fc423226a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.2

Security for findllm 0.1.2

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