\documentclass[11pt]{article}

% Change "review" to "final" to generate the final (sometimes called camera-ready) version.
% Change to "preprint" to generate a non-anonymous version with page numbers.
\usepackage[final]{acl}

% Standard package includes
\usepackage{times}
\usepackage{latexsym}

% For proper rendering and hyphenation of words containing Latin characters (including in bib files)
\usepackage[T1]{fontenc}
% For Vietnamese characters
% \usepackage[T5]{fontenc}
% See https://www.latex-project.org/help/documentation/encguide.pdf for other character sets

% This assumes your files are encoded as UTF8
\usepackage[utf8]{inputenc}

% This is not strictly necessary, and may be commented out,
% but it will improve the layout of the manuscript,
% and will typically save some space.
\usepackage{microtype}

% This is also not strictly necessary, and may be commented out.
% However, it will improve the aesthetics of text in
% the typewriter font.
\usepackage{inconsolata}

%Including images in your LaTeX document requires adding
%additional package(s)
\usepackage{graphicx}

\usepackage{listings}
\usepackage{xcolor}

\definecolor{codegray}{gray}{0.9}

\lstset{
    backgroundcolor=\color{codegray},
    basicstyle=\ttfamily\small,
    keywordstyle=\color{blue},
    commentstyle=\color{green!60!black},
    stringstyle=\color{red},
    showstringspaces=false,
    breaklines=true,
    %frame=single,
    language=Python
}

% If the title and author information does not fit in the area allocated, uncomment the following
%
\setlength\titlebox{6.5cm}
%
% and set <dim> to something 5cm or larger.

\title{LATE-IIMAS at Semeval-2026 Task 13: Evaluating GNNs, PLMs, LLMs, and Stylometry for Automatic Code Identification}

% Author information can be set in various styles:
% For several authors from the same institution:
% \author{Author 1 \and ... \and Author n \\
%         Address line \\ ... \\ Address line}
% if the names do not fit well on one line use
%         Author 1 \\ {\bf Author 2} \\ ... \\ {\bf Author n} \\
% For authors from different institutions:
% \author{Author 1 \\ Address line \\  ... \\ Address line
%         \And  ... \And
%         Author n \\ Address line \\ ... \\ Address line}
% To start a separate ``row'' of authors use \AND, as in
% \author{Author 1 \\ Address line \\  ... \\ Address line
%         \AND
%         Author 2 \\ Address line \\ ... \\ Address line \And
%         Author 3 \\ Address line \\ ... \\ Address line}

% \author{Andric Valdez-Valenzuela \\
%   Affiliation / Address line 1 \\
%   Affiliation / Address line 2 \\
%   Affiliation / Address line 3 \\
%   \texttt{andric.valdez@gmail.com} \\\And
%   Second Author \\
%   Affiliation / Address line 1 \\
%   Affiliation / Address line 2 \\
%   Affiliation / Address line 3 \\
%   \texttt{email@domain} \\}

% \author{
%     Andric Valdez\\
%     Posgrado en Ciencia e Ingeniería de la Computación\\
%     \textbf{Emmanuel Ancona} \\
%     Facultad de Ciencias\\
%     \textbf{Sebastián Bernardino} \\
%     Facultad de Estudios Superiores de Acatlán\\
%     \textbf{Helena Gomez-Adorno, Fazlourrahman Balouchzahi,  Fabian Herrera }\\ 
%     Instituto de Investigaciones en Matemáticas y en Sistemas \\ 
%     Universidad Nacional Autónoma de México, Ciudad de México\\
%     %Ciudad de México, México \\
%     %andric\_valdez@comunidad.unam.mx%fernando.marquezperez@ciencias.unam.mx \\
%     %jorge.pm@ceiich.unam.mx, helena.gomez@iimas.unam.mx, gbele@iingen.unam.mx
% }

