Table of Contents
Fetching ...

SlsReuse: LLM-Powered Serverless Function Reuse

Jinfeng Wen, Yuehan Sun

TL;DR

SlsReuse tackles the lack of reusable serverless functions by leveraging LLM-generated semantic representations to align natural language task descriptions with heterogeneous function implementations. It constructs a high-quality function repository, derives unified semantic attributes through few-shot prompting, and performs intent-aware discovery with multi-level Pareto-based pruning and similarity ranking. Evaluations on 110 task queries show substantial improvements in Recall and MRR over traditional baselines, along with notable latency reductions and robustness to non-deterministic LLM behavior. The framework generalizes across multiple LLM backends, indicating practical potential for accelerating serverless development and function reuse in real-world settings.

Abstract

Serverless computing has rapidly emerged as a popular cloud computing paradigm. It enables developers to implement function-level tasks, i.e., serverless functions, without managing infrastructure. While reducing operational overhead, it poses challenges, especially for novice developers. Developing functions from scratch requires adapting to heterogeneous, platform-specific programming styles, making the process time-consuming and error-prone. Function reuse offers a promising solution to address these challenges. However, research on serverless computing lacks a dedicated approach for function recommendation. Existing techniques from traditional contexts remain insufficient due to the semantic gap between task descriptions and heterogeneous function implementations. Advances in large language models (LLMs), pre-trained on large-scale corpora, create opportunities to bridge this gap by aligning developer requirements with function semantics. This paper presents SlsReuse, the first LLM-powered framework for serverless function reuse. Specifically, SlsReuse first constructs a reusable function repository serving as a foundational knowledge base. Then, it learns unified semantic-enhanced representations of heterogeneous functions through effective prompt engineering with few-shot prompting, capturing implicit code intent, target platforms, programming languages, and cloud services. Finally, given a natural language task query, SlsReuse performs intent-aware discovery combined with a multi-level pruning strategy and similarity matching. We evaluate SlsReuse on a curated dataset of 110 task queries. Built on ChatGPT-4o, one of the most representative LLMs, SlsReuse achieves Recall@10 of 91.20%, exceeding the state-of-the-art baseline by 24.53 percentage points.

SlsReuse: LLM-Powered Serverless Function Reuse

TL;DR

SlsReuse tackles the lack of reusable serverless functions by leveraging LLM-generated semantic representations to align natural language task descriptions with heterogeneous function implementations. It constructs a high-quality function repository, derives unified semantic attributes through few-shot prompting, and performs intent-aware discovery with multi-level Pareto-based pruning and similarity ranking. Evaluations on 110 task queries show substantial improvements in Recall and MRR over traditional baselines, along with notable latency reductions and robustness to non-deterministic LLM behavior. The framework generalizes across multiple LLM backends, indicating practical potential for accelerating serverless development and function reuse in real-world settings.

Abstract

Serverless computing has rapidly emerged as a popular cloud computing paradigm. It enables developers to implement function-level tasks, i.e., serverless functions, without managing infrastructure. While reducing operational overhead, it poses challenges, especially for novice developers. Developing functions from scratch requires adapting to heterogeneous, platform-specific programming styles, making the process time-consuming and error-prone. Function reuse offers a promising solution to address these challenges. However, research on serverless computing lacks a dedicated approach for function recommendation. Existing techniques from traditional contexts remain insufficient due to the semantic gap between task descriptions and heterogeneous function implementations. Advances in large language models (LLMs), pre-trained on large-scale corpora, create opportunities to bridge this gap by aligning developer requirements with function semantics. This paper presents SlsReuse, the first LLM-powered framework for serverless function reuse. Specifically, SlsReuse first constructs a reusable function repository serving as a foundational knowledge base. Then, it learns unified semantic-enhanced representations of heterogeneous functions through effective prompt engineering with few-shot prompting, capturing implicit code intent, target platforms, programming languages, and cloud services. Finally, given a natural language task query, SlsReuse performs intent-aware discovery combined with a multi-level pruning strategy and similarity matching. We evaluate SlsReuse on a curated dataset of 110 task queries. Built on ChatGPT-4o, one of the most representative LLMs, SlsReuse achieves Recall@10 of 91.20%, exceeding the state-of-the-art baseline by 24.53 percentage points.

Paper Structure

This paper contains 22 sections, 5 figures, 3 tables, 1 algorithm.

Figures (5)

  • Figure 1: The development process and an example of a serverless function.
  • Figure 2: The overview of SlsReuse.
  • Figure 3: The prompt of structured knowledge extraction used in SlsReuse.
  • Figure 4: (RQ2) Recall@k and MRR@k results of SlsReuse and the customized LLM-based variant.
  • Figure 5: (RQ2) Recommendation latency comparisons between SlsReuse and three baselines.