Introduction to Generative AI
Generative Artificial Intelligence (AI) refers to all Artificial Intelligence systems that can create unpublished content (text, images, audio, etc.) based on existing content, which has been used to train them. These systems are based on Machine Learning (ML) strategies and, in particular, Deep Learning (DL), with which you can create very powerful models that can generate content based on the data used to train them, without the need to explicitly program.
Generative AI is particularly common in Natural Language Processing (NLP), the branch of AI that develops models that understand and use written and spoken human language.
There are many applications of Generative AI, the most famous examples are ChatGPT, able to create text, or MidJourney and Dall-E, two models that can generate images starting from a brief description of the content and style.
Generative AI: features
In general, “traditional” machine learning models are trained using structured data, composed of the same and respective data label and learning the association between the two, and perform operations of prediction of future data (“predictive” models) or classification/clustering (“discriminatory” models). Generative models instead are trained on often unstructured data, sometimes of heterogeneous origin, and learn the internal structure of data so that new content can be generated. The statistical model learned from a generative model during training is used to create new data similar to those used to train it.
What’s underneath Generative AI?
Generative models have had a strong acceleration in recent years thanks to the introduction of Transformers with the famous research Attention Is All You Need. Transformers are neural networks (Neural Networks or NN) based on the encoder-decoder model with the addition of a mechanism of “attention“. With the Transformers, the data is encoded to learn the internal structure, and then decoded to verify the goodness of the process. The attention mechanism, instead, improves the learning process because it allows you to focus on the most significant parts of the data, by assigning weights. Compared to previous models, Transformers learn more information and more accurately. Large Language Models (LLMs) such as those used by ChatGPT are an example.
The Transformers are not immune from errors: they often generate meaningless or grammatically incorrect words or phrases, which are called “hallucinations“. They are usually caused by lack of data, wrong or poorly cleaned data during training, lack of context or limitations in the requested response to the model.
Generative AI models generate unpublished content from a small input, typically in the form of a question or text description, called a prompt. The correct writing of prompts allows to significantly reduce the “hallucinations” of the model, and has recently born the discipline of Prompt Engineering with the goal of communicating effectively to AI what is the desired response. The general idea is to include the necessary information in the application, rather than provide it as a context to the model before asking the question.
Some popular Prompt Engineering strategies include adding:
- Some examples of desired response (Few-Shot Prompting)
- A sequence of logical reasoning that accompanies AI towards the desired response (Chain-of-Thought Prompting)
- Some example prompts to refine the AI response (Instruction Prompting)
- A sequence of other Prompts to decompose the problem into multiple parts and solve them recursively (Recursive Prompting)
Applications of Generative AI
Generative AI has found applications in many industries. “Text-to-Text” templates are for example used in Marketing to generate content and email, or in Customer Care to create smart chatbots. Another application from the text generation is that of programming support (Code generation, documentation, web app development). “Text-to-Image” templates allow you to generate images from a description, and are used in the fields of Marketing, Social, Advertising and Design. Audio generating models are used for creating speech synthesizers, while video generating models are used in the Video Editing industry. In the pharmaceutical field new forms of Generative AI are being developed to generate new drugs.
Solutions of Generative AI
Leading cloud providers are developing Generative AI solutions that offer Foundation Models that can be trained for a specific case through “fine tuning”, such as Azure OpenAI, Google Vertex and AWS Bedrock. In addition to the ability to generate content, these solutions have the significant advantage of ensuring security and data protection.
Generative AI offers innovative solutions, but must be used following principles of Responsible AI, in order to ensure accuracy, impartiality and absence of bias in responses, respect for intellectual property and privacy.