1 of 19

AI based Simplified Database Management�

Suhas Basavaraj

Lead Consultant

© 2024, Amazon Web Services, Inc. or its affiliates.

© 2024, Amazon Web Services, Inc. or its affiliates.

2 of 19

Agenda

  • Introduction
  • Concepts
  • Use case
  • POC Component
  • Architecture
  • Demo
  • Next steps

© 2024, Amazon Web Services, Inc. or its affiliates.

3 of 19

Introduction

Manually executing database administration tasks , analysing operational issues and optimizing the performance can negatively impact the operational efficiency , reduce the employee productivity

Gen AI solution for the POC is done will address below use cases

      • Provide the guidance for database administration
      • Recommend best practices for the database health check
      • Recommend query tuning best practices

© 2024, Amazon Web Services, Inc. or its affiliates.

4 of 19

Concepts

What is a vector ?

In simple terms, a vector is a list of numbers that can represent a point in space. For example, in 2D space, a vector [2,3] represents a point that’s 2 units along the x-axis and 3 units along the y-axis.

What is Vector embedding ?

Vector embeddings allow us to convert diverse forms of data into a common format (vectors) that LLMs can understand and process. By doing so, we can perform mathematical operations on them.

© 2024, Amazon Web Services, Inc. or its affiliates.

5 of 19

Vector embeddings

Cricket:[−0.7888,−0.7361,−0.6208,−0.5134,−0.4044]

Cricket: [0.8108,0.6671,0.5565,0.5449,0.4466]

Grasshopper: [0.8308,0.6805,0.5598,0.5184,0.3940]

Baseball: [−0.7715,−0.7300,−0.5986,−0.4908,−0.4454]

Graphical representation

Vector in 2D representation

© 2024, Amazon Web Services, Inc. or its affiliates.

6 of 19

PostgreSQL as vector database

  • Pgvector is an extension for PostgreSQL

CREATE EXTENSION IF NOT EXISTS vector;

  • ACID, point-in-time recovery, partitioning, scalability
  • Vector datatype
  • Exact (Default) and approximate nearest neighbour search, L2 distance, inner product, and cosine distance
  • pgvector along with our business data in the same modern database
  • Pgvector also supports indexing-Inverted File (IVFFlat) and Hierarchical Navigable Small Worlds (HNSW)

© 2024, Amazon Web Services, Inc. or its affiliates.

7 of 19

© 2024, Amazon Web Services, Inc. or its affiliates.

8 of 19

Large Language Models

System that uses deep learning techniques to generate human-like text based on patterns learned

Vast datasets are used for pretraining

Self-supervised learning techniques   (e.g., masked language modelling, next sentence prediction)

Example: anthropic.claude-3-sonnet-20240229-v1:0, amazon.titan-embed-text-v1

© 2024, Amazon Web Services, Inc. or its affiliates.

9 of 19

Prompt engineering

Input text or instruction given to a language model to generate a desired output

Context: Context refers to the additional information or background provided to LLM

Optimizations –

  • One-shot Prompting
  • Few-shot Prompting
  • Chain-of-Thought Prompting

© 2024, Amazon Web Services, Inc. or its affiliates.

10 of 19

Retrieval-Augmented Generation (RAG)

  •  Enhancing or supplementing the language model's capabilities by incorporating external knowledge or information
  • Providing this retrieved knowledge to the language model, in addition to the input prompt or context
  • The language model then generates text while considering both the input and the augmented retrieved knowledge.

© 2024, Amazon Web Services, Inc. or its affiliates.

11 of 19

Flow Diagram

© 2024, Amazon Web Services, Inc. or its affiliates.

12 of 19

POC Use Case

Objective Business Value Outcome

Reduce the database management cost by offloading the database administration tasks

Remove the need for users to learn complex database tasks like database tuning and troubleshooting

Improve the operational efficiency by quickly providing the tuning and troubleshooting based on the customer specific data and tested knowledgebase

Database specific guidance for administrative tasks , troubleshooting and query tuning

Higher accuracy and fast response as its generates the output from customer specific data

© 2024, Amazon Web Services, Inc. or its affiliates.

13 of 19

POC -Scope

      • Developed the earlier version of Database Management Assistant which mimic human and provides the guidance for database queries

      • Use RAG , Knowledge base and LLM to build the solution

      • Use the real time data to fetch the metadata from the database

      • Use Langchain for session level contextual information

      • Use this to framework to build, test and improve

© 2024, Amazon Web Services, Inc. or its affiliates.

14 of 19

Tools

  • Python
  • �LLM
  • �Streamlit
  • �Langchain

© 2024, Amazon Web Services, Inc. or its affiliates.

15 of 19

Architecture

© 2024, Amazon Web Services, Inc. or its affiliates.

16 of 19

Steps

      • Database Management Assistant

      • Create the internal RAG knowledge base for user queries
      • Prompt the user for the required information
      • Save the conversational contextual information using the lang chain
      • Query the Foundation model for the context

B. Recommend the implementation best practices and tuning recommendation

      • Create the internal RAG knowledge base based on execution plan and recommendation
      • Prompt the user for query details
      • Use the RAG to build the context and retrieve the information from the knowledge base.
      • Query the Foundation model for the context

© 2024, Amazon Web Services, Inc. or its affiliates.

17 of 19

Demo

Demo and code walkthrough

© 2024, Amazon Web Services, Inc. or its affiliates.

18 of 19

Next steps

  • Troubleshooting and recommendation

  • Provide the commands based on real time customer metadata

  • Knowledge base enrichment for higher accuracy

  • Incorporate the conversational history for context building

  • Leveraging the chain of thoughts

  • Implement the data governance

© 2024, Amazon Web Services, Inc. or its affiliates.

19 of 19

Thank you!

© 2024, Amazon Web Services, Inc. or its affiliates.

© 2024, Amazon Web Services, Inc. or its affiliates.