Build RAG and agent-based generative AI applications using the new Amazon Titan Text Premier model available on Amazon Bedrock

Applications of AI


polly's voice

Today we welcome the newest member of the Amazon Titan model family, Amazon Titan Text Premier, now available on Amazon Bedrock.

Following Amazon Titan Text Lite and Titan Text Express, Titan Text Premier is the latest large language model (LLM) in the Amazon Titan model family, expanding model selection within Amazon Bedrock. Bedrock now offers the following Titan Text models to choose from:

  • Titan Text Premier is the most advanced Titan LLM for text-based enterprise applications. It has a maximum context length of 32K tokens and is specifically optimized for enterprise use cases such as building retrieval augmentation generation (RAG) and agent-based applications using Amazon Bedrock's knowledge bases and agents. Like all Titan LLMs, Titan Text Premier is pre-trained with multilingual text data, but is ideal for English tasks. You can further custom tweak (preview) Titan Text Premier using your own data from Amazon Bedrock to build applications specific to your domain, organization, brand style, or use case. In the next section of this post, we will discuss the model's highlights and performance in detail.
  • titan text express is ideal for a wide range of tasks, including free-form text generation and conversational chat. The maximum context length for this model is 8K tokens.
  • titan text light is speed-optimized, highly customizable, and perfect for fine-tuning for tasks like article summaries and copywriting. The maximum length of the model's context is his 4K token.

Now let's learn more about Titan Text Premier.

Amazon Titan Text Premier Model Highlights
Titan Text Premier is optimized for high-quality RAG and agent-based applications and customization with fine-tuning that incorporates responsible artificial intelligence (AI) practices.

Optimized for RAG and agent-based applications – Titan Text Premier is specifically optimized for RAG and agent-based applications in response to customer feedback, with respondents citing RAG as one of the key components when building generative AI applications. Masu. The model training data includes example tasks such as summaries, Q&A, and conversational chat, and is optimized for integration with Amazon Bedrock knowledge bases and agents. Optimization involves training the model to handle nuances in these features, such as specific prompt formats.

  • High-quality RAG with integration with Amazon Bedrock’s knowledge base – The Knowledge Base allows you to securely connect Amazon Bedrock's Foundation Model (FM) to your corporate data in RAG. You can now choose Titan Text Premier with Knowledge Bases to implement question answering and summarization tasks on your company's own data.
    Amazon Titan Text Premier support in our knowledge base
  • Automate tasks by integrating with Agents for Amazon Bedrock – You can also use Titan Text Premier and Agents for Amazon Bedrock to create custom agents that can perform multi-step tasks across a variety of enterprise systems and data sources. Agents let you automate tasks for internal or external customers, such as managing retail orders or processing insurance claims.
    Amazon Titan Text Premier with agent for Amazon Bedrock

We are already seeing customers looking to Titan Text Premier to implement interactive AI assistants that create summaries from unstructured data such as emails. We're also exploring models that extract relevant information from across a company's systems and data sources to create a more meaningful product overview.

This is a demo video created by my colleague Brooke Jamieson that shows an example of how you can leverage Titan Text Premier for your business.

Amazon Titan Text Premier Custom Tweaks (Preview) – You can fine-tune Titan Text Premier using your own data in Amazon Bedrock and increase model accuracy by providing your own task-specific labeled training datasets. Customize Titan Text Premier to further specialize your models and create unique user experiences that reflect your company's brand, style, voice, and services.

build responsibly – Amazon Titan Text Premier has safe, secure, and reliable practices built into it. The AWS AI Service Card for Amazon Titan Text Premier documents model performance across key responsible AI benchmarks, from safety and fairness to veracity and robustness. This model also integrates with Guardrails for Amazon Bedrock, allowing you to implement additional safeguards tailored to your application requirements and responsible AI policies. Amazon will indemnify customers who use Amazon Titan models responsibly against claims that a publicly available Amazon Titan model or its output infringes a third party's copyright.

Amazon Titan Text Premier Model Performance
Titan Text Premier is built to provide a wide range of enterprise-relevant intelligence and utility. The following table shows the evaluation results of public benchmarks that evaluate key features such as following instructions, reading comprehension, and multi-step reasoning for price-comparable models. Strong performance across these diverse and challenging benchmarks highlights that Titan Text Premier is built to handle a wide range of use cases for enterprise applications and offers excellent price performance. Masu. For all benchmarks listed below, higher scores are better.

ability standard explanation Amazon Google OpenAI
Titan Text Premier Gemini Pro 1.0 GPT-3.5
general MMLU
(paper)
Expressing questions for 57 subjects 70.4%
(5 shots)
71.8%
(5 shots)
70.0%
(5 shots)
Next instructions IFEval
(paper)
Evaluation that follows the instructions of large-scale language models 64.6%
(0 shots)
not published not published
reading comprehension Lace-H
(paper)
large scale reading comprehension 89.7%
(5 shots)
not published not published
inference hella swag
(paper)
common sense reasoning 92.6%
(10 shots)
84.7%
(10 shots)
85.5%
(10 shots)
DROP, F1 score
(paper)
Reasoning based on text 77.9
(3 shots)
74.1
(Variable shot)
64.1
(3 shots)
BIG bench hard
(paper)
Difficult tasks requiring multi-step reasoning 73.7%
(3 shots CoT)
75.0%
(3 shot CoT)
not published
ARC Challenge
(paper)
common sense reasoning 85.8%
(5 shots)
not published 85.2%
(25 shots)

