NAACL 2025findings0 citations

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.

BibTeX
@inproceedings{luo-etal-2025-faithfulpersona,
    title = "{F}aithful{P}ersona: Balancing Faithfulness and Personalization in Code Explanations through Self-Critique",
    author = "Luo, Zhuang  and
      Li, Yichuan  and
      Xu, Zexing  and
      Lee, Kyumin  and
      Etesami, S. Rasoul",
    editor = "Chiruzzo, Luis  and
      Ritter, Alan  and
      Wang, Lu",
    booktitle = "Findings of the Association for Computational Linguistics: NAACL 2025",
    month = apr,
    year = "2025",
    address = "Albuquerque, New Mexico",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2025.findings-naacl.53/",
    pages = "930--944",
    ISBN = "979-8-89176-195-7"
}
FaithfulPersona: Balancing Faithfulness and Personalization in Code Explanations through Self-Critique · NAACL 2025