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

FLIGHT PLAN

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.” IS SIMILAR TO

Slide 5

Slide 5 text

VECTOR SIMILARITY SEARCH

Slide 6

Slide 6 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 7

Slide 7 text

How does it work? Temperature Planet Size Temp Vector Mercury 0,33 167 (-1, 0.5) Venus 4,87 464 (-0.6, 1) Earth 5,97 15 (-0.5, 0.2) Mars 0,642 -65 (-0.7, -0.1) Jupiter 1888 -110 (1.0, -0.3) Saturn 568 -140 (0.3, -0.5) Uranus 86.8 -195 (0, -0.9) Neptune 102 -200 (-0.2, -1) VECTOR SIMILARITY SEARCH Size

Slide 8

Slide 8 text

Size Temperature Cosine Similarity VECTOR SIMILARITY SEARCH How do we search? Angle Based

Slide 9

Slide 9 text

Size Temperature VECTOR SIMILARITY SEARCH How do we search? Cosine Similarity Angle Based

Slide 10

Slide 10 text

Size Temperature VECTOR SIMILARITY SEARCH How do we search? Cosine Similarity Angle Based

Slide 11

Slide 11 text

Size Temperature VECTOR SIMILARITY SEARCH How do we search? Cosine Similarity Angle Based

Slide 12

Slide 12 text

Size Temperature Euclidean Distance VECTOR SIMILARITY SEARCH How do we search? Magnitude Based

Slide 13

Slide 13 text

How many dimensions? VECTOR SIMILARITY SEARCH *heads up de como escolher o embedding model

Slide 14

Slide 14 text

Where to store our vectors? VECTOR SIMILARITY SEARCH

Slide 15

Slide 15 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 & DJL Escape System: Kotlin

Slide 16

Slide 16 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 17

Slide 17 text

Mission Control VECTOR SIMILARITY SEARCH How to interact with Redis?

Slide 18

Slide 18 text

TAKING OFF

Slide 19

Slide 19 text

• Collect our data • Load our data into Redis • Query our data

Slide 20

Slide 20 text

COLLECTING THE DATA

Slide 21

Slide 21 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 22

Slide 22 text

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

Slide 23

Slide 23 text

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

Slide 24

Slide 24 text

VECTORIZING THE DATA

Slide 25

Slide 25 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 26

Slide 26 text

DEMO

Slide 27

Slide 27 text

HOUSTON, WE HAVE A PROBLEM

Slide 28

Slide 28 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 *Explicar como isso afeta a utilização de vector search

Slide 29

Slide 29 text

TABLE OF CONTENTS

Slide 30

Slide 30 text

SUMMARIZATION

Slide 31

Slide 31 text

EXTRACTION

Slide 32

Slide 32 text

QUERYING Searching on the questions instead of texts

Slide 33

Slide 33 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 34

Slide 34 text

No content

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

DEMO

Slide 37

Slide 37 text

TAKEAWAYS

Slide 38

Slide 38 text

RAPHAEL DE LIO DEVELOPER ADVOCATE