Slide 1

Slide 1 text

Raphael De Lio REDISCOVERING APOLLO 11 Using Java, Redis, and Vector Search

Slide 2

Slide 2 text

CONTEXT

Slide 3

Slide 3 text

OUR MISSION

Slide 4

Slide 4 text

OBJECTIVE "That's one small step for man, one giant leap for Mankind." "That's one small step for a human, one big jump for humanity.” AND FIND SEARCH FOR

Slide 5

Slide 5 text

VECTOR SIMILARITY SEARCH

Slide 6

Slide 6 text

Which one is the most similar to Earth?

Slide 7

Slide 7 text

0 -500 500 298 152 50 45 12

Slide 8

Slide 8 text

-500 Jupiter (-110, 500) 0 -500 500 500 Temp Mass Displaying only Mercury, Venus, Jupiter, Saturn and Uranus for simpli fi cation. Mass normalized from -500 to 500 Mercury (167, -500) Venus (465, -497) Saturn (-178, -200) Uranus (-195, -454)

Slide 9

Slide 9 text

-500 Jupiter (-110, 500) 0 -500 500 500 Temp Mass Displaying only Mercury, Venus, Jupiter, Saturn and Uranus for simpli fi cation. Comparing how similar Saturn is to other planets in terms of mass and temperature. The shortest, the closest. Mercury (167, -500) Venus (465, -497) Saturn (-178, -200) Uranus (-195, -454) d(S, U) = 254 d(S, J) = 703 d(S, M) = 457 d(S, V) = 708

Slide 10

Slide 10 text

-500 Jupiter (-110, 500) 0 -500 500 500 Temp Mass Displaying only Mercury, Venus, Jupiter, Saturn and Uranus for simpli fi cation. Comparing how similar Saturn is to other planets in terms of mass and temperature. The lowest, the closest. Mercury (167, 500) Venus (465, -497) Saturn (-178, -200) Uranus (-195, -454) ∠(S, U) = 18°

Slide 11

Slide 11 text

-500 Jupiter (-110, 500) 0 -500 500 500 Temp Mass Displaying only Mercury, Venus, Jupiter, Saturn and Uranus for simpli fi cation. Comparing how similar Saturn is to other planets in terms of mass and temperature. The lowest, the closest. Mercury (167, -500) Venus (465, -497) Saturn (-178, -200) Uranus (-195, -454) ∠(S, M) = 60°

Slide 12

Slide 12 text

-500 Jupiter (-110, 500) 0 -500 500 500 Temp Mass Displaying only Mercury, Venus, Jupiter, Saturn and Uranus for simpli fi cation. Comparing how similar Saturn is to other planets in terms of mass and temperature. The lowest, the closest. Mercury (167, -500) Venus (465, -497) Saturn (-178, -200) Uranus (-195, -454) ∠(S, M) = 84°

Slide 13

Slide 13 text

-500 Jupiter (-110, 500) 0 -500 500 500 Temp Mass Displaying only Mercury, Venus, Jupiter, Saturn and Uranus for simpli fi cation. Comparing how similar Saturn is to other planets in terms of mass and temperature. The lowest, the closest. Mercury (167, -500) Venus (465, -497) Saturn (-178, -200) Uranus (-195, -454) ∠(S, M) = 84°

Slide 14

Slide 14 text

- A vector is a numerical representation of data - Vectors that are closer together in a vector space model are more similar to each other - Their proximity is calculated using euclidean distance or cosine similarity

Slide 15

Slide 15 text

WHERE DOES AI FIT?

Slide 16

Slide 16 text

[15, -497] [-178, -200]

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

[0.54, 0.86, 0.23, 0.75, 0.92, 0.64, 0.47, 0.33, 0.89, 0.99, 0.67, 0.49, 0.94, 0.36, 0.71, 0.82, 0.29, 0.57, 0.630.98, 0.64, 0.47, 0.33, 0.48, 0.95, 0.67, 0.81, 0.23, 0.21, 0.67, 0.49, 0.56, 0.57, 0.63, 0.89, 0.21, 0.67, 0.49, 0.94, 0.36, 0.71, 0.82, 0.29]

Slide 19

Slide 19 text

Where to store our vectors? VECTOR SIMILARITY SEARCH

