mlsanityData to 7 Oct 2026

Semantic Source Code Segmentation using Small and Large Language Models

arXiv 2507.08992 ↗First posted 11 Jul 2025cs.SE cs.CL cs.PLcited by 0

Not on the map. Why?

Abstract (arXiv)

Source code segmentation, dividing code into functionally coherent segments, is crucial for knowledge retrieval and maintenance in software development. While enabling efficient navigation and comprehension of large codebases, manual and syntactic analysis approaches have become impractical as repositories grow, especially for low-resource languages like R and their research domains (e.g., social sciences, psychology).This paper introduces an automated, domain-specific approach for research R code segmentation using Large and Small Language Models (LLMs/SLMs). It presents two novel approaches and a human-annotated dataset, StatCodeSeg. We explore two distinct approaches: line-by-line analysis with context and range-based segment determination. We experiment with LLMs and fine-tuned SLMs. To support the generalizability of our approaches, we also include experiments on Python code from the computer science domain.Our results show that context-based line-by-line analysis is superior over range-based segmentation.Using smaller language models like CodeBERT and an encoder-only version of CodeT5+ are better than their LLM counterparts. Most notably, these two best-performing models did not see R code during pre-training versus the LLMs but were only fine-tuned on 4,130 lines of manually annotated code.

Key facts. No citing papers in the map yet (data through 7 Oct 2026). Builds on 23 of its 39 references that are in the map. First posted on arXiv 11 Jul 2025.

Builds on

23 of 39 references.

References · 23

  1. 2023GPT-4 Technical Reportcited by 18,132
  2. 2021Evaluating Large Language Models Trained on Codecited by 8,053
  3. 2023Code Llama: Open Foundation Models for Codecited by 2,105
  4. 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
  5. 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,154
  6. 2024Qwen2.5-Coder Technical Reportcited by 1,151
  7. 2024StarCoder 2 and The Stack v2: The Next Generationcited by 484
  8. 2023CodeT5+: Open Code Large Language Models for Code Understanding and Generationcited by 327
  9. 2023CodeGen2: Lessons for Training LLMs on Programming and Natural Languagescited by 124
  10. 2023Text Classification via Large Language Modelscited by 104
  11. 2018Text Segmentation as a Supervised Learning Taskcited by 76
  12. 2020Text Segmentation by Cross Segment Attentioncited by 54
11 more
  1. 2024LumberChunker: Long-Form Narrative Document Segmentationcited by 36
  2. 2021Unsupervised Topic Segmentation of Meetings with BERT Embeddingscited by 30
  3. 2023Exploring Code Analysis: Zero-Shot Insights on Syntax and Semantics with LLMscited by 19
  4. 2014Topic Segmentation and Labeling in Asynchronous Conversationscited by 8
  5. 2025Experience with GitHub Copilot for Developer Productivity at Zoominfocited by 8
  6. 2023GenCodeSearchNet: A Benchmark Test Suite for Evaluating Generalization in Programming Language Understandingcited by 6
  7. 2020CORAL: COde RepresentAtion Learning with Weakly-Supervised Transformers for Analyzing Data Analysiscited by 3
  8. 2023Unsupervised Dialogue Topic Segmentation in Hyperdimensional Spacecited by 3
  9. 2019Logical Segmentation of Source Codecited by 1
  10. 2020Improving Segmentation for Technical Support Problemscited by 1
  11. 2023Topic Segmentation of Semi-Structured and Unstructured Conversational Datasets using Language Modelscited by 1

Built on by

Not cited yet.