DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workkloads.

Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Unlocking Language Models With Powerful Prompts
  • Top 3 AI Tools to Supercharge Your Software Development
  • Architecting High-Performance Supercomputers for Tomorrow's Challenges
  • PostgresML: Extension That Turns PostgreSQL Into a Platform for AI Apps

Trending

  • Scalable System Design: Core Concepts for Building Reliable Software
  • Enhancing Security With ZTNA in Hybrid and Multi-Cloud Deployments
  • Stateless vs Stateful Stream Processing With Kafka Streams and Apache Flink
  • Understanding and Mitigating IP Spoofing Attacks
  1. DZone
  2. Data Engineering
  3. AI/ML
  4. How To Improve a GenAI's Model Output

How To Improve a GenAI's Model Output

Generative AI has evolved into powerful content generators thanks to DL algorithms. However, to get more accurate results, different cycles and iterations can be used.

By 
Igor Paniuk user avatar
Igor Paniuk
·
Nov. 09, 23 · Tutorial
Likes (1)
Comment
Save
Tweet
Share
2.9K Views

Join the DZone community and get the full member experience.

Join For Free

Generative AI, dating back to the 1950s, evolved from early rule-based systems to models using deep learning algorithms. In the last decade, advancements in hardware and software enabled real-time, high-quality content generation by large-scale generative AI models.

In this article, I’ll tell how you can successfully integrate Generative AI into large-scale production processes within the business environment. So, you will know how to prepare for implementing Generative AI at an enterprise level. For example, for customer service, marketing communications, finance management, or other GenAI business applications.

ML Role in GenAI

In the context of Generative AI, ML algorithms structure a series of tasks. These task sequences are continuous experiments, requiring us to prepare our teams and businesses for recurring cycles.  

For example, you’re instructing a language model to provide responses. In this case, you have to establish a cycle, evaluate results, and iterate as needed. Here, you’ll use different problem-solving approaches or “patterns” that progress from simpler to more advanced strategies for managing tasks.

This diagram includes different cycles and iterations. You can refer to it and adapt it to your enterprise's specific requirements.

Generative AI Life-cycle Components

Let’s break down a simple cycle.

Level 1: Prompt, In-Context Learning and Chaining

Step 1

You pick a model, give it a prompt, get a response, evaluate the response, and re-prompt if needed until you get the desired outcome. 

In-context learning is a prompt engineering approach where language models learn tasks from a few natural language examples and try to perform them. ICL is a new approach in NLP with similar objectives to few-shot learning that lets models understand context without extensive tuning. 

Step 2

Apart from Prompt → FM → Adapt → Completion pattern, we often need a Chain of Tasks that involves data extraction, predictive AI, and generative AI foundational models. This pattern follows:

Chain: Extract data/analytics → Run predictive ML model → Send result to LLM → Generate output

For example, in a marketing scenario, you can start by using SQL with BigQuery to target specific customer segments. Next, a Predictive AI ranking algorithm is used to identify the best customers and send this data to the LLM to generate personalized emails.

Level 2. Improving the Previous Level

If you're still unsatisfied with the model's responses, you can try fine-tuning the foundational model. It can be domain-specific, industry-specific, or created for specific output formats. It fine-tunes all parameters on a large dataset of labeled examples, which can be computationally intensive but offers top performance.

Parameter-efficient fine-tuning (PEFT) can be a more computationally efficient approach compared to traditional fine-tuning. PEFT fine-tunes only a subset of the model's parameters, either through adaptor tuning or Low-Rank Adaptation of Large Language Models.

  • Adaptor tuning adds a task-specific layer trained on a small set of labeled examples, letting the model learn task-specific features without full parameter fine-tuning.
  • LoRA approximates the model's parameters with a low-rank matrix using matrix factorization, efficiently fine-tuning it on a small dataset of labeled examples to learn task-specific features.

Level 3. Upgrading the Input's Context

Step 1

To implement the semantic search for related documents, you should divide them into sentences or paragraphs. You can then transform them into embeddings using a Vector Embedding tool. This process utilizes an Approximate Nearest Neighbor (ANN) search, improving the model's responses by reducing the chances of hallucination and providing relevant context. 

It's known as Retrieval Augmented Generation (RAG).

  1. Start with a user query or statement.
  2. Make the prompt better by adding context from the Vector Embedding tool.
  3. Send the augmented prompt to the LLM.

Step 2

You can boost the model's accuracy by letting it show where it got its answers. With RAG, this happens before showing the answer. After generating the answer, it finds a source and shares it. Many providers, like Google Cloud AI, offer ways to do this.

Step 3

FLARE, a spin-off of RAG, involves proactive retrieval. It predicts what's coming next and fetches information in advance, especially when it's unsure about the answers.

Last Thoughts

Mastering the stages of a generative AI project and adapting the needed skills empowers businesses to use AI effectively. It's a challenging journey that requires planning, resources, and ethical commitment, but the result is a powerful AI tool that can transform business operations. I hope you found this information helpful!

AI Data structure Deep learning Language model Requirements engineering Task (computing)

Published at DZone with permission of Igor Paniuk. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Unlocking Language Models With Powerful Prompts
  • Top 3 AI Tools to Supercharge Your Software Development
  • Architecting High-Performance Supercomputers for Tomorrow's Challenges
  • PostgresML: Extension That Turns PostgreSQL Into a Platform for AI Apps

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!