\author{
 \textbf{Andric Valdez\textsuperscript{1}},
 \textbf{Emmanuel Ancona\textsuperscript{2}},
 \textbf{Sebastián Bernardino\textsuperscript{3}},
 \textbf{Fabian Herrera\textsuperscript{4}},
\\
 \textbf{Fazlourrahman Balouchzahi\textsuperscript{4}},
 \textbf{Helena Gomez-Adorno\textsuperscript{4}}
%  \textbf{Seventh Author\textsuperscript{1}},
%  \textbf{Eighth Author \textsuperscript{1,2,3,4}},
%\\
%  \textbf{Ninth Author\textsuperscript{1}},
%  \textbf{Tenth Author\textsuperscript{1}},
%  \textbf{Eleventh E. Author\textsuperscript{1,2,3,4,5}},
%  \textbf{Twelfth Author\textsuperscript{1}},
%\\
%  \textbf{Thirteenth Author\textsuperscript{3}},
%  \textbf{Fourteenth F. Author\textsuperscript{2,4}},
%  \textbf{Fifteenth Author\textsuperscript{1}},
%  \textbf{Sixteenth Author\textsuperscript{1}},
%\\
%  \textbf{Seventeenth S. Author\textsuperscript{4,5}},
%  \textbf{Eighteenth Author\textsuperscript{3,4}},
%  \textbf{Nineteenth N. Author\textsuperscript{2,5}},
%  \textbf{Twentieth Author\textsuperscript{1}}
\\
\\
 \textsuperscript{1}Posgrado en Ciencia e Ingeniería de la Computación,\\
 \textsuperscript{2}Facultad de Ciencias,\\
 \textsuperscript{3}Facultad de Estudios Superiores Acatlán,\\
 \textsuperscript{4}Instituto de Investigaciones en Matemáticas y en Sistemas,\\
 \textbf{Universidad Nacional Autónoma de México (UNAM)}\\
\\
 \small{
   \textbf{Correspondence:} \href{mailto:andric.valdez@gmail.com}{andric.valdez@gmail.com}
 }
}

\begin{document}
\maketitle
\begin{abstract}
%\textcolor{red}{Completar al final}

The generation of source code via Artificial Intelligence has become a prevalent practice in both academia and industry, posing significant challenges to academic integrity and authorship attribution. In this work, we address SemEval-2026 Task 13: Detecting Machine-Generated Code by evaluating the effectiveness of four distinct methodologies: Graph Neural Networks (GNNs), Pre-trained Language Models (PLMs), Large Language Models (LLMs), and Stylometric Feature Engineering using XGBoost. Our approach focuses on three specific scenarios: Subtask A (Binary Detection), Subtask B (Multi-Class Authorship), and Subtask C (Hybrid Code Detection). While our models achieved high performance during the validation phase, the transition to the final test set revealed substantial challenges in generalization, likely due to the increased diversity of programming languages and generators in the unseen data. This work serves as a foundational first step, identifying critical gaps in model robustness and highlighting the need for more sophisticated methodologies to bridge the performance gap in complex, real-world environments.

\end{abstract}

