satyaki-mitra
README uopdated
aaa179d
|
raw
history blame
7.57 kB

๐Ÿง  Building the AI Text Authentication Platform โ€” Detecting the Fingerprints of Machine-Generated Text

Author: Satyaki Mitra โ€” Data Scientist, AI Researcher


๐ŸŒ The Context โ€” When Machines Started Sounding Human

In the last few years, AI models like GPT-4, Claude, and Gemini have rewritten the boundaries of natural language generation.
From essays to resumes, from research papers to blogs, AI can now mimic the nuances of human writing with unsettling precision.

This explosion of generative text brings opportunity โ€” but also uncertainty.
When everything can be generated, how do we know whatโ€™s authentic?

That question led me to build the AI Text Authentication Platform โ€” a domain-aware, explainable system that detects whether a piece of text was written by a human or an AI model.


๐Ÿ” The Idea โ€” Beyond Binary Detection

Most existing detectors approach the problem as a yes/no question:

โ€œWas this written by AI?โ€

But the real challenge is more nuanced.
Different domains โ€” academic papers, social media posts, technical documents, or creative writing โ€” have very different stylistic baselines.
A generic model often misfires in one domain while succeeding in another.

I wanted to build something smarter โ€”
an adaptive detector that understands context, writing style, and linguistic diversity, and still offers transparency in its decision-making.


๐Ÿงฎ The Statistical Backbone โ€” Blending Metrics and Machine Learning

Coming from a statistics background, I wanted to merge the interpretability of statistical metrics with the depth of modern transformer models.
Instead of relying purely on embeddings or a classifier, I designed a multi-metric ensemble that captures both linguistic and structural signals.

The system uses six core metrics:

Metric What it Measures Why it Matters
Perplexity Predictability of word sequences AI text tends to have smoother probability distributions
Entropy Diversity of token use Humans are more chaotic; models are more uniform
Structural (Burstiness) Variation in sentence lengths AI often produces rhythmically even sentences
Semantic Coherence Flow of meaning between sentences LLMs maintain strong coherence, sometimes too strong
Linguistic Features Grammar complexity, POS diversity Human syntax is idiosyncratic; AIโ€™s is hyper-consistent
DetectGPT Stability Robustness to perturbations AI text collapses faster under small changes

Each metric produces an independent AI-likelihood score.
These are then aggregated through a confidence-calibrated ensemble, which adjusts weights based on domain context and model confidence.

Itโ€™s not just machine learning โ€” itโ€™s statistical reasoning, linguistic insight, and AI interpretability working together.


๐Ÿ—๏ธ The Architecture โ€” A System That Learns, Explains, and Scales

I designed the system with modularity in mind.
Every layer is replaceable and extendable, so researchers can plug in new metrics, models, or rules without breaking the pipeline.

%%{init: {'theme': 'dark'}}%%
flowchart LR
    UI[Web UI & API]
    ORCH[Orchestrator]
    METRICS[Metric Engines]
    ENSEMBLE[Confidence Ensemble]
    REPORT[Explanation + Report]
    UI --> ORCH --> METRICS --> ENSEMBLE --> REPORT --> UI

The backend runs on FastAPI, powered by PyTorch, Transformers, and Scikit-Learn. Models are fetched dynamically from Hugging Face on the first run, cached locally, and version-pinned for reproducibility. This keeps the repository lightweight but production-ready.

The UI (built in HTML + CSS + vanilla JS) provides live metric breakdowns, highlighting sentences most responsible for the final verdict.


๐Ÿง  Domain Awareness โ€” One Size Doesnโ€™t Fit All

AI writing โ€œfeelsโ€ different across contexts. Academic writing has long, precise sentences with low entropy, while creative writing is expressive and variable.

To handle this, I introduced domain calibration. Each domain has its own weight configuration, reflecting what matters most in that context:

Domain Emphasis
Academic Linguistic structure, perplexity
Technical Semantic coherence, consistency
Creative Entropy, burstiness
Social Media Short-form unpredictability

This calibration alone improved accuracy by nearly 20% over generic baselines.


โš™๏ธ Engineering Choices That Matter

The platform auto-downloads models from Hugging Face on first run โ€” a deliberate design for scalability. It supports offline mode for enterprises and validates checksums for model integrity.

Error handling and caching logic were built to ensure robustness โ€” no dependency on manual model management.

This kind of product-level thinking is essential when transitioning from proof-of-concept to MVP.


๐Ÿ“Š The Results โ€” What the Data Says

Across test sets covering GPT-4, Claude-3, Gemini, and LLaMA content, the system achieved:

Model Accuracy Precision Recall
GPT-4 95.8% 96.2% 95.3%
Claude-3 94.2% 94.8% 93.5%
Gemini Pro 93.6% 94.1% 93.0%
LLaMA 2 92.8% 93.3% 92.2%
Overall 94.3% 94.6% 94.1%

False positives dropped below 3% after domain-specific recalibration โ€” a huge leap compared to most commercial detectors.


๐Ÿ’ก Lessons Learned

This project wasnโ€™t just about detecting AI text โ€” it was about understanding why models write the way they do.

I learned how deeply metrics like entropy and burstiness connect to human psychology. I also learned the importance of explainability โ€” users trust results only when they can see why a decision was made.

Balancing statistical rigor with engineering pragmatism turned this into one of my most complete data science projects.


๐Ÿ’ผ Real-World Impact and Vision

AI text detection has implications across multiple industries:

๐ŸŽ“ Education: plagiarism and authorship validation

๐Ÿ’ผ Hiring: resume authenticity and candidate writing verification

๐Ÿ“ฐ Publishing: editorial transparency

๐ŸŒ Social media: moderation and misinformation detection

I envision this project evolving into a scalable SaaS or institutional tool โ€” blending detection, attribution, and linguistic analytics into one explainable AI platform.


๐Ÿ”ฎ Whatโ€™s Next

Expanding to multilingual support

Incorporating counterfactual explainers (LIME, SHAP)

Model-specific attribution (โ€œWhich LLM wrote this?โ€)

Continuous benchmark pipelines for new generative models

The whitepaper version dives deeper into methodology, mathematics, and system design.

๐Ÿ“˜ Read the full Technical Whitepaper (PDF)


โœ๏ธ Closing Thoughts

As AI blurs the line between human and machine creativity, itโ€™s essential that we build systems that restore trust, traceability, and transparency. Thatโ€™s what the AI Text Authentication Platform stands for โ€” not just detection, but understanding the fingerprints of intelligence itself.


Author:

Satyaki Mitra โ€” Data Scientist, AI Researcher

๐Ÿ“ Building interpretable AI systems that make machine learning transparent and human-centric.