FinBERT AI Detector
This is an easy-to-use Python package for the msperlin/finbert-ai-detector model.
The model is designed specifically to detect AI-generated text in financial documents, such as corporate annual reports (e.g., 10-K filings). It is fine-tuned from yiyanghkust/finbert-pretrain.
The model is used in the working paper:
Features
- GPU automatically supported: CUDA and Apple Silicon (MPS) are fully supported if available.
- Easy Interface: Detect AI-generated text with a single method call.
- Batched Inference: Run predictions efficiently on huge datasets using batched inputs.
Installation
Install using pip:
pip install finbert-ai-detector
Quick Start
from finbert_ai_detector import FinbertAIDetector
# Initialize the detector (downloads the model if not cached)
detector = FinbertAIDetector()
# Example text
text = "The Tax Cuts and Jobs Act enacted in 2017 in the United States, significantly changed the tax rules applicable to U.S.-domiciled corporations. Changes such as lower corporate tax rates, full expensing for qualified property, taxation of offshore earnings, limitations on interest expense deductions, and changes to the municipal bond tax exemption may impact demand for our products and services."
# Predict a single text
result = detector.predict(text)
print(f"Prediction: {result['label']}")
print(f"AI Probability: {result['ai_probability']:.2%}")
Batched Prediction
For analyzing multiple documents or sentences quickly, use batched inference:
from finbert_ai_detector import FinbertAIDetector
detector = FinbertAIDetector()
texts = [
"Company revenue grew by 15% due to increased demand in the European market.",
"A machine learning model generated this text based on recent financial statements."
]
results = detector.predict_batch(texts)
for result in results:
print(f"Text: {result['text']}")
print(f"AI Probability: {result['ai_probability']:.2%}")
print("---")
Intended Use & Limitations
- Intended Usage: Analyzing formal financial reports, press releases, corporate filings, and similar structured financial disclosures.
- Limitations: The model is optimized specifically for the formal, complex tone of financial documents. Its accuracy may be lower when applied to texts outside the financial domain, such as social media posts, casual emails, news articles, or creative text.
- Length Constraint: The underlying standard FinBERT architecture implies a maximum sequence length of 512 tokens. Texts longer than this will be truncated prior to sequence prediction.
Metadata
Release files for finbert-ai-detector 0.1.1
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 | Actions |
|---|---|---|---|---|
| finbert_ai_detector-0.1.1.tar.gz | 5.6 kB | Without provenance | Details for finbert_ai_detector-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| finbert_ai_detector-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for finbert_ai_detector-0.1.1-py3-none-any.whl |
Total release size: 11.2 kB
Release files / finbert_ai_detector-0.1.1.tar.gz
| Download URL | finbert_ai_detector-0.1.1.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a1ea8ff13c9b5161ec5e3418e0d5ee4ac351d0a5a2fc434c8e86d6a157dccf36
|
|
BLAKE2b-256 checksum How to use checksums |
13d414bac7c7f95a59af8d160dd68a85fe07d44af2fc2d84584bd7380fdcc551
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / finbert_ai_detector-0.1.1-py3-none-any.whl
| Download URL | finbert_ai_detector-0.1.1-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6ac2b1b3217a8dcd8e26c846ef876eb754a0c4129d80695640d6bd57e153427d
|
|
BLAKE2b-256 checksum How to use checksums |
1f49f4d7d6f482d2849045a2b63bef62010930b7f4d3dda3d3ffee922ff7adc6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Security for finbert-ai-detector 0.1.1
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.