Skip to main content

AI Code Classifier Tool

Reason this release was yanked:

v0.1.3

Project description

Aegis: AI Python Code Detection Model

Overview

Aegis is a fine-tuned CodeBERT model designed to classify AI-generated and human Python code. While CodeBERT contains 125 million parameters, Aegis was efficiently trained locally using LoRA (Low-Rank Adaptation), updating only a subset of the original parameters.

This project investigates classifying code based on semantic differences. Consequently, the dataset (20K Python samples: 10K AI + 10K Human) was aggressively cleaned to ensure standard formatting and the removal of comments and docstrings. A confidence threshold of 0.7 was established to flag samples as AI-generated only when strong evidence exists. Aegis is not a definitive judge; predictions can be imperfect, particularly in tasks where semantic convergence between humans and AI is observed (e.g., LeetCode solutions).

Installation

pip install aegis-detect

CLI Usage

Supported commands:

# Predicting using a file
aegis --file path/to/code.py

# Predicting using text
aegis --text "def add(a, b):\n    return a + b"

# JSON output
aegis --file path/to/code.py --json > result.json

# Setting a threshold for AI classification 
aegis --file path/to/code.py --threshold 0.7

# Help
aegis --help

# Uninstall
pip uninstall aegis-detect
aegis-cleanup 

Notes:

  • On first run, the model adapter is downloaded from the Hugging Face repo anthonyq7/aegis and cached under ~/.aegis/models.
  • Internet access is required on the first run; subsequent runs use local cache.
  • The CLI prints the predicted label and probabilities for human and AI.

Key Results

Model Performance

  • Accuracy: 85.10%
  • Precision: 83.37%
  • Recall: 87.70%
  • F1-Score: 85.48%

Confusion Matrix

Alt text

Attention Heatmap

Alt text

Contact

Email: a.j.qin@wustl.edu

License

This project is licensed under the MIT License.

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

aegis_detect-0.1.2.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

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

aegis_detect-0.1.2-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file aegis_detect-0.1.2.tar.gz.

File metadata

  • Download URL: aegis_detect-0.1.2.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.24

File hashes

Hashes for aegis_detect-0.1.2.tar.gz
Algorithm Hash digest
SHA256 2efd88d9debe33e4f8d320ea91042f61633097443d4a600b1a57885d588c4584
MD5 716b5c2952d12a34afd418efc3b58986
BLAKE2b-256 1c02355bdb18983a145e0ab395fbd44044e84a0b279b4afabad546fc9837a3f9

See more details on using hashes here.

File details

Details for the file aegis_detect-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for aegis_detect-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 51d5a4e452dfcfc9a10be28ad36971bb3e1199e54ca5ebeff35bb2e16cc92da7
MD5 f94da907edf804d11487ab459b289a7b
BLAKE2b-256 8e16f5f9770cb0b5f71c4eba5cfd6d8e02bf11da90c90901c1f8578a67bb0b9e

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