Slide 20

Slide 20 text

How does it work? VECTOR SIMILARITY SEARCH "That's one small step for man, one giant leap for Mankind." "That's one small step for a human, one big jump for humanity.” [0.56, 0.76, 0.80, 0.54, 0.99, -0.87 … ] [0.58, 0.75, 0.75, 0.63, 0.9, -0.7 … ]

Slide 21

Slide 21 text

- Embedding models are algorithms that transform unstructured data into meaningful numerical data - Vector databases are used for e ff i ciently storing and retrieving these vectors based on their proximity in the vector space model - Redis is freaking awesome

Slide 22

Slide 22 text

BUILDING OUR ROCKET

Slide 23

Slide 23 text

How to interact with Redis? VECTOR SIMILARITY SEARCH Saturn V Stage 1: JVM Stage 2: Spring Boot Stage 3: Spring Data & Jedis Command Module & Service: Redis OM Spring Lunar Module: Spring AI Escape System: Kotlin

Slide 24

Slide 24 text

The Command Module VECTOR SIMILARITY SEARCH How to interact with Redis? JSON System Vector System Query Engines Probabilistic Data Structures Support Perform ance Boosters DS Enhancers Redis OM Spring

Slide 25

Slide 25 text

Mission Control VECTOR SIMILARITY SEARCH How to interact with Redis?

Slide 26

Slide 26 text

Mission Control VECTOR SIMILARITY SEARCH How to interact with Redis? What about Space X?

Slide 27

Slide 27 text

• Collect our data • Load our data into Redis • Query our data ROCKET’S OBJECTIVE

Slide 28

Slide 28 text

COLLECTING THE DATA

Slide 29

Slide 29 text

LOADING THE DATA Annotation for de fi ning a HASH object Annotation for allowing e ffi cient querying based on that fi eld’s value in Redis. Creating the repository

Slide 30

Slide 30 text

VECTORIZING THE DATA Data to be vectorized Field where the vectorize data will be stored in

Slide 31

Slide 31 text

VECTORIZING THE DATA Di ff erent embedding model Number of dimensions must match the number of dimensions of the model

Slide 32

Slide 32 text

VECTORIZING THE DATA

Slide 33

Slide 33 text

UNDER THE HOOD Spinning up the models Spinning up Transformers Embedding Model

Slide 34

Slide 34 text

UNDER THE HOOD Spinning up OpenAI Embedding Model

Slide 35

Slide 35 text

QUERY THE DATA Vectorizing the query Searching for the 3 nearest neighbors This is going to generate the command to search and sort on Redis. This is done e ff i ciently by the Redis Query Engine

Slide 36

Slide 36 text

LIFT OFF

Slide 37

Slide 37 text

HOUSTON, WE HAVE A PROBLEM

Slide 38

Slide 38 text

• Short text: “Apollo” → Doesn’t tell if it’s about a Greek god, a space mission, or a music album. • Long text: A full transcript of a mission → May contain too much irrelevant information for a speci fi c query. GRANULARITY PROBLEM

Slide 39

Slide 39 text

TABLE OF CONTENTS

Slide 40

Slide 40 text

SUMMARIZATION

Slide 41

Slide 41 text

EXTRACTION

Slide 42

Slide 42 text

QUERYING Searching on the questions instead of texts

Slide 43

Slide 43 text

TRANSLUNAR INJECTION

Slide 44

Slide 44 text

• Feed the LLM with the related u tt erances • Ask it to answer our question based only on the information we provide RETRIEVAL AUGMENTED GENERATION

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

LUNAR LANDING

Slide 48

Slide 48 text

Store previously researched terms improve: • Speed • Cost SEMANTIC CACHE

Slide 49

Slide 49 text

EARTH’S ATMOSPHERE REENTRY

Slide 50

Slide 50 text

- How to enhance search capabilities (Vector Similarity Search) - How to improve VS search accuracy (Chunking, Summarization, Extraction) - How to improve LLMs responses (Retrieval Augmented Generation) - How to save speed and time when dealing with LLMs (Semantic Cache) WHAT WE SAW TODAY:

Slide 51

Slide 51 text

RAPHAEL DE LIO DEVELOPER ADVOCATE *