Skip to main content
QUICK REVIEW

[Paper Review] When to Show a Suggestion? Integrating Human Feedback in AI-Assisted Programming

Hussein Mozannar, Gagan Bansal|arXiv (Cornell University)|Jun 8, 2023
Explainable Artificial Intelligence (XAI)Computer Science3 citations
TL;DR

This paper proposes CDHF, a utility theory-based framework that uses human feedback to intelligently delay or hide AI-generated code suggestions in real time, reducing programmer verification time. By predicting suggestion acceptance and leveraging telemetry from 535 programmers, CDHF hides 25% of suggestions (95% of which would have been rejected) and avoids generating 13% of them, increasing acceptance rate by 7.2% without requiring full suggestion generation.

ABSTRACT

AI powered code-recommendation systems, such as Copilot and CodeWhisperer, provide code suggestions inside a programmer's environment (e.g., an IDE) with the aim of improving productivity. We pursue mechanisms for leveraging signals about programmers' acceptance and rejection of code suggestions to guide recommendations. We harness data drawn from interactions with GitHub Copilot, a system used by millions of programmers, to develop interventions that can save time for programmers. We introduce a utility-theoretic framework to drive decisions about suggestions to display versus withhold. The approach, conditional suggestion display from human feedback (CDHF), relies on a cascade of models that provide the likelihood that recommended code will be accepted. These likelihoods are used to selectively hide suggestions, reducing both latency and programmer verification time. Using data from 535 programmers, we perform a retrospective evaluation of CDHF and show that we can avoid displaying a significant fraction of suggestions that would have been rejected. We further demonstrate the importance of incorporating the programmer's latent unobserved state in decisions about when to display suggestions through an ablation study. Finally, we showcase how using suggestion acceptance as a reward signal for guiding the display of suggestions can lead to suggestions of reduced quality, indicating an unexpected pitfall.

Motivation & Objective

  • To improve AI-assisted programming productivity by determining optimal timing for displaying code suggestions.
  • To reduce programmer verification time and latency by selectively hiding suggestions unlikely to be accepted.
  • To model suggestion utility using real-world telemetry data from GitHub Copilot interactions.
  • To investigate whether suggestion acceptance can serve as a reliable reward signal for suggestion selection.
  • To explore the impact of incorporating the programmer’s latent cognitive state on suggestion prediction accuracy.

Proposed method

  • Develops a utility theory framework to define suggestion utility as a function of acceptance probability and generation latency.
  • Implements a two-stage cascade model: first, a decision to generate a suggestion based on expected utility; second, a prediction of acceptance to decide whether to hide or show it.
  • Uses a predictive model trained on 168k telemetry interactions from 535 programmers to estimate suggestion acceptance probability.
  • Applies a confidence threshold (e.g., 99% probability of rejection) to guarantee that hidden suggestions would have been rejected.
  • Employs suggestion embeddings and prompt context to train a reward model that ranks suggestions by predicted acceptance likelihood.
  • Introduces ablation studies to evaluate the impact of including latent programmer state (beyond telemetry) on prediction performance.

Experimental results

Research questions

  • RQ1Can we define a theoretical utility metric for suggesting code that balances acceptance likelihood and latency?
  • RQ2How effective is a feedback-driven model in reducing the number of displayed suggestions without sacrificing utility?
  • RQ3To what extent does incorporating the programmer’s unobserved cognitive state improve prediction of suggestion acceptance?
  • RQ4What unintended consequences arise when using suggestion acceptance as a reward signal for selection?
  • RQ5Can selective hiding of low-utility suggestions lead to measurable improvements in programmer productivity and acceptance rates?

Key findings

  • CDHF successfully hides 25% of suggestions that were previously shown, with 95% of them being predicted to be rejected with 99% confidence.
  • The framework avoids generating 13% of suggestions by pre-filtering low-utility candidates, reducing latency and cognitive load.
  • A retrospective evaluation shows a hypothesized 7.2% increase in suggestion acceptance rate due to reduced noise and improved selection.
  • Incorporating latent programmer state into the model leads to significantly better prediction performance than using telemetry alone.
  • Optimizing for suggestion acceptance as a reward signal introduces a bias toward shorter suggestions, favoring partial completions over full code segments.
  • The model's AUC for predicting acceptance using embeddings is 0.701, indicating strong predictive power, but also reveals a tendency to favor shorter suggestions in ranking.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.