Aegis: AI vs. Human Python Code Classifier
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
aegis-cleanup
pip uninstall aegis-detect
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.
Contact
Email: a.j.qin@wustl.edu
Email: ethanqin@bu.edu
License
This project is licensed under the MIT License.
Metadata
Release files for aegis-detect 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| aegis_detect-1.0.0.tar.gz | 5.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aegis_detect-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.1 kB
Release files / aegis_detect-1.0.0.tar.gz
| Download URL | aegis_detect-1.0.0.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d70ee70700f6e50e2d444e5b18f22557b87565975550b5b02cb86b12b345c187
|
|
BLAKE2b-256 checksum How to use checksums |
8d44497030208ca2c8fbb5b7ffa01fc0e645463a9ef91051f11428e833b93cb1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / aegis_detect-1.0.0-py3-none-any.whl
| Download URL | aegis_detect-1.0.0-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
76bc71f649ec3fb351a254ea19baf845cfe58b1b47a81c706d74c94557591d78
|
|
BLAKE2b-256 checksum How to use checksums |
45cf308624f8b03e6f59f80864c88c3ba2dbff6eafd7e6185312473d420fde6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for aegis-detect 1.0.0
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.