Table of Contents
Fetching ...

Contextual Augmented Multi-Model Programming (CAMP): A Hybrid Local-Cloud Copilot Framework

Yuchen Wang, Shangxin Guo, Chee Wei Tan

TL;DR

This work addresses the challenge of delivering powerful AI-assisted programming within constrained local IDEs by introducing CAMP, a context-based Retrieval-Augmented Generation framework that couples a local context retriever, a content retriever with Dynamic Code Symbol Indexing, and a prompt constructor to optimize cloud LLM prompts. The method formalizes $p_{RAG}$ as a combination of context $c$, retrieved content $z$, and prompt tokens $y_i$, and optimizes the sub-models and prompt ranking to maximize context-aware code generation. Implemented as Copilot for Xcode, CAMP demonstrates significant objective gains (e.g., $12.5\%$ vs CloudOnly and $6.3\%$ vs BaseRAG on Pass@1 for project-runnable tasks) and favorable user-study outcomes, including a $37.2\%$ reduction in completion time and $45\%$ adoption of suggestions, while highlighting practical challenges such as cold-start behavior. The work demonstrates a viable path toward tightly integrated, context-aware AI-assisted programming in local IDEs and opens avenues for extending context-based RAG to software testing and other developer tooling."

Abstract

The advancements in cloud-based Large Languages Models (LLMs) have revolutionized AI-assisted programming. However, their integration into certain local development environments like ones within the Apple software ecosystem (e.g., iOS apps, macOS) remains challenging due to computational demands and sandboxed constraints. This paper presents CAMP, a multi-model AI-assisted programming framework that consists of a local model that employs Retrieval-Augmented Generation (RAG) to retrieve contextual information from the codebase to facilitate context-aware prompt construction thus optimizing the performance of the cloud model, empowering LLMs' capabilities in local Integrated Development Environments (IDEs). The methodology is actualized in Copilot for Xcode, an AI-assisted programming tool crafted for Xcode that employs the RAG module to address software constraints and enables diverse generative programming tasks, including automatic code completion, documentation, error detection, and intelligent user-agent interaction. The results from objective experiments on generated code quality and subjective experiments on user adoption collectively demonstrate the pilot success of the proposed system and mark its significant contributions to the realm of AI-assisted programming.

Contextual Augmented Multi-Model Programming (CAMP): A Hybrid Local-Cloud Copilot Framework

TL;DR

This work addresses the challenge of delivering powerful AI-assisted programming within constrained local IDEs by introducing CAMP, a context-based Retrieval-Augmented Generation framework that couples a local context retriever, a content retriever with Dynamic Code Symbol Indexing, and a prompt constructor to optimize cloud LLM prompts. The method formalizes as a combination of context , retrieved content , and prompt tokens , and optimizes the sub-models and prompt ranking to maximize context-aware code generation. Implemented as Copilot for Xcode, CAMP demonstrates significant objective gains (e.g., vs CloudOnly and vs BaseRAG on Pass@1 for project-runnable tasks) and favorable user-study outcomes, including a reduction in completion time and adoption of suggestions, while highlighting practical challenges such as cold-start behavior. The work demonstrates a viable path toward tightly integrated, context-aware AI-assisted programming in local IDEs and opens avenues for extending context-based RAG to software testing and other developer tooling."

Abstract

The advancements in cloud-based Large Languages Models (LLMs) have revolutionized AI-assisted programming. However, their integration into certain local development environments like ones within the Apple software ecosystem (e.g., iOS apps, macOS) remains challenging due to computational demands and sandboxed constraints. This paper presents CAMP, a multi-model AI-assisted programming framework that consists of a local model that employs Retrieval-Augmented Generation (RAG) to retrieve contextual information from the codebase to facilitate context-aware prompt construction thus optimizing the performance of the cloud model, empowering LLMs' capabilities in local Integrated Development Environments (IDEs). The methodology is actualized in Copilot for Xcode, an AI-assisted programming tool crafted for Xcode that employs the RAG module to address software constraints and enables diverse generative programming tasks, including automatic code completion, documentation, error detection, and intelligent user-agent interaction. The results from objective experiments on generated code quality and subjective experiments on user adoption collectively demonstrate the pilot success of the proposed system and mark its significant contributions to the realm of AI-assisted programming.

Paper Structure

This paper contains 21 sections, 2 theorems, 11 equations, 3 figures, 2 tables, 2 algorithms.

Key Result

Theorem 1

Starting from any initial weight ($\eta'$) and heuristic ($H$) parameters of the retrievers, the optimal solution can be obtained iteratively by Algorithm alg1.

Figures (3)

  • Figure 1: An overview of C a m p , the AI-assisted programming solution that empowers cloud LLM with local code context information retrieved by context-based RAG.
  • Figure 2: Overview of the RAG module. (a) Context retriever $\mathcal{R}_{\eta'}$ that retrieves contextual information from the local development environment. (b) Content retriever $\mathcal{R}_\eta$ that searches for the most relevant information from local content. (c) Prompt constructor $\mathcal{G}_\theta$ that creates context-aware prompts.
  • Figure 3: Sequence Diagram of C a m p on Copilot for Xcode which enables real-time code generation and suggestions.

Theorems & Definitions (2)

  • Theorem 1
  • Theorem 2