CodeSCM: Causal Analysis for Multi-Modal Code Generation

Mukur Gupta, Noopur Bhatt, Suman Jana
2/7/2025
cs.CL

No official code found. Best implementation: nb15/codeSCM-naacl25 (1 star, last commit 2025-02-05).

Abstract

In this paper, we propose CodeSCM, a Structural Causal Model (SCM) for analyzing multi-modal code generation using large language models (LLMs). By applying interventions to CodeSCM, we measure the causal effects of different prompt modalities, such as natural language, code, and input-output examples, on the model. CodeSCM introduces latent mediator variables to separate the code and natural language semantics of a multi-modal code generation prompt. Using the principles of Causal Mediation Analysis on these mediators we quantify direct effects representing the model's spurious leanings. We find that, in addition to natural language instructions, input-output examples significantly influence code generation.

View on arXivView PDF

Code Implementations(1)

11Shell, PythonFeb 5, 20251 years ago

Cite this paper

@article{gupta2025codescm,
  title  = {CodeSCM: Causal Analysis for Multi-Modal Code Generation},
  author = {Mukur Gupta and Noopur Bhatt and Suman Jana},
  year   = {2025},
  eprint = {2502.05150},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2502.05150v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2502.05150.svg)](https://codeofpaper.com/paper/2502.05150)

Discussion