FaithfulPersona: Balancing Faithfulness and Personalization in Code Explanations through Self-Critique

Zhuang Luo, Yichuan Li, Zexing Xu, Kyumin Lee, S. Rasoul Etesami


Abstract
Code explanations are crucial in real-world life, from educating students to aligning technical projects with business goals. However, existing approaches face challenges balancing faithfulness to the original code and personalization for diverse user needs. This paper addresses these challenges by introducing a novel benchmark and method for generating faithful personalized code explanations. Our benchmark, FaithfulPersonaCodeX, incorporates code samples and user profiles, employing various evaluation metrics to evaluate both faithfulness and personalization. We propose DISCO, a new method that uses a self-critique mechanism and two-stage optimization to balance faithfulness and personalization in code explanations, addressing the limitations of current large language model approaches. Our proposed model, DISCO, achieves a notable 3.7% improvement in Pass@5 compared to the strong baseline method, Self-Consistency, while maintaining high personalization with a 61.08% win rate in the LLM-as-a-Judge evaluation, effectively balancing faithfulness and user-specific needs in code explanations.
Anthology ID:
2025.findings-naacl.53
Volume:
Findings of the Association for Computational Linguistics: NAACL 2025
Month:
April
Year:
2025
Address:
Albuquerque, New Mexico
Editors:
Luis Chiruzzo, Alan Ritter, Lu Wang
Venue:
Findings
SIG:
Publisher:
Association for Computational Linguistics
Note:
Pages:
930–944
Language:
URL:
https://preview.aclanthology.org/landing_page/2025.findings-naacl.53/
DOI:
Bibkey:
Cite (ACL):
Zhuang Luo, Yichuan Li, Zexing Xu, Kyumin Lee, and S. Rasoul Etesami. 2025. FaithfulPersona: Balancing Faithfulness and Personalization in Code Explanations through Self-Critique. In Findings of the Association for Computational Linguistics: NAACL 2025, pages 930–944, Albuquerque, New Mexico. Association for Computational Linguistics.
Cite (Informal):
FaithfulPersona: Balancing Faithfulness and Personalization in Code Explanations through Self-Critique (Luo et al., Findings 2025)
Copy Citation:
PDF:
https://preview.aclanthology.org/landing_page/2025.findings-naacl.53.pdf