Skip to main content

LLM-Generated text detection in PyTorch

Project description

PyDetectGPT

LLM-Generated text detection in Pytorch.

Quick Start

from pydetectgpt import detect_ai_text

text = "text you want to check here"
result = detect_ai_text(text)
print("AI Generated" if result else "Human Written")

CLI

There is also a CLI wrapper.

pydetectgpt "Your text here"

"Detection Result: AI Generated" or "Detection Result: Human Written"

If you want just the 0/1 result (ex for scripting) use the -q flag:

pydetectgpt "Your text here" -q

0 or 1

For a full list of args see cli.py

Detection Methods

PyDetectGPT supports four detection methods, in order of effectiveness:

  1. FastDetectGPT (default): Implementation of Fast-DetectGPT: Efficient Zero-Shot Detection of Machine-Generated Text
  2. DetectLLM: Implementation of DetectLLM: Leveraging Log Rank Information for Zero-Shot Detection of Machine-Generated Text
  3. LogRank: Average log token rank
  4. LogLikelihood: Basic log likelihood of the text

Acknowledgements

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydetectgpt-0.1.0.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydetectgpt-0.1.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file pydetectgpt-0.1.0.tar.gz.

File metadata

  • Download URL: pydetectgpt-0.1.0.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for pydetectgpt-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8082a1fa44e5b7da2ef49e97905eded7084a6d608becd9a7c4e1aa2a393e51fd
MD5 341ecf7f9ce0cb08f912530998abb426
BLAKE2b-256 43cb673a8fbcc87c8153e7e89059528357bfa17a53db487c3632ec631c12f5af

See more details on using hashes here.

File details

Details for the file pydetectgpt-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pydetectgpt-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for pydetectgpt-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 47f017ef400c0115289975345e7a905e8e54f059e800992f04a8779bd0bceb5e
MD5 c4e58c6606535b1fd0965c53e844553b
BLAKE2b-256 1a15859b54a1fcba744672507feccc1da1ae4bbe8afd2f23c591654bcdb04bd8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page