A primer on Generative #AI and where it can be applied best

My customers have inquired about Generative AI (GenAI) and how to start implementing it. This article is a primer on #GenAI and where it can be used. Please note that the views expressed here are my own.

Summary: Generative AI is a powerful tool with many benefits, but it is not a one-stop solution for all problems. While Large Language Models (LLMs) can be expensive in terms of time and money for training and re-training, they are still a valuable resource for generating text, summarizing information, copywriting, creating images and videos, and writing new content. It is important to note, however, that Gen AI is not suitable for common ML use cases such as linear regression, forecasting, or predictions. Additionally, Gen AI's results may not always be 100% accurate and can sometimes result in hallucinations. Lastly, it is important to be cautious when using "borrowed" content, as regulation is still catching up and Gen AI can potentially land you in trouble.

How did the burst of AI occur and why does it seem sudden?

The Cambrian Explosion occurred in the early Paleozoic era, resulting in a sudden appearance of more complex biological life. However, this evolved from many multi-cell organisms, leading to colonies, then to more complex biological forms, and persisted into the Cambrian period, where it appears to have happened in a narrower timeframe. This can be loosely compared to the recent resurgence of AI, specifically Generative AI.

Google laid the foundation for LLMs with its initial paper on transformers, which transformed language into machine-understandable instructions. This was a significant breakthrough. I won't get into the details of Transformers, but they changed machine learning by retaining the meaning and position of text, being more memory efficient, and capable of being trained on GPUs simultaneously and in parallel. Looking at the graph below, you can see the Cambrian Explosion of AI post-2017, after the introduction of transformers.

How should I think about Generative AI?

AI can be defined as the use of computer power to solve problems related to human intelligence. ML is a branch of AI where algorithms learn from data and make predictions based on that data. Deep learning, which is a part of ML, uses layered algorithms to identify relationships between data elements. Deep Learning utilizes neural networks with multiple levels of hierarchy to enhance outputs. For instance, when classifying an image, the first hidden layers detect simple patterns or interactions, such as diagonal lines, horizontal lines, and blurry areas, by analyzing groups of adjacent pixels. As the network identifies these patterns, subsequent layers combine them to recognize more complex patterns, like big squares. Finally, later layers integrate the location of squares and other geometric shapes to accurately identify objects in the image, such as a checkerboard pattern, a face, or a car. Deep learning has the power to identify more relationships than humans can practically code in software or even perceive.

GenAI utilizes Deep Learning, and the models are trained on very large datasets called Foundational Models (FMs). These foundational models are then fine-tuned with large amounts of text-based data to create LLMs that serve specific use cases like search or conversational bots. In addition, GenAI can generate images from text-based prompts using a transformer neural network paradigm. First, text from a prompt is encoded, then there is a mapping that occurs between the encoded text and encoded image, and finally, an image decoder creates a new image. These models are pre-trained on billions of images and captions, allowing them to create images based on the best fit. In a nutshell, Gen AI uses tokens that map to words, symbols, or formatting commands. These tokens are embedded in vectors, and similar words, pixels, etc. get vectors that are close in distance in an n-dimensional space. To predict the next word, Gen AI uses probability based on the current word. For example, if you wanted to predict the next word after "New York", you would determine the best probability of the next word being "Rangers" or "Knicks" given "New York": P("Rangers" or "Knicks" | "New York"). This happens more intuitively given context and prompts.

How do chatbots know what to say?

Gen AI chat bots are pre-trained on FMs and LLMs, which can be expensive and time-consuming. These models are then fine-tuned to focus on your specific use case. Context refers to an active session where you exchange information with the model. However, context does not persist and has a maximum size. Prompts are the means by which you interact with the model. Think of context as a session, and once you close a chat session, the model will lose the context, and the GenAI model will not be able to resume where you left off. By providing better prompts (and therefore higher-quality context), you will be able to generate better answers.

So where can I use Gen AI?

If you need a traditional algorithm for tasks such as forecasting, prediction, or optimizing routes, it is best not to use Gen AI. There are plenty of machine learning and computer science algorithms that can help with this. Gen AI may not be the best tool for you if your model requires 100% accuracy. For instance, if you're building a banking application and require precision, Gen AI may not be well-suited. In addition, Gen AI may not be the best option for you if you require full interpretability. This can lead to missing facts and false positives.

However, if you need scalability, creativity, or adaptability, Gen AI is a great choice. It is trained on vast data sets and can come up with inventive responses. Lastly, if you want to reduce complexity and understand quickly, Gen AI can help you achieve that. For example, it can help distill the legal conclusion of a supreme court case and explain how it was achieved.

What are some common Gen AI use cases?

Document summarization and writing

  • Request a document or summarize content of document. For example you can prompt Gen AI with “rewrite the Gettysburg address so a 7 year old can understand”

  • Modernize / change the tone of an existing document or your writing.

  • Ask for feedback or counter arguments on your document or thesis.

  • Simply ask Gen AI to write you an essay or document on a topic of your choice

Pair programming

  • Code Companions can help you generate code and complete common code snippets utilizing common IDEs

  • You can also use Gen AI and ask to generate code for most common algorithms

Simple chat

  • Utilize Gen AI to chat with your customers. If you have trained your model on your specific domain, Gen AI can provide automated responses.

Beyond text

  • You can use Gen AI to generate images, video or audio. For example there are many websites that makes it easy for you to generate ads, images and copies. Its a creativity hack!

Custom use cases

You can use Gen AI with database plug-ins and APIs to deliver on custom use cases. There are plenty of examples, but are a couple of examples I’ve used.

Database Plug-in that provides Gen AI access to your Transactional Database, so you can more readily answer BI related questions such as “How many units did we sell in NY?”

Financial data plug-in that allows you to mine corporate performance data

Things to watch for - Gen AI is far from perfect

Gen AI can provide lots of advantages such as improved personalization, creativity, versatility to solve different tasks and easy access to adapt and maintain the models. However, with accelerated adoption there are legal and social risks. On the legal front, Gen AI can infringe on privacy and intellectual property, along with unwanted biases. Additionally, Gen AI can generate toxic, racist or factually incorrect remarks. In order to reduce these risks, your models should be assessed across privacy, security, transparency and explainability, governance, safety and fairness dimensions. Do not blindly trust outputs from Generative AI models. Fine tuning models requires high quality data and ensure you account for responsible AI maintenance burden. Clearly, some business problems require machine learning solutions, while others may not. It is also important to note that not all machine learning problems involve generative AI.

Happy building!

Let there be Light - and power and data!

Let there be Light - and power and data!