Slide 1

Slide 1 text

Generative AI in practice: Concrete LLM use cases in Java with the PaLM API Guillaume Laforge Developer Advocate @[email protected]

Slide 2

Slide 2 text

Google Cloud Proprietary & Confidential 01 A few notions and vocabulary 2 @[email protected]

Slide 3

Slide 3 text

Google Cloud Artificial Intelligence NLP 3 Artificial Intelligence, Machine Learning, Data Science, Deep Learning… Data Science Machine Learning — unsupervised, supervised, reinforcement learning Deep Learning — ANN, CNN, RNN… Generative AI — GAN, VAE, Transformers… LLMs — Transformers Image Gen — GAN, VAE

Slide 4

Slide 4 text

Google Cloud 4 Google invented the Transformer architecture Responsible AI at the foundation Google invents Transformer kickstarting LLM revolution Google’s groundbreaking large language model, BERT AlphaFold predicts 3D models of protein structures Text-to-Text Transfer Transformer LLM 10B P model open sourced Google LaMDA model trained to converse Google PaLM single model to generalize across domains Google PaLM 2 model is the SOTA LLM PaLM 2

Slide 5

Slide 5 text

Google Cloud 5 So what are Large Language Models? ● Transformer-based neural network architecture that can recognize, predict, and generate human language ● Trained on huge corpuses of text, in various languages and domains ○ Ex: PaLM 2 learned 340 billion parameters, and trained over 3.6 trillions of tokens ● Learn the statistical relationships between words and phrases, as well as the patterns of human language ● Can be fine-tuned for specific tasks or domain knowledge

Slide 6

Slide 6 text

Google Cloud 6 Language model sizes — March 2023 https://lifearchitect.ai/models/

Slide 7

Slide 7 text

On the Dangers of Stochastic Parrots: Can Language Models Be Too Big?

Slide 8

Slide 8 text

Google Cloud 8 With larger models emerge new capabilities https://blog.research.google/2022/04/pathways-language-model-palm-scaling-to.html

Slide 9

Slide 9 text

Google Cloud Proprietary & Confidential 9 02 Google’s own LLMs and recent announcements at Cloud Next @[email protected]

Slide 10

Slide 10 text

Google Cloud Bard 10 PaLM, Codey, Imagen, MakerSuite, Vertex AI Vertex AI MakerSuite Model Garden Codey Imagen … Conversation Vertex AI Search Vector Search Notebooks Pipelines AutoML PaLM 2 …

Slide 11

Slide 11 text

Google Cloud 11 Cloud Next ‘23 announcements ● 100+ models in Model Garden — Llama 2, Code Llama, Falcon, Claude 2 ● 32k token context for PaLM — 38 lang, higher quality, faster, cheaper for 8k ● Codey more performant ● Higher image quality for Imagen ○ SynthID: digital watermarking functionality ● Vertex AI extensions and Vertex AI data connectors ● GA for Vertex AI Enterprise Search and Conversation

Slide 12

Slide 12 text

Google Cloud Proprietary & Confidential 12 03 Time to have a look at some demos! @[email protected]

Slide 13

Slide 13 text

Google Cloud 13 Let’s play with Bard and MakerSuite! Bard PaLM MakerSuite

Slide 14

Slide 14 text

Google Cloud 14 Python is all the rage in AI… What’s in it for us, Java developers?

Slide 15

Slide 15 text

Google Cloud 15 Generating bedtime stories for kids https://bed-time-stories.web.app/

Slide 16

Slide 16 text

Google Cloud 16 Vertex AI Java API

Slide 17

Slide 17 text

Google Cloud 17 LangChain4J

Slide 18

Slide 18 text

Google Cloud 18 Searching the Apache Groovy documentation Apply the RAG pattern: Retrieval Augmented Generation

Slide 19

Slide 19 text

PaLM 2 chunks DOCS Vector DB embedding vectors split calculate prompt embedding vector calculate find similar answer context + prompt + chunks store vector + chunk

Slide 20

Slide 20 text

Google Cloud Proprietary & Confidential 20 04 Summary @[email protected]

Slide 21

Slide 21 text

Google Cloud 21 Summary ● PaLM 2 is a powerful LLM that allows you to build all sorts of generative AI ideas and projects ● However, using the PaLM API from Java is not necessarily ideal yet ● Fortunately, REST marshalling is pretty easy nowadays in Java ● Easy to deploy & serve containerized apps on Cloud Run ● And LangChain4J is pretty sweet!

Slide 22

Slide 22 text

Google Cloud 22 What to build next? ● Chat Q&A with the Apache Groovy documentation ○ improve the quality of responses ● News curation that collects & summarize my social feeds What about you, what would you build?

Slide 23

Slide 23 text

Thanks! Guillaume Laforge Developer Advocate @[email protected]