Categories
Artificial Intelligence What I’m Up To

Retrieval-augmented generation explained “Star Wars” style

By popular demand, here are the “slides” from my presentation this morning at Civo Navigate Local Tampa, Make Smarter AI Apps with RAG!

Retrieval-Augmented Generation, also known as RAG for short, is an AI technique that combines…

  • A machine learning model with
  • A mechnanism for retrieving additional information that the model doesn’t have

…to enhance or improve the responses generated by the model.

At this point, you’re probably thinking this:

This talk runs from 11:15 to 11:30 a.m., which is just before lunch, and I’m not at my cognitive best. Can you explain RAG in an easy-to-digest way, possibly using Star Wars characters?

I’m only too happy to oblige!

Consider the case where you ask an LLM a question that it doesn’t “know” the answer for. The exchange ends up something like this:

Tap to view at full size.

With retrieval-augmented generation, you improve the response by augmenting the prompt you send to the LLM with data or computation from an external source:

Tap to view at full size.

Because RAG provides additional information to the LLM, it solves two key problems:

Tap to view at full size.

Here’s a lower-level view of RAG — it starts with the cleaning and conversion of the supplementary data:

Tap to view at full size.

Once that supplemetary data has been cleaned and converted, the next step is to convert it into small chunks of equal size:

Tap to view at full size.

Those chunks are then converted into vectors. If you’re not really into math but into programming, think of vectors as arrays of numbers. Each of the numbers in the vector is a value between 0.0 and 1.0, and each vector typically has hundreds of elements. In a diagram below, I’ve greatly simplified the vectors so that they’re made up of only three elements:

Tap to view at full size.

The whole process of cleaning/converting, then chunking, then embedding is called indexing:

Tap to view at full size.

Now that you know what’s happening “under the hood,” let revisit the RAG diagram, but with more detail:

Tap to view at full size.

Here’s what’s happening:

  1. Luke asks the question: “Who built you, Threepio?” That’s the query.
  2. The query is converted into vectors.
  3. The “vectorized” query is compared against the vectors that make up the supplementary information — the vectorstore — and the system retrieves a small set of the vectors that are most similar to the query vector.
  4. The query vector and the supplmentary vectors from the vectorstore are combined into a prompt.
  5. The prompt is then sent to the LLM.
  6. The LLM responds to the prompt.

That was the “hand-wavey” part of my lightning talk. The rest of the talk was demonstrating a simple RAG system written in Python and running in a Jupyter Notebook. If you’re really curious and want to see the code, you can download the Jupyter Notebook here.

Categories
Artificial Intelligence Programming What I’m Up To

Video and materials from my “AI: How to Jump in Right Away” presentation for Austin Forum

On Tuesday, April 2nd at 6:15 p.m. Central / 7:15 p.m. Eastern / 23:15 UTC, I led an online introductory session for people who to dive into AI titled AI: How to Jump In Right Away. The recording’s now on YouTube, and you can watch my presentation in its entirety there!

My session was part of Austin Forum on Technology and Society’s third annual AI April, a month of presentations, events, and podcasts dedicated to AI capabilities, applications, future impacts, challenges, and more.

Here are links to the video and supplementary material for the presentation:

Categories
Artificial Intelligence Humor Reading Material

The best damned intro to a book on machine learning ever…

…appears in Vasily “vas3k” Zubarev’s Machine Learning for Everyone, which begins with:

Machine Learning is like sex in high school. Everyone is talking about it, a few know what to do, and only your teacher is doing it.

Categories
Artificial Intelligence Conferences Programming Tampa Bay

I’m speaking at Civo Navigate Local Tampa on April 16th!

At the upcoming Civo Navigate Local Tampa (taking place Tuesday, April 16 at Armature Works), I will be giving a 15-minute lightning talk on RAG — Retrieval-Augmented Generation — and how you can use it to make your AI apps produce better results.

And by “better,” I mean:

  • Able to use data that’s newer than their last update
  • Incorporating information that they wouldn’t otherwise have
  • Using the content of a document that you provide
  • Able to incorporate data from a database

And yes, there will be Python code, which I’ll run live for your viewing pleasure, explain for your understanding, and give to you for your own use!

My presentation will be one of several that you’ll be able to catch at Civo Navigate Local Tampa, and best of all, you can register for the conference for the low, low, low price of…

ten dollars, as opposed to the regular price of $40 (still a deal, but you can spend the $30 you saved on Bake’n Babes cookies or whatever else you prefer from Armature Works’ food stalls).

Just use this discount code…

…and register for Civo Navigate Local Tampa!

Find out more about Civo Navigate Local Tampa 2024 at the official site!


