MedHastra at SemEval-2026 Task 13: Stylometric Ensembles and Transformer Fine-Tuning for Robust AI Code Detection, Attribution, and Adversarial Analysis
Summary
Team MedHastra's submission to SemEval-2026 Task 13 addressed the detection of machine-generated code across diverse programming languages and generators. The team participated in three subtasks: binary detection of AI-generated code under out-of-distribution conditions (Subtask A), multi-class attribution across ten large language model families (Subtask B), and classification of human, fully AI-generated, hybrid, and adversarial code (Subtask C). For Subtask A, they used a stylometric ensemble with structural formatting and TF-IDF features, trained via Random Forest, Gradient Boosting, and Logistic Regression. For Subtasks B and C, CodeBERT was fine-tuned, incorporating class balancing strategies like downsampling and weighted cross-entropy. Results showed that handcrafted stylometric features performed poorly under strong distribution shifts, while transformer-based contextual modeling proved more effective for fine-grained attribution and hybrid/adversarial code detection.
Key takeaway
For Machine Learning Engineers developing AI code detection systems, prioritize transformer-based models like CodeBERT over traditional stylometric approaches. Your systems will achieve greater robustness for fine-grained attribution across LLM families and better handle hybrid or adversarial code, particularly under out-of-distribution conditions. Ensure you incorporate class balancing techniques during fine-tuning to optimize performance.
Key insights
Transformer-based contextual models outperform stylometric features for robust AI code detection and attribution, especially under distribution shifts.
Principles
- Contextual representations are crucial for AI code analysis.
- Stylometric features struggle with out-of-distribution code.
- Class balancing improves transformer fine-tuning.
Method
For binary detection, combine stylometric features (TF-IDF, structural) with ensemble models (Random Forest, Gradient Boosting, Logistic Regression). For attribution/hybrid, fine-tune CodeBERT with class balancing.
In practice
- Prioritize contextual models like CodeBERT for code attribution.
- Implement class balancing for fine-tuning code models.
- Avoid purely stylometric features for OOD code detection.
Topics
- AI Code Detection
- Transformer Models
- CodeBERT
- Stylometric Analysis
- Large Language Models
- Out-of-Distribution Detection
Best for: Research Scientist, AI Scientist, Machine Learning Engineer, NLP Engineer
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by Paper Index on ACL Anthology.