Note: The benchmark evaluates model performance using variations of few-shot and zero-shot prompts. With few-shot prompts, you provide your model with many concrete examples (three for three-shot, five for five-shot, etc.) of how to solve a particular task. This demonstrates the model's ability to learn from examples, called in-context learning. Zero-shot prompts, on the other hand, rely solely on prior knowledge and general language understanding to evaluate a model's ability to perform a task, without providing any examples.

Try using Amazon Titan Text Premier
To enable access to Amazon Titan Text Premier, go to the Amazon Bedrock console. model access It's in the bottom left pane.in model access On the overview page, Manage access to models Click the button in the upper right corner to enable access to Amazon Titan Text Premier.

Select Amazon Titan Text Premier on the Amazon Bedrock model access page

To use Amazon Titan Text Premier with the Bedrock console: sentence or chat under playground In the left menu pane.Then select Please select a model and select Amazon as a category, and Titan Text Premier As a model. To explore the model, you can: Load example. The following screenshot shows one example demonstrating the chain of thought (CoT) and reasoning capabilities of the model.

Amazon Titan Text Premier in Amazon Bedrock Chat Playground

by choosing Viewing API requestsYou can get a code example of how to call a model using the AWS Command Line Interface (AWS CLI) at the current example prompt. You can also access Amazon Bedrock and available models using the AWS SDK. The following example uses the AWS SDK for Python (Boto3).

Amazon Titan Text Premier is now live
In this demo, we have Amazon Titan Text Premier summarize one of our previous AWS News blog posts announcing the availability of Amazon Titan Image Generator and watermark detection capabilities.

For summary tasks, the recommended prompt template is:

The following is text from a {{Text Category}}:
{{Text}}
Summarize the {{Text Category}} in {{length of summary}}

For more prompting best practices, check out the Amazon Titan Text Prompting Engineering Guidelines.

Adapt this template to my example to define the prompt.To prepare, save your news blog post as a text file and save it as post string variable.

prompt = """
The following is text from a AWS News Blog post:

<text>
%s
</text>

Summarize the above AWS News Blog post in a short paragraph.
""" % post

Like previous Amazon Titan Text models, Amazon Titan Text Premier supports: temperature and topP Inference parameters to control randomness and diversity of responses. maxTokenCount and stopSequences Controls the length of the response.

import boto3
import json

bedrock_runtime = boto3.client(service_name="bedrock-runtime")

body = json.dumps({
    "inputText": prompt, 
    "textGenerationConfig":{  
        "maxTokenCount":256,
        "stopSequences":[],
        "temperature":0,
        "topP":0.9
    }
})

Then what I use is InvokeModel API for sending inference requests.

response = bedrock_runtime.invoke_model(
    body=body,
	modelId="amazon.titan-text-premier-v1:0",
    accept="application/json", 
    contentType="application/json"
)

response_body = json.loads(response.get('body').read())
print(response_body.get('results')[0].get('outputText'))

And the response is:

Amazon Titan Image Generator is now generally available on Amazon Bedrock. This enables you to easily build and extend generative AI applications with new image generation and image editing capabilities, including on-the-fly image customization. Titan Image Generator watermark detection is now generally available in the Amazon Bedrock console. Today, we also introduced the new DetectGeneratedContent API (preview) in Amazon Bedrock. This will help you check the presence of this watermark and see if the image was generated by Titan Image Generator.

For more examples in various programming languages, see the Code Examples section of the Amazon Bedrock User Guide.

Other resources
Here are some additional resources you may find helpful.

Expected use cases, etc. — Check out the AWS AI Service Card for Amazon Titan Text Premier to learn more about the model's intended use case, design, deployment, and performance optimization best practices.

AWS Generative AI CDK constructs — Amazon Titan Text Premier is supported by AWS Generative AI CDK Constructs, an open source extension to the AWS Cloud Development Kit (AWS CDK) that provides sample implementations of AWS CDK for common generative AI patterns. .

Amazon Titan model — If you want to learn more about Amazon Titan models in general, watch the following video: Dr. Shelley Marcus, director of applied science at Amazon Bedrock, explains how the Amazon Titan family of models incorporates his 25 years of experience with Amazon innovating with AI and machine learning (ML) across its business. Let's talk about the dolphins.

currently available
Amazon Titan Text Premier is currently available in the AWS US East (N. Virginia) Region. Custom tweaks for Amazon Titan Text Premier are currently available in preview in the AWS US East (N. Virginia) Region. Check the complete region list for future updates. For more information about the Amazon Titan family of models, please visit the Amazon Titan product page. For pricing details, please visit the Amazon Bedrock pricing page.

Try Amazon Titan Text Premier now in the Amazon Bedrock console, send feedback to Amazon Bedrock's AWS re:Post or through your regular AWS contacts, and join the Generate AI Builders community at community.aws please.

— Antie



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *