Segmentation Strategies for Long-Code Authorship Detection: Balancing Context Coverage and Computational Efficiency

Authors

  • Mehedi Hasan Jahangirnagar University
  • Mahbub Islam Mahim Jahangirnagar University
  • Jugal Krishna Das Jahangirnagar University

Abstract

Detecting the authorship of source code becomes substantially more difficult when programs exceed the fixed context window of transformer-based models, as important stylistic and structural cues may fall outside the observed input. Although long programs are common in real-world software repositories, there is limited systematic understanding of how practical segmentation strategies influence authorship detection under such constraints. We investigate this problem by comparing three widely applicable approaches that require no modification to pretrained models: truncation-based classification, multi-view cropping with aggregation, and sliding-window classification with logit pooling. These methods reflect different trade-offs between computational cost and context coverage. All approaches are evaluated under a unified experimental setup on a lengthstratified dataset that emphasizes long code samples. Multi-view classification substantially improves over truncation, achieving 0.896 accuracy and 0.860 macro-F1, compared to 0.862 accuracy and 0.817 macro-F1 for truncation (+3.43 and +4.31 points, respectively). Sliding-window classification attains the highest overall performance (0.897 accuracy, 0.862 macro-F1), but multiview reaches near-parity (within 0.10 accuracy and 0.23 macro- F1) while requiring far fewer forward passes. Improvements are most pronounced for hybrid and adversarial code, where discriminative evidence is dispersed across distant regions of the program. These results indicate that context coverage is a primary factor in effective code authorship detection and provide practical guidance for selecting efficient long-context handling strategies when full-program processing is infeasible.

Downloads

Published

2026-08-25

How to Cite

Mehedi Hasan, Mahim, M. I., & Jugal Krishna Das. (2026). Segmentation Strategies for Long-Code Authorship Detection: Balancing Context Coverage and Computational Efficiency. Jahangirnagar University Journal of Electronics and Computer Science, 17. Retrieved from https://ecs.ju-journal.org/jujecs/article/view/63