Research Article

A Semantic and Lexical Analysis of LLM-Generated Responses in Comparison with Stack Overflow Answers

Number: Advanced Online Publication Early Pub Date: October 27, 2026

A Semantic and Lexical Analysis of LLM-Generated Responses in Comparison with Stack Overflow Answers

Abstract

Large Language Models (LLMs) have become indispensable tools in programming education and professional software development. However, their output quality remains poorly characterized, particularly in terms of the semantic and linguistic quality of the explanatory text. Traditional evaluation metrics such as ROUGE primarily rely on lexical overlap and therefore only partially reflect the semantic adequacy of code explanations. This study proposes a multi-metric evaluation framework integrating semantic embeddings and lexical metrics to assess the quality of explanations generated by LLMs. We conducted experiments on 442 question-answer pairs produced by human experts regarding Python programming language from Stack Overflow, comparing them with GPT-4o-mini outputs. Three embedding models (MiniLM-L6, MPNet-Base, Paraphrase-MiniLM) were employed to compute the measure of semantic similarity by using cosine similarity, and ROUGE metrics (ROUGE-1, ROUGE-2, ROUGE-L) were used for lexical analysis. Results reveal a high semantic alignment (cosine similarity: 0.65–0.75) but substantially lower lexical overlap (ROUGE:0.10–0.32), indicating that LLMs produce semantically sound yet lexically distinct explanations. Pearson correlation analysis reveals weak to moderate correlations (r=0.29–0.47) between semantic and lexical metrics, suggesting that traditional metrics alone are insufficient for a comprehensive evaluation. Statistical testing (paired t-tests, p < 0.001) shows significant differences among embedding models, with MPNet-Base achieving the highest semantic consistency. Our findings underscore the critical need for multidimensional evaluation frameworks in assessing LLM-generated explanations, particularly in technical domains where semantic accuracy is crucial.

Keywords

Ethical Statement

It is declared that during the preparation process of this study, scientific and ethical principles were followed and all the studies benefited from are stated in the bibliography.

References

  1. M. Chen et al., ”Evaluating large language models trained on code,” 2021, arXiv:2107.03374.
  2. P. Vaithilingam, T. Zhang, and E. L. Glassman, ”Expectation vs. experience: Evaluating the usability of code generation tools powered by large language models,” in CHI Conf. Human Factors Comput. Syst. Extended Abstracts, 2022, pp. 1–7, doi: 10.1145/3491101.3519665.
  3. N. Nguyen and S. Nadi, ”An empirical evaluation of GitHub copilot’s code suggestions,” in Proc. 19th Int. Conf. Mining Softw. Repositories (MSR), 2022, pp. 1–5, doi: 10.1145/3524842.3528470.
  4. S. Barke, M. B. James, and N. Polikarpova, ”Grounded copilot: How programmers interact with code-generating models” in Proc. ACM Program. Lang., vol. 7, pp. 85–111, 2023.
  5. OpenAI, ”GPT-4 technical report”, 2023, arXiv:2303.08774.
  6. R. Anil et al., PaLM 2 technical report, 2023, arXiv:2305.10403.
  7. S. Kabir, D. N. Udo-Imeh, B. Kou, T. Zhang, ”Is Stack Overflow obsolete? An empirical study of the characteristics of ChatGPT answers to Stack Overflow questions”, 2023, arXiv:2308.02312.
  8. J. Prather et al., ”The robots are here: Navigating the generative AI revolution in computing education,” in Proc. 2023 Working Group Reports Innov. Technol. Comput. Sci. Educ., 2023, pp. 108–159.

Details

Primary Language

English

Subjects

Natural Language Processing

Journal Section

Research Article

Early Pub Date

October 27, 2026

Publication Date

-

Submission Date

February 21, 2026

Acceptance Date

August 22, 2026

Published in Issue

Year 2026 Number: Advanced Online Publication

APA
Çelepkolu, K. C., Ortakcı, Y., & Karaoğlan, K. M. (2026). A Semantic and Lexical Analysis of LLM-Generated Responses in Comparison with Stack Overflow Answers. Sakarya University Journal of Computer and Information Sciences, Advanced Online Publication, 1485-1493. https://doi.org/10.35377/saucis...1865546
AMA
1.Çelepkolu KC, Ortakcı Y, Karaoğlan KM. A Semantic and Lexical Analysis of LLM-Generated Responses in Comparison with Stack Overflow Answers. SAUCIS. 2026;(Advanced Online Publication):1485-1493. doi:10.35377/saucis.1865546
Chicago
Çelepkolu, Kerem Can, Yasin Ortakcı, and Kürşat Mustafa Karaoğlan. 2026. “A Semantic and Lexical Analysis of LLM-Generated Responses in Comparison With Stack Overflow Answers”. Sakarya University Journal of Computer and Information Sciences, no. Advanced Online Publication: 1485-93. https://doi.org/10.35377/saucis. 1865546.
EndNote
Çelepkolu KC, Ortakcı Y, Karaoğlan KM (October 1, 2026) A Semantic and Lexical Analysis of LLM-Generated Responses in Comparison with Stack Overflow Answers. Sakarya University Journal of Computer and Information Sciences Advanced Online Publication 1485–1493.
IEEE
[1]K. C. Çelepkolu, Y. Ortakcı, and K. M. Karaoğlan, “A Semantic and Lexical Analysis of LLM-Generated Responses in Comparison with Stack Overflow Answers”, SAUCIS, no. Advanced Online Publication, pp. 1485–1493, Oct. 2026, doi: 10.35377/saucis...1865546.
ISNAD
Çelepkolu, Kerem Can - Ortakcı, Yasin - Karaoğlan, Kürşat Mustafa. “A Semantic and Lexical Analysis of LLM-Generated Responses in Comparison With Stack Overflow Answers”. Sakarya University Journal of Computer and Information Sciences. Advanced Online Publication (October 1, 2026): 1485-1493. https://doi.org/10.35377/saucis. 1865546.
JAMA
1.Çelepkolu KC, Ortakcı Y, Karaoğlan KM. A Semantic and Lexical Analysis of LLM-Generated Responses in Comparison with Stack Overflow Answers. SAUCIS. 2026;:1485–1493.
MLA
Çelepkolu, Kerem Can, et al. “A Semantic and Lexical Analysis of LLM-Generated Responses in Comparison With Stack Overflow Answers”. Sakarya University Journal of Computer and Information Sciences, no. Advanced Online Publication, Oct. 2026, pp. 1485-93, doi:10.35377/saucis. 1865546.
Vancouver
1.Kerem Can Çelepkolu, Yasin Ortakcı, Kürşat Mustafa Karaoğlan. A Semantic and Lexical Analysis of LLM-Generated Responses in Comparison with Stack Overflow Answers. SAUCIS. 2026 Oct. 1;(Advanced Online Publication):1485-93. doi:10.35377/saucis. 1865546

 

INDEXING & ABSTRACTING & ARCHIVING

 

31045 31044   Anadolu Türk Eğitim Dergisi  31047 

31043 28939 28938 34240
 

 

29070    The papers in this journal are licensed under a Creative Commons Attribution-NonCommercial 4.0 International License