\section{Introduction} 
Nowadays, LLMs can create robust scripts, which are useful for speeding up coding production  \cite{11315793}. They are doing so well that it is a big challenge to distinguish them from those made by humans, and we need a system to achieve authorship classification \cite{pan2024assessing}.\\
For this reason, we tackle SemEval-2026 Task 13 \cite{orel-etal-2026-semeval-2026}: Detecting Machine-Generated Code with Multiple Programming Languages, Generators, and Application Scenarios, which consists of three subtasks, A: Binary Machine-Generated Code Detection, B: Multi-Class Authorship Detection, and C: Hybrid Code Detection.\\
We evaluated four main approaches: 1) Graph Neural Networks (GNNs), 2) Pretrained  Language Models (PLMs), 3) Large Language Models (LLMs), and 4) Stylometric Features.
With the GNN approach, we leverage structural information from the code co-occurrence graphs; for the stylometric approach we used a XGBoost ensemble with fixed stylometric features; in the PLMs approach, we integrate a Domain Adversarial Neural Network (DANN) with the CodeBERT model \cite{feng2020codebert}, which incorporates two new independent classification heads; and finally in the LLM approach, we ask for Command A \cite{team2025command} to classify each code, adding to each prompt 2 examples of how to perform the classification\footnote{Code repository: \url{https://github.com/PLN-disca-iimas/code-detect-Semeval2026}
}.

%----Have you released your code? Give a URL. 

\section{Related Work} 

% \begin{itemize}
%     \item Metodos tradicionales, ing de caracterisitcas para deteccion de codigo gen.
%     \item PLMs para detección de código generado
%     \item \textbf{AI generated code detection with PLM's}
%     \item Métodos con AST
%     \item GNNs para código
%     \item etc
% \end{itemize}

Graph Neural Networks have become an increasingly used technique in text analysis for classification in document clustering, sentiment analysis, and semantic similarity, among other classic NLP tasks, as detailed in the survey by \citet{wu2023graph}. In this context, Abstract Syntax Trees (AST) are a useful tool for representing code as graphs, as done by code2vec, explained by \citet{alon2019code2vec}, since, unlike text in NLP, code presents hierarchical structures that are better captured using this structure. It is also worth mentioning the previous work carried out by our institution in the analysis of languages of the Iberian Peninsula at IberAuTexTification 2024 for stylometric analysis using Graph Neural Networks proposed by \citet{valdez-gomez-adorno-2025-text}, which was a starting point for this work. These approaches are important because PLMs such as CodeBERT \cite{feng2020codebert} tend to ignore the logical hierarchy inherent to source code, regardless of the language; being based on the transformer architecture, CodeBERT captures semantic dependencies in the code, which allows for a different perspective compared to the syntactic analysis of ASTs. %Our objective with this work is to use the syntactic analysis of GNNs and ASTs and compare it with that of PLMs like CodeBERT to identify code generated by Large Language Models.

Another approach that has addressed this problem is feature extraction for training classical Machine Learning models, specifically focusing on XGBoost ensemble models. As shown in the work of \cite{11029948}, certain features, such as lexical diversity (measured through line counts, number of unique tokens, and vocabulary, among others), as well as feature extraction aided by AST, are utilized. With this, we compare the results against those obtained with PLMs and GNNs.

Our approach consists of comparing the results obtained from classifying the code snippets using the different techniques described in this section.

%Our starting point is a dataset of code from different programming languages (Python, Java, and C++), generated by various LLMs as well as by humans. The distribution and characteristics of this dataset will be detailed in the following section.


\section{Dataset}


In this task, the organizers provided a dataset derived from enriched data from our previous work \cite{Dataset1} \cite{Dataset2}. For each subtask, three subsets, training, validation, and test, compose the dataset; the training instances ranged from 500,000 to 900,000. All datasets consist of four columns: 

\begin{itemize}
    \item code - program code.
    \item generator - the model which generated the code (or 'human' if it is human-written).
    \item language - programming language of the code.
    \item label - A numerical value which represents the class, i.e., the author of the code (classes are different between tasks).
\end{itemize}

The following labels are presented for each task:

\begin{itemize}
    \item \textbf{Task A}: Binary classification problem. Two labels, 0 (human) and 1 (AI).
    \item  \textbf{Task B}: Multiclass classification problem. Eleven labels: 0 (human), 1 (DeepSeek-AI), 2 (Qwen), 3 (01-ai), 4 (Bigcode), 5 (Gemma), 6 (Phi), 7 (meta-LLaMA), 8 (IBM-granite), 9 (Mistral), and 10 (OpenAI).
    \item \textbf{Task C}: Multiclass classification problem. Four labels, 0 (human), 1 (AI), 2 (Hybrid), 3 (Adversarial)
\end{itemize}


Depending on the task, the codes are written in up to 8 programming languages: Python, Java, JavaScript, C\#, C++, Go, PHP, and C. A common pattern is that the majority of the codes in both the training data and the test data are in Python and Java. Also, the LLM authors come from the same LLM families mentioned in the previous paragraph. e.g., GPT-4o and GPT-4o-mini are unique authors derived from the same LLM family.


Counting all kinds of characters (including white spaces), the code length is, in general, around 1,250 characters, also counting that a lot of them have comments, the actual coding is somewhat short. However, the dataset has a good amount of medium and large codes. 

Appendix \ref{apendice:distribucion} shows more information about the label, programming language, and code length distribution for all task subsets.

\subsection{Preprocessing}
\label{Preprocessing}

Due to the quantity and imbalance of some of the datasets, we modify the training subset to accomplish a better generalization and representation of the data. 

In task A, labels are balanced, but programming languages are highly imbalanced (Java, C++, and Python, with an excess of the latter). We made two partitions to address this issue: equitable and Python undersampling. To address this issue, we created two partitions: Equitable and Python Undersampling. In the Equitable partition, we reduced the number of Python instances to match the count of other languages while preserving the original author proportions. Python Undersampling is a variation of this strategy that further reduces the volume of Python data. However, instead of fully balancing all programming languages, we only decrease Python samples enough to narrow the gap in their proportions. Table \ref{table:partiA} shows the partitions and their characteristics.

In task B, unlike task A, the authors are not balanced, produced primarily by the large amount of human codes compared to the others. We decided not to do undersampling, but to divide the data into two parts: Human vs LLM and LLM only. In Human vs LLM, we changed the labels into 0 (humans) and 1 (machine); the machine class incorporates the remaining authors. As a result, we improved the authors' imbalanced situation. For the LLM only, we removed the human class completely. Table \ref{table:partiB} summarizes the final dataset for task B, with brief additional information.

\begin{table}[!ht]
\caption{Train and validation partitions for task A.}
\label{table:partiA}
\centering
\resizebox{0.4\textwidth}{!}{
\begin{tabular}{|c|c|c|c|}
\hline
\textbf{Partition}                                                                    & \textbf{Description}                                                                                                      & \textbf{\begin{tabular}[c]{@{}c@{}}Present \\ languages\end{tabular}}                     & \textbf{\begin{tabular}[c]{@{}c@{}}Training \\ Instances\end{tabular}} \\ \hline
\textit{\textbf{Equitable}}                                                          & \begin{tabular}[c]{@{}c@{}}- Balance labels\\ - Balance languages\end{tabular}                                            & Python, Java, C++                                                                         & $\sim$62,000                                                           \\ \hline
\textit{\textbf{\begin{tabular}[c]{@{}c@{}}Python \\ under-\\ sampling\end{tabular}}} & \begin{tabular}[c]{@{}c@{}}- Balance labels\\ - Undersampling \\ on python\\ - Reduced language \\ imbalance\end{tabular} & Python, Java, C++                                                                         & $\sim$143,000                                                          \\ \hline
\end{tabular}
}
\end{table}

\begin{table}[!htb]
\caption{Dataset preprocessing on task B}
\label{table:partiB}
\centering
\resizebox{0.4\textwidth}{!}{
\begin{tabular}{|c|c|c|}
\hline
\textbf{Partition}                                                         & \textbf{Description}                                                                     & \textbf{\begin{tabular}[c]{@{}c@{}}Training \\ Instances\end{tabular}} \\ \hline
\textit{\textbf{Original}}                                                 & No changes                                                                               & $\sim$500,000                                                          \\ \hline
\textit{\textbf{\begin{tabular}[c]{@{}c@{}}Human\\ vs\\ LLM\end{tabular}}} & \begin{tabular}[c]{@{}c@{}}The labels are\\ changed\\ 0 (human) 1 (machine)\end{tabular} & $\sim$500,000                                                          \\ \hline
\textit{\textbf{LLM only}}                                                 & \begin{tabular}[c]{@{}c@{}}The human instances\\ are removed\end{tabular}                & $\sim$57,904                                                           \\ \hline
\end{tabular}
}
\end{table}


\section{System Overview} 
In this section, we present the different approaches explored for the Machine-Generated Code detection task. We first describe in Section \ref{baselines} the traditional baselines and, in Section \ref{Stylometric_Features}, the stylometric feature-based methods, followed by Section \ref{ptllm} and \ref{llm}, the domain-adaptive pre-trained language models and prompting strategies with large language models, respectively. Finally, Section \ref{gnn} introduces our Graph Neural Network approach, which leverages text graph representations and graph-based deep learning to model structural relationships within code for classification. 

\subsection{Baselines}
\label{baselines}
The organizers provided CodeBERT as a baseline, an encoder capable of processing and understanding natural language and programming language ('bimodal' pretrained model), which has 125 million parameters, considered a small model for today's standards.  

\begin{figure*}[!htb]
        \centering
        \includegraphics[width=13.0cm]{latex/DANN_pipeline.png}
        \caption{System overview for Pre-trained Language Model}
        \label{fig:sys_overviewDANN}
    \end{figure*}
    
\subsection{Stylometric Features}
\label{Stylometric_Features}

Stylometric analysis consists of extracting features from the source code in our dataset based on its stylistic properties; once these features are obtained, an XGBoost model is trained for classification. For code tokenization, we used regular expressions that search for sequences of letters (including underscores to detect function and variable naming conventions), numbers, and special structural and operational characters. With this in mind, we consider the following features to construct our final feature vector.

\begin{enumerate}
    \item \textbf{Length Properties}
    \begin{itemize}
        \item \textit{Code Length:} Total number of characters in the code calculated via string methods.
        \item \textit{Average Line Length:} The mean number of characters per line across the entire code snippet.
    \end{itemize}

    \item \textbf{Lexical Variety}
    \begin{itemize}
        \item \textit{Total Token Count:} Total number of tokens identified after tokenization.
        \item \textit{Unique Tokens:} Number of distinct tokens in the snippet.
        \item \textit{Token Ratio:} The ratio of unique tokens to total tokens.
    \end{itemize}

    \item \textbf{Comments}
    \begin{itemize}
        \item \textit{Comment Count:} Identification of comments using common prefixes (\texttt{\#, //, /*, --, ;}). We verify both line-start comments and inline comments by checking for trailing characters after the prefix.
        \item \textit{Comment Density:} The ratio of identified comments to the total number of lines.
    \end{itemize}

    \item \textbf{Indentation}
    \begin{itemize}
        \item \textit{Average Indentation:} The mean indentation value calculated after expanding tabs into a fixed number of spaces.
        \item \textit{Standard Deviation:} The variation of indentation across all lines.
        \item \textit{Indentation Levels:} The count of unique indentation depths present in the code.
    \end{itemize}
\end{enumerate}

Feature vectors are standardized via \textit{Z-score} before training an \textbf{XGBoost} model, which predicts the class with the highest probability ($argmax$).


\subsection{Pre-trained Language Models}
\label{ptllm}

This system combines the baseline with a Domain-Adversarial Neural Network \cite{DANN}. The DANN model incorporates two independent classification heads after the main architecture. Given a sample, one head classifies the main target, while the secondary head identifies the domain to which the sample belongs. During training, both heads compute their own loss function separately. Then, in the backward propagation step, a gradient reversal layer is inserted between the secondary head and the main body. This layer multiplies the sign of the domain gradient by minus one. Consequently, the main label gradient is backpropagated normally through the principal classifier and the main body, whereas the secondary gradient propagates normally only along the secondary classifier and in the opposite direction through the main body.
The objective is to learn a model that generalizes well across domains. For this task, we consider the programming language as our domain set (which is highly imbalanced across all three tasks), with Python prevailing over the others. Hence, we expect to generalize well to other, less frequent programming languages such as Go.

Figure \ref{fig:sys_overviewDANN} shows the approach used to solve the Machine-Generated Code task. In Task A, our best model was trained on the partitioned Python-undersampling data \ref{table:partiA}. For Task B, we used a cascade system to make predictions: we trained two DANN models, the first was a binary identification model trained on the Human vs LLM set (which makes the initial prediction), and the second was a multi-classifier DANN trained on the LLM only set \ref{table:partiB}. Finally, for Task C, as mentioned before, we used the entire dataset.

\subsection{Large Language Models}
\label{llm}

We used the LLM Command A from Cohere \cite{team2025command} to tackle subtask A. We extract two examples from the training dataset and use them as prompts for each classification. We tested different temperature values, and the best results were obtained at 0.3. We used the following prompt: \begin{lstlisting}
prompt = f""" code: "{code_examples}"
Label: {examples_label}
You must classify the next code as human made or artificial intelligence generated.
Your response must be only one of this labels: 0 for human made and 1 for AI generated.
Code:
{code_block}
Now output the label with no extra text:
"""
\end{lstlisting}

% poner una columna extra por cada tarea donde se nuestro vea el ranking fina
% agregar una fila donde se vean los ranking finales de los equipos

\begin{table*}[!ht]
\caption{Results of the best F1-scores obtained by each strategy on the validation and final test datasets. The last row shows the top-ranked system on the final leaderboard.}
\label{table:results}
\centering
\begin{tabular}{lcccccc}
\hline
%& \multicolumn{6}{c}{\textit{Macro F1-score}} \\ \cline{1-7} 
\textit{Subtask} & \multicolumn{2}{c}{\textit{A}} & \multicolumn{2}{c}{\textit{B}} & \multicolumn{2}{c}{\textit{C}} \\
\textit{Approach} & \textit{Validation} & \textit{Test} & \textit{Validation} & \textit{Test} & \textit{Validation} & \textit{Test} \\ \hline
Baseline & \textbf{0.9875} & 0.3053 & 0.3500 & 0.2285 & 0.7000 & 0.4812 \\
GNN      & 0.8412    & 0.5381 & \textbf{0.8675}    & 0.1550    & N/A    & N/A    \\
PLM      & 0.9774 & 0.4219 & 0.5265 & \textbf{0.3324} & \textbf{0.8425} & \textbf{0.5677} \\
LLM      & 0.6192    & \textbf{0.5641} & N/A    & N/A    & N/A    & N/A    \\
Stylometry & 0.8400 & 0.3200 & N/A    & N/A    & N/A    & N/A    \\ \hline
Best ranked score & \multicolumn{2}{c}{\textit{0.9971}} & \multicolumn{2}{c}{\textit{0.5081}} & \multicolumn{2}{c}{\textit{0.7855}} \\
\end{tabular}
\end{table*}


\subsection{Graph Neural Networks}
\label{gnn}

\begin{figure*}[ht!]
        \centering
        \includegraphics[width=15.5cm]{images/sys_overview_semeval13.png}
        \caption{System overview using GNN approach}
        \label{fig:sys_overview}
    \end{figure*}

Figure \ref{fig:sys_overview} shows the GNN approach. This pipeline transforms each code document into a graph representation and learns node-level embeddings for classification. First, we applied text preprocessing: we cleaned the raw code, balanced the training distribution via subsampling, and included an out-of-distribution approach. 

After that, we build a co-occurrence graph per document using a special tokenizer: extracts code units (identifiers, operators, punctuation symbols, numbers, and strings), optionally removing comments and normalizing literals (e.g., mapping strings to <STR> and numbers to <NUM>), while preserving structural tokens such as brackets and operators. These tokens represent the graph nodes, and undirected edges connect tokens that co-occur within a fixed window in the token sequence. Figure \ref{fig:train_doc0_graph} illustrates an example of the Co-Occurrence Graph generated from the following Python code:

\begin{lstlisting}
(b, a) = map(int, input().split())
div = int(a // b)
rem = a % b
if rem == 0:
    print(int(div))
else:
    print(div + 1)
\end{lstlisting}

\begin{figure}[ht]
    \centering
    \includegraphics[width=\columnwidth]{images/train_doc0_graph.png}
    \caption{Co-Occurrence Graph}
    \label{fig:train_doc0_graph}
\end{figure}


Using this graph representation as input, we initialize node features with contextual embeddings from a pre-trained language model (e.g., CodeBERT) to provide semantic information before graph learning. The obtained graph is processed by a Graph Neural Network to refine node representations by leveraging their structural co-occurrence patterns. Finally, we aggregate node embeddings with mean pooling to obtain a single graph (document) embedding, which is passed to a simple neural classifier to predict whether the input code was written by a human or generated by a machine.


\section{Results} 

This section presents the F1-scores for the following approaches: GNN, PLM, LLM, Stylometry, and the baseline. 
Table \ref{table:results} summarizes our results for each task on both the validation and test sets. We include both scores to highlight the substantial discrepancy that can arise between the approaches. In task A, we used the undersampling partition \ref{table:partiA}. Note that not every approach was applied to every subtask; in such cases, the result is marked as N/A.

All our models outperform the baseline on task A, and the LLM system achieves the best performance, with an F1-score of 0.5641, indicating that few-shot strategies are more effective. Followed for the GNN approach, achieving a 0.5381 F1-score, demonstrating the effectiveness of graph representations for this task. Finally, we ranked 38th in Subtask A on the final leaderboard using the GNN approach. For Subtasks B and C, using the PLM approach, we ranked 25th and 22nd, respectively.

\section{Conclusions}

This research presents four independently developed systems for SemEval 2026 Task 13, each of which exhibits different strategies: Graph Neural Networks, Pretrained Language Models, Large Language Models, and Stylometry. The limited representation and imbalance of programming languages in the dataset made it difficult for our models to generalize effectively. However, for all of our systems, applying a dataset partitioning strategy helped improve performance. Specifically for stylometry, recognizing new languages poses a significant challenge for the way our solution was designed. For tasks B and C, we used a PLM and GNN, obtaining better results than the baseline. Future work includes combining these systems, exploring other encoders (e.g., GraphCodeBERT), and exploring different graph representations.

% but also showing a large room for improvement.

% Furthermore, selecting more representative features could improve the model's performance

\section*{Acknowledgments}
Andric Valdez (CVU-927264) thanks the Secretaría de Ciencia, Humanidades, Tecnología e Innovación (SECIHTI) graduate degree scholarship program.
The authors also thank Adrian Durán Chavesti, Ricardo Villareal, and Rita Rodriguez of the Instituto de Investigaciones en Matemáticas Aplicadas y en Sistemas (IIMAS) for their support with the computational resources (access, configuration, and administration) used to run the experiments.
Fazlourrahman Balouchzahi acknowledges the support from the SECIHTI, Mexico, through the Postdoctoral Fellowship Program (EPM 2025).

% This document has been adapted by ...

% Bibliography entries for the entire Anthology, followed by custom entries
%\bibliography{anthology,custom}
% Custom bibliography entries only
\bibliography{custom}

\appendix
\section{Dataset Statistics}
\label{apendice:distribucion}

In this section, we present the label, programming language, and code length distributions for each subtask (A, B, and C) in the training and validation subsets. These statistics were heavily considered when constructing all the models and defined how we approached each subtask, because the distributions differ notably between them.

\begin{figure}[!htb]
    \centering
    \includegraphics[width=1.0\linewidth]{latex/task_A_label.png}
    \caption{Label distribution for train and validation datasets on task A}
    \label{fig:label_distribution_A}
\end{figure}


Figure \ref{fig:label_distribution_A} shows a very equitable label distribution for the binary classification task A in both training and validation. Class 1 (AI) is slightly more abundant than class 0 (human). If needed, balancing this task completely is easy, since each class has approximately 250,000 instances. After subsampling, the amount of data remains sufficient to train all the models.


Figure \ref{fig:langugage_distribution_A} shows the language distribution for task A. Python, Java, and C++ are the only languages present, with Python overwhelmingly dominating the other two (over 90$\%$). This has important implications for the models: they may not generalize well to new data, especially if written in programming languages never seen before, and they could learn spurious correlations—for instance, associating Java or C++ with a specific class. To mitigate this, we applied undersampling strategies to better balance the distribution.

\begin{figure}[!htb]
    \centering
    \includegraphics[width=1.0\linewidth]{latex/task_A_language.png}
    \caption{Language distribution for train, validation, and test sample datasets on task A}
    \label{fig:langugage_distribution_A}
\end{figure}

Figure \ref{fig:code_lengh_distribution_A} shows the code length distribution for task A. Code length refers to the number of characters, giving us an idea of how many tokens each code contains. This is very important for GNN, PLM, and LLM models, as they can only process a limited number of tokens—meaning that long codes can only be partially analyzed, potentially affecting predictions. Overall, the codes are short, but long codes are still present in the datasets.
\begin{figure}[!htb]
    \centering
    \includegraphics[width=1.0\linewidth]{latex/task_A_code.png}
    \caption{Code length distribution for train and validation datasets on task A}
    \label{fig:code_lengh_distribution_A}
\end{figure}

Figure \ref{fig:B_label} shows the label distribution for the multiclass classification problem of task B. The distribution only considers LLM generators for better visualization. Human-written codes constitute more than 80$\%$ of the training instances. The label distribution is highly imbalanced: some generators represent less than 1$\%$ of the total data. Imbalance also exists among the AI generators themselves. Performing undersampling for this task is more complicated.

\begin{figure}[!htb]
    \centering
    \includegraphics[width=1.0\linewidth]{task_B_label.png}
    \caption{Label distribution for train and validation datasets on task B}
    \label{fig:B_label}
\end{figure}

Figure \ref{fig:B_lang_dist} shows the language distribution for task B. This task features more diversity in programming languages, with eight in total. The most prominent languages are Python and Java, which appear in very similar amounts. Even so, due to the amount of data, each programming language has a sizable number of instances.

\begin{figure}[!htb]
    \centering
    \includegraphics[width=1.0\linewidth]{task_B_language.png}
    \caption{Language distribution for train and validation datasets on task B}
    \label{fig:B_lang_dist}
\end{figure}

Figure \ref{fig:B_len} shows the code length distribution for task B. Here, the codes are generally larger than in task A, with very long codes still present. For GNN, PLM, and LLM models, it is recommended to use a high maximum token cap to analyze all or at least the majority of each code.

\begin{figure}[!htb]
    \centering
    \includegraphics[width=1.0\linewidth]{task_B_code.png}
    \caption{Code length distribution for train and validation dataset on task B}
    \label{fig:B_len}
\end{figure}

Figure \ref{fig:C_label}  shows the label distribution for the multiclass classification problem of task C. Label 0 (human) is more prominent than the others, indicating imbalance among the four classes. However, the class with the fewest instances (label 2, hybrid) still has almost 100,000 examples. Undersampling techniques can balance this task completely while leaving ample training data.


\begin{figure}[!htb]
    \centering
    \includegraphics[width=1.0\linewidth]{task_C_label.png}
    \caption{Label distribution for train and validation datasets on task C}
    \label{fig:C_label}
\end{figure}

Figure \ref{fig:C_lang} shows the language distribution for task C. This distribution is very similar to that of task B, presenting eight programming languages, with Python and Java being more dominant than the others. Even so, due to the amount of data, each programming language has a sizable number~of~instances.

\begin{figure}[!htb]
    \centering
    \includegraphics[width=1.0\linewidth]{task_C_language.png}
    \caption{Language distribution for train and validation datasets on task C}
    \label{fig:C_lang}
\end{figure}

Figure \ref{fig:C_len} shows the code length distribution for task C. Overall, this task has longer texts than tasks B and A. This distribution makes it harder for GNN, PLM, and LLM models due to the risk of not analyzing the codes completely.

\begin{figure}[!htb]
    \centering
    \includegraphics[width=1.0\linewidth]{task_C_code.png}
    \caption{Code length distribution for train and validation dataset on task C.}
    \label{fig:C_len}
\end{figure}




\end{document}
