Table of Contents
Fetching ...

In-Context Adaptation to Concept Drift for Learned Database Operations

Jiaqi Zhu, Shaofeng Cai, Yanyan Shen, Gang Chen, Fang Deng, Beng Chin Ooi

TL;DR

Concept drift in dynamic databases degrades learned operations, hindering practical deployment. FLAIR introduces an in-context adaptation framework with two modules, a Task Featurization Module and a Dynamic Decision Engine, pre-trained through Bayesian meta-training to adapt predictions using a dynamic context memory without runtime parameter updates. The approach provides theoretical generalization guarantees tied to context memory size and demonstrates strong empirical performance across cardinality estimation, AQP, and in-database analytics, including a practical PostgreSQL integration that yields up to 1.9× faster query latency. This work offers a scalable, privacy-friendly, and transfer-friendly solution for maintaining accuracy in continuously changing database environments.

Abstract

Machine learning has demonstrated transformative potential for database operations, such as query optimization and in-database data analytics. However, dynamic database environments, characterized by frequent updates and evolving data distributions, introduce concept drift, which leads to performance degradation for learned models and limits their practical applicability. Addressing this challenge requires efficient frameworks capable of adapting to shifting concepts while minimizing the overhead of retraining or fine-tuning. In this paper, we propose FLAIR, an online adaptation framework that introduces a new paradigm called \textit{in-context adaptation} for learned database operations. FLAIR leverages the inherent property of data systems, i.e., immediate availability of execution results for predictions, to enable dynamic context construction. By formalizing adaptation as $f:(\mathbf{x} \,| \,C_t) \to \mathbf{y}$, with $C_t$ representing a dynamic context memory, FLAIR delivers predictions aligned with the current concept, eliminating the need for runtime parameter optimization. To achieve this, FLAIR integrates two key modules: a Task Featurization Module for encoding task-specific features into standardized representations, and a Dynamic Decision Engine, pre-trained via Bayesian meta-training, to adapt seamlessly using contextual information at runtime. Extensive experiments across key database tasks demonstrate that FLAIR outperforms state-of-the-art baselines, achieving up to 5.2x faster adaptation and reducing error by 22.5% for cardinality estimation.

In-Context Adaptation to Concept Drift for Learned Database Operations

TL;DR

Concept drift in dynamic databases degrades learned operations, hindering practical deployment. FLAIR introduces an in-context adaptation framework with two modules, a Task Featurization Module and a Dynamic Decision Engine, pre-trained through Bayesian meta-training to adapt predictions using a dynamic context memory without runtime parameter updates. The approach provides theoretical generalization guarantees tied to context memory size and demonstrates strong empirical performance across cardinality estimation, AQP, and in-database analytics, including a practical PostgreSQL integration that yields up to 1.9× faster query latency. This work offers a scalable, privacy-friendly, and transfer-friendly solution for maintaining accuracy in continuously changing database environments.

Abstract

Machine learning has demonstrated transformative potential for database operations, such as query optimization and in-database data analytics. However, dynamic database environments, characterized by frequent updates and evolving data distributions, introduce concept drift, which leads to performance degradation for learned models and limits their practical applicability. Addressing this challenge requires efficient frameworks capable of adapting to shifting concepts while minimizing the overhead of retraining or fine-tuning. In this paper, we propose FLAIR, an online adaptation framework that introduces a new paradigm called \textit{in-context adaptation} for learned database operations. FLAIR leverages the inherent property of data systems, i.e., immediate availability of execution results for predictions, to enable dynamic context construction. By formalizing adaptation as , with representing a dynamic context memory, FLAIR delivers predictions aligned with the current concept, eliminating the need for runtime parameter optimization. To achieve this, FLAIR integrates two key modules: a Task Featurization Module for encoding task-specific features into standardized representations, and a Dynamic Decision Engine, pre-trained via Bayesian meta-training, to adapt seamlessly using contextual information at runtime. Extensive experiments across key database tasks demonstrate that FLAIR outperforms state-of-the-art baselines, achieving up to 5.2x faster adaptation and reducing error by 22.5% for cardinality estimation.
Paper Structure (23 sections, 2 theorems, 11 equations, 11 figures, 3 tables, 2 algorithms)

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

Key Result

Theorem 3.1

Consider a model $\hat{f}_i$ trained on an initial dataset $D^i$, where $|D^i|=i$. After $k$ data operations, including $s$ insertion and $r$ deletion, we obtain a new dataset $D^j$ of size $|D^j|=j$, where $k=s+r>1$ and the net difference in data size $|j-i|=|s-r|$. Suppose data in $D^j$ are i.i.d

Figures (11)

  • Figure 1: FLAIR in a nutshell. (a) An example of concept drifts in a dynamic database setting. (b) Adaptation paradigm for handling concept drifts in FLAIR and two conventional approaches. (c) Key features and applications of FLAIR. (d) A preview comparison of FLAIR against PostgreSQL and state-of-the-art approaches for handling dynamic databases.
  • Figure 2: FLAIR for dynamic data systems.
  • Figure 3: The architecture of FLAIR.
  • Figure 4: Overview of dynamic settings, illustrated by distribution discrepancies confirmed by Kolmogorov-Smirnov test p-values below 0.01 pre- and post-concept drift.
  • Figure 5: Comparison of model efficiency.
  • ...and 6 more figures

Theorems & Definitions (3)

  • Definition 2.1: Concept Drift in Databases
  • Theorem 3.1
  • Theorem 3.2