Bonus reading material: Here’s a post about my first hardcore encounter with RAG back in October — Scenes from an AI meetup in San Francisco.

Categories
Artificial Intelligence Presentations Programming

Join my online hands-on AI session with Austin Forum next week!

Next Tuesday, April 2nd at 6:15 p.m. Central / 7:15 p.m. Eastern / 23:15 UTC, I’ll lead an online introductory session for people who to dive into AI titled AI: How to Jump In Right Away.

ℹ️ Click here to register for the presentation.

My session is part of Austin Forum on Technology and Society’s third annual AI April, a month of presentations, events, and podcasts dedicated to AI capabilities, applications, future impacts, challenges, and more.

My presentation will start with a brief history of AI, as well as the general principles of how “old school” AI works versus “new school” AI…

…but we’ll quickly dive into building Sweater or No, a quick little AI application that tells you if you should wear a sweater, based on your current location. Here’s a screenshot of some of the code we’ll build:

This is a FREE online session, so you don’t have to be in Austin to participate. I’m not in Austin, but Tampa Bay, and you can join in from anywhere!

You need to register to participate — here’s the registration page. I hope to see you there!

Categories
Artificial Intelligence Career

OpenAI needs bodyguards…er, “Executive Protection Operators”

While perusing OpenAI’s “Careers” page, I noticed that the drop-down menu that lets you filter jobs by department included Corporate Security, and that doesn’t mean cybersecurity, but security of much rougher, tougher, old-fashioned sort.

At the time of writing, this department has just one job listing, and it’s not one you’d expect to see for a software company:

Executive Protection Operator

About the team
The Corporate Security (CorpSec) team at OpenAI is dedicated to ensuring the safety and security of our people and facilities. We are committed to maintaining a secure environment that enables our team to focus on advancing artificial intelligence in a responsible manner.

About the role
As an Executive Protection Operator, you will play a crucial role in safeguarding the well-being of OpenAI’s executives and key employees. Your responsibilities will encompass providing security support during travel, events, and, when necessary, day-to-day operations. You will need to have proficiency in firearms handling and the legal authority to carry a firearm in the United States. You are a seasoned, collaborative security professional with a deep understanding of executive protection principles and a proven ability to navigate complex, dynamic security situations with discretion and tact.

This position is based in our San Francisco HQ. We use a hybrid work model of 3 days in the office per week, though this role is expected to have a flexible schedule that aligns with the travel and operational needs of the executives you support. We offer relocation assistance to new employees.

In other words: they’re looking for bodyguards.

Clearly the folks at OpenAI — not normally the best at “reading the room” — understand that the “creative destruction” that their products will unleash upon the world over the next few years will make them deeply unpopular in certain circles. It appears that they’re taking precautions (and hey, it might have been a suggestion from ChatGPT!).

My favorite part of the posting is the “desired qualities” list, especially the last item:

You might thrive in this role if you: 

  • Hold a current and valid Law Enforcement Officers Safety Act (LEOSA) card for concealed carry in all 50 states, with 10+ years of related work experience or at least 5 years with an advanced degree.
  • Maintain the highest level of confidentiality and discretion, with a proven ability to stay composed in urgent and high-pressure situations.
  • Have experience in executive protection for top-level leaders in diverse environments and have completed recognized Executive Protection and driving courses.
  • Possess leadership experience coordinating with domestic and international law enforcement, military, intelligence, and corporate partners.
  • Are trained in tactical medical procedures and have a strong understanding of Google Workspace applications.

That last bullet point might be the first time the qualifications of tactical medical procedures and strong understanding of Google Workspace applications have been combined in a job requirement. Applicants might do well to write this in their cover letter:

I’m a medic in the streets, and a beast on Google Sheets!

No need to credit me with this line.

Are you qualified? Are you willing to take a bullet for Sam Altman or an equally machiavellian AI bro? Apply here.

And because the song from The Bodyguard is now stuck in my head, I’m sticking it in yours, too:

Categories
Artificial Intelligence Humor

When you ask ChatGPT for a word that begins with “i”

Screenshot of ChatGPT conversation:

Me: I need a word that begins with "i" that is a synonym for speech or presentation

ChatGPT: A word that begins with "i" and is a synonym for speech or presentation is "address."

Me: "Address" doesn't begin with "i."

ChatGPT: Apologies for the oversight. A word that begins with "i" and is a synonym for speech or presentation is "oration."

Me: That doesn't begin with "i" either.

ChatGPT: You're right, my apologies for the oversight. A word that begins with "i" and is a synonym for speech or presentation is "interlocution."

Me: There you go. Nicely done.

Here’s your daily reminder that large language models don’t actually “understand” the world — at least not in the same way that we do. They’re stochastic parrots.