Inside 2bcloud’s ‘Chase the Bedrock’ Interactive Quiz Game
We’re thrilled to share the story behind “Chase the Bedrock,” our interactive quiz game unveiled at the AWS Summit. At 2bcloud, we’re always pushing the boundaries of cloud technology, and this game is a perfect example of our commitment to making AWS learning fun, engaging, and highly interactive.
The Birth of the Game
The idea for “Chase the Bedrock” came from our desire to turn AWS learning into a game. We wanted a platform where both beginners and experts could challenge their knowledge of AWS services in a fun and competitive way. The game also highlights our expertise in advanced machine learning using AWS Bedrock.
Our Goals
Our main objectives for “Chase the Bedrock” were simple:
- Engage: Capture attention with a visually appealing, intellectually stimulating game.
- Educate: Reinforce AWS service knowledge through real-time questions and feedback.
- Showcase: Demonstrate the power of AWS technologies like AWS Lambda, Amazon API Gateway, and AWS DynamoDB in real-time applications.
The Experience at AWS Summit
At the AWS Summits in Tel Aviv and New York, our booth was buzzing as attendees played and competed in “Chase the Bedrock.” Conceived by our CEO, Gil Ron, the game showcased AWS Bedrock’s Generative AI capabilities and demonstrated how our customers can achieve business outcomes with AWS Bedrock for tasks like text search and summarization.
What is Chase the Bedrock?
“Chase the Bedrock ” is a Generative AI application using AWS Bedrock to test users’ knowledge of AWS services. It compares human responses with those from the Claude 3 model, providing a unique learning experience.
Design Patterns to develop Generative AI applications
To build Generative AI applications there are various architecture patterns and use cases for AWS Bedrock and Foundation Models (FM)
These patterns are identified below.
1. Text generation
Text generation is a term used for any use case where the output of the model is newly generated text. One can use it to write articles, poems, blogs, books, emails, and so forth. In Amazon Bedrock, you can use various foundation models (FMs) for text generation tasks. For text generation, one can also use a LangChain layer to add a conversation chain to specific text generation use cases. LangChain is a powerful open-source library. It pairs well with some of the strongest text generation FMs on Amazon Bedrock to efficiently create conversations, text generation, and more.
2. Text summarization
Text summarization is a natural language processing (NLP) task that condenses the text from a given input while preserving the key information and meaning of the text. The following are the two ways to do summarization:
- Select a subset of text from input that represents key ideas.
- Create new sentences that capture the key concepts and elements of the source text.
Text summarization can help reduce information overload by synthesizing and surfacing important information that is more digestible and actionable by users.
It has a wide range of applications.
- News article summarization
- Academic paper summaries
- Call center transcripts.
- Business document summarization
- Personal communication summarization
When working with document summaries, the choice of application architecture pattern depends on the size of the document relative to the model context size. Other challenges with large documents include out-of-memory errors and hallucinations.
You can apply this architecture pattern when the document text can fit in the Large Language Model (LLM) context size.
Text Summarization architecture for large documents includes the following steps:
- Split a large document into multiple small number (n) chunks using tools such as LangChain.
- Send each chunk to the LLM to generate a corresponding summary.
- Append the next chunk to the first summary generated and summarize again.
- Iterate on each chunk to create a final summarized output.
3. Question Answering
Question answering is an important task that involves extracting answers to factual queries posed in natural language. Typically, a question answering system processes a query against a knowledge base containing structured or unstructured data and generates a response with accurate information. Ensuring high accuracy is key to developing a useful, reliable, and trustworthy question answering system, especially for enterprise use cases.
Generic Base Use Case
With the generic base use case, the user can prompt the FM in Amazon Bedrock and get responses based on generic information the public will understand. The generic base use case lacks the element of personalization.
Personalized and Specific Use Case
This architectural pattern is specifically used for personalized use cases. These use cases require specific responses and attention to detail in different domains, so using a base model is not sufficient. One can use the Retrieval Augmented Generation (RAG) technique to locate the relevant chunks of text that are best suited to answer the user’s question. RAG then concatenates the best set of strings as a response to the user from the relevant chunks retrieved.
RAG involves the following steps:
- The user asks a question.
- Domain-specific documents are converted into embeddings using the Amazon Titan Embeddings model. The embeddings are stored in a knowledge base (vector database) for subsequent retrieval.
- The user’s question is used to retrieve the relevant chunks of data, which will act as the context, from the knowledge base. The user’s question and the context are then passed to the FM to get an accurate response to the user.
- When the user poses a prompt, the FM identifies the context and refers to the knowledge base to get the relevant chunks of data. The FM then interacts with another FM to get an accurate response to the user.
4. Chatbots
One can use conversational interfaces, such as chatbots and virtual assistants, to enhance the user experience for customers. Chatbots use NLP and machine learning (ML) algorithms to understand and respond to user queries. You can use chatbots in a variety of applications, such as customer service, sales, and ecommerce, to provide quick and efficient responses to users. You can access chatbots through various channels, such as websites, social media platforms, and messaging apps.
A basic architectural pattern of a chatbot use case with Amazon Bedrock is illustrated in the following diagram.
This architecture includes the following steps:
- The user queries the chatbot.
- The chat history (if there is any) is passed on to the Amazon Bedrock model along with the user’s current query.
- The model then generates a response.
- The model passes the response back to the user.
A simple architecture for a context-aware chatbot is shown in the following diagram. This architecture includes the following steps:
- The user asks a question (user query) to the LLM on Amazon Bedrock.
- The LLM sends the modified question to the embeddings model.
- The chat history is updated.
- The user query is converted to a vector embedding using the Amazon Titan Embeddings model.
- A similarity search is performed. The result of the search is a set of relevant text chunks.
- Based on the stored information, an answer to the prompt (user query) is generated from the final FM.
- The user query and the response from the FM are added to the chat history.
- The response (answer) is given to the user at the same time.
5. Code Generation
One can also use the foundation models in Amazon Bedrock for various coding and programming related tasks. Examples include code and SQL query generation, code explanation and translation, bug fixing, code optimization, and so forth. Using foundation models for coding related tasks helps developers and data scientists rapidly prototype their ideas and use cases.
The following architecture pattern illustrates the use case of using the FMs in Amazon Bedrock for coding and programming.
6. LangChain Agents
Foundation models undergo extensive training on vast amounts of data. Despite their substantial natural language understanding capabilities, they cannot independently perform tasks like processing insurance claims or making hotel reservations. This limitation arises from the necessity for access to the latest company or industry-specific data, which foundation models cannot obtain from up-to-date knowledge sources by default. Additionally, FMs cannot take specific actions to fulfill requests without a great deal of manual programming.
Certain applications demand an adaptable sequence of calls to language models and various utilities depending on user input. The agent interface provides flexibility for these applications. An agent has availability to a range of resources and selects which ones to use based on the user input. Agents can use multiple tools, and they can use the output of one tool as the input for the next.
In order to run agents on LangChain it can be done using one of two techniques: plan and execute or ReAct, which stands for reasoning and acting. The ReAct technique will evaluate the prompt and determine the next step in solving the problem. It will then run that step and then repeat the process until the LLM can answer the question. Plan and execute works a little differently in that it determines the steps needed ahead of time and performs them sequentially.
7. Agents for Amazon Bedrock
Amazon Bedrock is a fully managed offering that makes it more efficient for developers to automate tasks. With agents for Amazon Bedrock, FMs can understand user requests, break down complex tasks into multiple steps, and take necessary actions to fulfill requests. Developers can use agents for Amazon Bedrock to create an orchestration plan without any manual coding.
Agents need access to an external data source, and they need to connect to your existing APIs. Developers can use the Amazon Bedrock console or the AWS SDK to upload the API schema. The agents will orchestrate tasks with the help of FMs and perform API calls using AWS Lambda functions. Therefore, agents remove the need to manage system integration and infrastructure provisioning.
Chase the Bedrock Solution Architecture
Logical architecture of Chase the Bedrock solution is depicted in Figure 1. It is based on design pattern of Question Answering as described above. Logical components and AWS services used are identified below.
- AWS Bedrock service
- Anthropic Claude 3 Sonnet model
- Knowledgebase for Amazon Bedrock
- Vector Database (Open Search)
- API Gateway
- Amazon DynamoDB
- Chase the Bedrock mobile Application
- S3 bucket
- Lambda function
To create a set of questions to be prompted to user, we used Knowledge Base for Bedrock. Knowledge Bases for Amazon Bedrock is a fully managed capability that helps you implement the entire RAG workflow from ingestion to retrieval and prompt augmentation without having to build custom integrations to data sources and manage data flows. Amazon Bedrock creates an Amazon OpenSearch Serverless vector store by default. Alternatively, you can specify an existing vector store in one of the supported databases, including Amazon OpenSearch Serverless, Pinecone, and Redis Enterprise Cloud, Amazon Aurora, and MongoDB.
It was created using PDF files containing FAQs and White Papers of AWS services.
To create Front End, we used Figma as tool to create mockup of screens that need development. Front End development was carried out using React framework. Mobile application would invoke API using API Gateway. API Gateway invokes Lambda function for use cases described below.
Primary uses case for application are.
- Register a user.
- Create a set of questions for users to respond.
- Perform scoring of user responses
- Create a leader board based on accuracy of response from users.
- Measure user performance and compare it to response from Chase the Bedrock model.
- Store information about user registration, scores in Dynamo DB
Upon successful registration of user, a set of questions that were retrieved from Bedrock Knowledge Base would be displayed for user to respond. Users’ response would be scored against response from Claude 3.5 model response for accuracy. Each user would get one opportunity.
Summary
Chase the Bedrock mobile application is testament to 2bcloud’s ability to deliver Generative AI solution using AWS services and scale it for large number of users.
It was quite apparent this year that customers across many industries are reimagining their business functions using purpose-built solutions on AWS with the mindset of exploration, transformation and innovation using Generative AI solution on Bedrock service. 2bcloud is here to be your partner in optimizing the delivery and management of AWS services. We’re here to help you to create an environment where people and ideas come together to try new things and implement bigger, bolder, better ways of doing business. Learn more about how we can empower your digital transformation.