Slide 1

Slide 1 text

AI-Enabled Apps Practical Uses of AI in Applications Jennifer Reif jennifer.reif@neo4j.com @JMHReif github.com/JMHReif jmhreif.com linkedin.com/in/jmhreif

Slide 2

Slide 2 text

Who is Jennifer Reif? • Continuous learner • Conference speaker • Tech blogger • Other: geek Developer Advocate, Neo4j Jennifer Reif jennifer.reif@neo4j.com @JMHReif github.com/JMHReif jmhreif.com linkedin.com/in/jmhreif

Slide 3

Slide 3 text

Artificial intelligence capable of generating text, images, or other data using generative models, often in response to prompts. Generative AI models learn the patterns and structure of their input training data and then generate new data that has similar characteristics. Generative Arti fi cial Intelligence https://en.wikipedia.org/wiki/Generative_arti fi cial_intelligence

Slide 4

Slide 4 text

LLMs What they’re good at… • General information • Public domain knowledge • Historical data • Creative / arts • Human assistant • Task delegation

Slide 5

Slide 5 text

LLMs What they’re not so good at… • Lacking most recent data • Not always natural language • Language complexities, sarcasm, emotion • No sources • Hallucinations / Temperature • IP, bias, privacy

Slide 6

Slide 6 text

Improving LLM accuracy

Slide 7

Slide 7 text

Approaches • Custom model • Fine-tuning / Few-shot learning • Retrieval Augmented Generation (RAG)

Slide 8

Slide 8 text

RAG Retrieval Augmented Generation • Retrieval • Data retrieved from database • Augmented • Augments response with facts • Generation • Response in natural language Prompt + Relevant Information LLM API LLM
 Chat API User Database Search Prompt Response Relevant Results / Documents 2 3 1 Database

Slide 9

Slide 9 text

Agentic Workflow Architecture • Uses “agents”/tools • LLM determines next step • Which tool/external source should be called • Uses result from tool as context Prompt + Relevant Information LLM API LLM
 Chat API User Tool Prompt Response Relevant Results / Documents 2 3 1 Source info

Slide 10

Slide 10 text

Explainable AI • How did the LLM get this answer? • Grounding LLM answer with veri fi ed data With RAG + LLM

Slide 11

Slide 11 text

Other benefits With non-LLM data • Information that LLM doesn’t have • More recent than LLM cuto ff • Private data • Ensure accurate, non-con fl icting data • Reduce hallucinations

Slide 12

Slide 12 text

RAG needs curated data…

Slide 13

Slide 13 text

Private data set examples Probably data that already exists • Lessons learned • Project docs • Knowledge base / support docs • Onboarding / internal processes • Performance reviews / internal surveys • Job applicants / resumés • Internal trainings, videos, other content

Slide 14

Slide 14 text

Vectors and Data Sources

Slide 15

Slide 15 text

How do we use vectors? https://www.mathsisfun.com/algebra/vectors.html

Slide 16

Slide 16 text

Example Kings and Queens king − man + woman ≈ queen king man wom an 1 king man wom an 2 queen? 3

Slide 17

Slide 17 text

Benefits Of using vectors • Embed nearly any type of data • Image, document, product, text, video, audio, sentence, word • Can be used to feed all sorts of architectures • Non-keyword search • Variety of criteria for search

Slide 18

Slide 18 text

Similarity search • Expensive queries (compare to every vector) • Approximate nearest neighbor (k-ANN) • Example: Library • Book classi fi cation - author vs location of plot • Smaller search set = smaller retrieval time! Vector indexes Photo by Martin Adams on Unsplash

Slide 19

Slide 19 text

Real-World Uses

Slide 20

Slide 20 text

Chatbot GDS Documentation • LLM hallucinating answers • Provide LLM with updated info • Assist users with learning GDS library • Backed by knowledge graph of documentation text • Streamlit + LangChain app • Log conversations with data • Improvements to responses!

Slide 21

Slide 21 text

Benefits • Log conversations alongside grounding data • How LLM/users interact with documents • Monitor performance and improve • Analyze data: Algorithms + Visualization • Surface data quality issues in text • Chunk outliers or overlaps • Collapse duplicates

Slide 22

Slide 22 text

Logging and Visualizing Conversations With a graph database Graph of an actual conversation between an Agent Neo user and the ChatGPT-4 LLM. Context Documents are labeled with their GDS Community.

Slide 23

Slide 23 text

Semantic Search Movie search • Search movie based on di ff erent criteria • General theme or setting or plot? • Net fl ix search doesn’t work like this • Includes agentic approach (UI, trailers, etc) github.com/datastax/movies_plus_plus

Slide 24

Slide 24 text

Benefits • Gather multiple data sources into one interface • Search on variety of criteria • Augment traditional search and LLM • Log interactions, likes, paths

Slide 25

Slide 25 text

Recommendations Product (e.g. Book) • Search based on smaller criteria • Follow user journey for what to try next • Cross-sell • Use similarity from “unrelated” criteria Photo by Carl Raw on Unsplash

Slide 26

Slide 26 text

Benefits • Combine di ff erent data sources • User preferences/lifestyles, order system, supply chain, etc • Cross-pollinate product categories • Customer 360, real-time markets, trends

Slide 27

Slide 27 text

Other use cases • Fraud/Anomaly detection • Monitoring/Logging activities • Bugs and fi xes • Dependencies • Impact • Supply chain • Operations

Slide 28

Slide 28 text

Nothing is a silver bullet • Can’t guarantee a consistent answer • Prompt engineering • Context window limits LLM is (of sorts) mind of its own

Slide 29

Slide 29 text

Let’s code! Vector search Data results Prompt phrase+data

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

Resources • Code: github.com/JMHReif/springai-goodreads • GraphAcademy courses: graphacademy.neo4j.com/categories/llms/ • NODES 2024: dev.neo4j.com/nodes24 Jennifer Reif jennifer.reif@neo4j.com @JMHReif github.com/JMHReif jmhreif.com linkedin.com/in/jmhreif