YoungDSMLKZ at SemEval-2026 Task 13: MIL-UniXcoder with Meta-Stacking and Handcrafted Features for AI-Generated Code Detection
Published in SemEval-2026 (ACL Anthology), July 2026
YoungDSMLKZ ranked first in SemEval 2026 Task 13, Subtask C, with an official macro F1 of 0.7855, 5.2 points above the runner up.
Together with Agzam Shamsadinov, I built an ensemble that combines multiple views to distinguish Human, AI generated, Hybrid, and Adversarial code across eight programming languages.
The research problem
Most transformer code detectors read only the first 512 tokens of a file. That is a serious limitation for code from real repositories: imports and class declarations near the beginning can look conventional even when AI generated logic appears much later.
Subtask C made the problem harder than binary detection. A system had to distinguish code written entirely by a human, generated by an AI model, edited jointly by a human and AI, or deliberately modified to evade detection. The benchmark covered Python, Java, JavaScript, C, C++, C#, PHP, and Go, with long files and realistic distribution shifts.
Our central research question was:
How can a detector preserve evidence from long code files while combining semantic, structural, and stylometric signals that fail in different ways?
My contribution: Dynamic Multiple Instance Learning
My main technical contribution was designing and implementing the Dynamic Multiple Instance Learning (MIL) pipeline. I also contributed to exploratory data analysis and handcrafted feature engineering used by the classical ML stream.
Instead of truncating a file, the MIL pipeline:
- splits it into overlapping windows of 512 tokens with a stride of 256;
- keeps up to 16 chunks, covering a maximum input length of 4,096 tokens;
- encodes each chunk independently with UniXcoder;
- uses max pooling to retain the strongest evidence across chunks; and
- passes the aggregated representation to a CatBoost classifier with class weights.
This chunking and pooling design scales linearly with the number of windows rather than applying quadratic attention over the full file. The paper reports that, among correctly identified AI samples with long context, the decisive chunk occurred beyond the first 512 tokens in 62.4% of cases.
A system that combines multiple views
The final solution combined three complementary streams rather than relying on a single large model.
| Stream | What it captured | Model |
|---|---|---|
| Dynamic MIL | Semantic evidence from distant parts of the code | UniXcoder + max pooling + CatBoost |
| Meta stacking | Complementary transformer predictions | UniXcoder + ModernBERT probabilities → CatBoost stacker |
| Stylometric ML | Formatting, lexical, AST, and heuristic signals | 200+ handcrafted features → XGBoost |
The final routing rule assigned each class to the subsystem with the strongest recall on the development split:
- AI and Adversarial → Dynamic MIL;
- Human → stylometric XGBoost;
- Hybrid → transformer meta stacking.
This ensemble combined multiple views of the same code. It was not a multimodal system.
Controlled results
We submitted the individual streams as well as the full system, allowing us to measure what each component contributed on the official test leaderboard.
| System | Official test macro F1 |
|---|---|
| Classical ML: XGBoost only | 0.5243 |
| Dynamic MIL with max pooling and CatBoost | 0.6331 |
| Meta stacking only | 0.6995 |
| Full ensemble with multiple views | 0.7855 |
The final ensemble improved macro F1 by 8.6 points over the strongest individual stream and finished 5.2 points above the system in second place.
Two routes to the top: scale and specialization
The official task overview contrasted our approach with TeleAI, an industrial research team affiliated with Xingchen AGI Lab and the Institute of Artificial Intelligence at China Telecom.
TeleAI won Subtasks A and B and placed second in C by tuning all parameters of Qwen3-30B-A3B-Instruct, optimizing prompts, training multiple checkpoints, and applying several forms of voting and LightGBM stacking. We instead combined compact specialists: Dynamic MIL, transformer meta stacking, stylometric XGBoost, and class routing.
This was not a direct comparison of model sizes. Both entries were complete ensemble systems, and they succeeded on different problem formulations. On the four class Human, AI, Hybrid, and Adversarial task, specialized decomposition produced the strongest result.
Recognition at ACL
During the official SemEval 2026 Task 13 overview presentation at ACL, the organizers highlighted YoungDSMLKZ as the best Subtask C system, explained the Dynamic MIL strategy, and noted that the team consisted of high school students.
Compute and implementation
We rented an NVIDIA H100 to tune the transformer models and also used Kaggle’s two Tesla T4 GPUs for supporting experiments and pipeline development. Transformer runs used mixed precision training, a fixed random seed, and early stopping based on development macro F1. The paper records the principal model, chunking, optimizer, and gradient boosting configurations.
Limitations
First place on one benchmark does not mean that AI generated code detection is solved.
- The system processes at most 4,096 tokens through up to 16 chunks; it does not cover arbitrarily long files.
- Stylometric features can be weakened by formatting normalization, identifier renaming, or other simple countermeasures.
- Hybrid and Adversarial code remained the hardest classes.
- The class routing rule was tuned heuristically on the development split and should eventually be replaced by learned gating.
- Real deployment requires strict controls on the false positive rate to avoid falsely accusing developers.
- Generalization should be tested on external languages, generators, and application domains that differ from the training distribution.
The organizers reached the same broader conclusion in their task analysis: distribution shift remains the real test. Strong performance on the training distribution does not guarantee reliable transfer to new code domains.
What this changed for me
Winning the shared task did not convince me that detection was finished. It showed me how easily a strong leaderboard score can hide unresolved questions about evidence from long context, domain shift, false positives, and evaluation design.
That experience moved my interest from simply building classifiers with higher scores toward a broader research question: how should AI systems be evaluated when their real operating environment differs from the benchmark? It now connects my work on generated content detection with my interest in reliable coding agents and evaluation for underrepresented languages.
Paper and code
The resulting system paper was published in the SemEval proceedings at ACL 2026, with me as first author.
X
Blog