├── .gitignore ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md └── sentence-transformer └── multiple-negatives-ranking-loss ├── FineTuneEmbedding.ipynb └── training.json /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | 4 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | ## Code of Conduct 2 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). 3 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact 4 | opensource-codeofconduct@amazon.com with any additional questions or comments. 5 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing Guidelines 2 | 3 | Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional 4 | documentation, we greatly value feedback and contributions from our community. 5 | 6 | Please read through this document before submitting any issues or pull requests to ensure we have all the necessary 7 | information to effectively respond to your bug report or contribution. 8 | 9 | 10 | ## Reporting Bugs/Feature Requests 11 | 12 | We welcome you to use the GitHub issue tracker to report bugs or suggest features. 13 | 14 | When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn't already 15 | reported the issue. Please try to include as much information as you can. Details like these are incredibly useful: 16 | 17 | * A reproducible test case or series of steps 18 | * The version of our code being used 19 | * Any modifications you've made relevant to the bug 20 | * Anything unusual about your environment or deployment 21 | 22 | 23 | ## Contributing via Pull Requests 24 | Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that: 25 | 26 | 1. You are working against the latest source on the *main* branch. 27 | 2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already. 28 | 3. You open an issue to discuss any significant work - we would hate for your time to be wasted. 29 | 30 | To send us a pull request, please: 31 | 32 | 1. Fork the repository. 33 | 2. Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change. 34 | 3. Ensure local tests pass. 35 | 4. Commit to your fork using clear commit messages. 36 | 5. Send us a pull request, answering any default questions in the pull request interface. 37 | 6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation. 38 | 39 | GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and 40 | [creating a pull request](https://help.github.com/articles/creating-a-pull-request/). 41 | 42 | 43 | ## Finding contributions to work on 44 | Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start. 45 | 46 | 47 | ## Code of Conduct 48 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). 49 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact 50 | opensource-codeofconduct@amazon.com with any additional questions or comments. 51 | 52 | 53 | ## Security issue notifications 54 | If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue. 55 | 56 | 57 | ## Licensing 58 | 59 | See the [LICENSE](LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution. 60 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT No Attribution 2 | 3 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so. 10 | 11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 12 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 13 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 14 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 15 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 16 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Fine-Tuning Embedding Models on Amazon SageMaker 2 | 3 | This repository contains samples for fine-tuning embedding models using Amazon SageMaker. 4 | Embedding models are useful for tasks such as semantic similarity, text clustering, and information retrieval. 5 | By fine-tuning embedding model on data that is representative of the target domain or task, the model can learn to capture the relevant semantics, jargon, and contextual relationships that are crucial for that domain. 6 | Domain-specific embeddings can significantly improve the quality of vector representations, leading to more accurate retrieval of relevant context from the vector database. This, in turn, enhances the performance of the RAG system in terms of generating more accurate and relevant responses. 7 | 8 | 9 | ## Contents 10 | - [`sentence-transformer/multiple-negatives-ranking-loss/`](https://github.com/aws-samples/fine-tune-embedding-models-on-sagemaker/tree/main/sentence-transformer/multiple-negatives-ranking-loss): This directory contains a Jupyter notebook demonstrating how to fine-tune a [sentence-transfomer](https://www.sbert.net/) embedding model using the [Multiple Negatives Ranking Loss function](https://www.sbert.net/docs/package_reference/sentence_transformer/losses.html#multiplenegativesrankingloss) which is recommended when in your training data you only have positive pairs, for example, only pairs of similar texts like pairs of paraphrases, pairs of duplicate questions, pairs of (query, response), or pairs of (source_language, target_language). 11 | We are using the Multiple Negatives Ranking Loss function because we are utilizing [Bedrock FAQ](https://aws.amazon.com/bedrock/faqs/) as the training data, which consists of pairs of questions and answers. 12 | The code in this directory is used in the AWS blog post [Improve RAG accuracy with finetuned embedding models on Sagemaker](https://aws.amazon.com/blogs/machine-learning/improve-rag-accuracy-with-fine-tuned-embedding-models-on-amazon-sagemaker/) 13 | 14 | ## Security 15 | We welcome contributions from the community! If you have an example or sample for fine-tuning embedding models on SageMaker, please feel free to submit a pull request. Your contribution will help others in their journey of fine-tuning embedding models. 16 | 17 | See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information. 18 | 19 | ## License 20 | 21 | This library is licensed under the MIT-0 License. See the LICENSE file. 22 | 23 | -------------------------------------------------------------------------------- /sentence-transformer/multiple-negatives-ranking-loss/FineTuneEmbedding.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "ebcba6e2", 6 | "metadata": {}, 7 | "source": [ 8 | "# Improve RAG Accuracy with Finetuned Embedding Models on Amazon SageMaker\n", 9 | "\n", 10 | "## Table of Contents\n", 11 | "1. [Introduction](#introduction)\n", 12 | "2. [Install Dependencies](#install-dependencies)\n", 13 | "3. [Load Data and Train the Model](#load-data-and-train-the-model)\n", 14 | "4. [Create Inference Script](#create-inference-script)\n", 15 | "5. [Upload the Model](#upload-the-model)\n", 16 | "6. [Deploy Model on SageMaker](#deploy-model-on-sagemaker)\n", 17 | "7. [Invoke the Model](#invoke-the-model)\n", 18 | "8. [Compare Predictions](#compare-predictions)\n", 19 | "\n", 20 | "\n", 21 | "### Introduction\n", 22 | "\n", 23 | "This notebook demonstrates how to use Amazon SageMaker to fine-tune a Sentence Transformer embedding model and deploy it with Amazon SageMaker Endpoint. For more information about Finetuning Sentence Transformer, see [Sentence Transformer Training Overview](https://www.sbert.net/docs/sentence_transformer/training_overview.html).\n", 24 | "\n", 25 | "We will fine-tune the embedding model [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2). It is an open-source sentence-transformers model fine-tuned on a 1B sentence pairs dataset. It maps sentences & paragraphs to a 384-dimensional dense vector space and can be used for tasks like clustering or semantic search.\n", 26 | "\n", 27 | "To fine-tune it, we will use the [Bedrock FAQ](https://aws.amazon.com/bedrock/faqs/), a dataset of questions and answer pairs, using the [Multiple Negatives Ranking Loss function](https://www.sbert.net/docs/package_reference/sentence_transformer/losses.html#multiplenegativesrankingloss).\n", 28 | "\n", 29 | "\n", 30 | "### Install Dependencies\n" 31 | ] 32 | }, 33 | { 34 | "cell_type": "code", 35 | "execution_count": null, 36 | "id": "bf626f15-ce6f-4827-b6d6-781ad526774e", 37 | "metadata": { 38 | "scrolled": true, 39 | "tags": [] 40 | }, 41 | "outputs": [], 42 | "source": [ 43 | "!pip install pathos==0.3.2\n", 44 | "!pip install datasets==2.19.2\n", 45 | "!pip install transformers==4.40.2\n", 46 | "!pip install transformers[torch]==4.40.2\n", 47 | "!pip install sentence_transformers==3.1.1\n", 48 | "!pip install accelerate==1.0.0\n", 49 | "!pip install sagemaker==2.224.1" 50 | ] 51 | }, 52 | { 53 | "cell_type": "markdown", 54 | "id": "1bc2fa78", 55 | "metadata": {}, 56 | "source": [ 57 | "\n", 58 | "## Load Data and Train the Model\n", 59 | "\n", 60 | "The following code snippet demonstrates how to load a training dataset from a JSON file, prepare the data for training, and then fine-tune the pre-trained model. After fine-tuning, the updated model is saved.\n", 61 | "\n", 62 | "The `EPOCHS` variable determines the number of times the model will iterate over the entire training dataset during the fine-tuning process. A higher number of epochs typically leads to better convergence and potentially improved performance, but may also increase the risk of overfitting if not properly regularized.\n", 63 | "\n", 64 | "In this example, we have a small training set consisting of only 100 records. As a result, we are using a high value for the `EPOCHS` parameter. Typically, in real-world scenarios, you would have a much larger training set. In such cases, the `EPOCHS` value should be a single or two-digit number to avoid overfitting the model to the training data.\n" 65 | ] 66 | }, 67 | { 68 | "cell_type": "code", 69 | "execution_count": null, 70 | "id": "70e1f8ae-23ad-4854-94ce-2d4d5a3e3f6d", 71 | "metadata": { 72 | "scrolled": true, 73 | "tags": [] 74 | }, 75 | "outputs": [], 76 | "source": [ 77 | "from sentence_transformers import SentenceTransformer, InputExample, losses, evaluation\n", 78 | "from torch.utils.data import DataLoader\n", 79 | "from sentence_transformers.evaluation import InformationRetrievalEvaluator\n", 80 | "import json\n", 81 | "\n", 82 | "def load_data(path):\n", 83 | " \"\"\"Load the dataset from a JSON file.\"\"\"\n", 84 | " with open(path, 'r', encoding='utf-8') as f:\n", 85 | " data = json.load(f)\n", 86 | " return data\n", 87 | "\n", 88 | "dataset = load_data(\"training.json\")\n", 89 | "\n", 90 | "\n", 91 | "# Load the pre-trained model\n", 92 | "model = SentenceTransformer(\"sentence-transformers/all-MiniLM-L6-v2\")\n", 93 | "\n", 94 | "# Convert the dataset to the required format\n", 95 | "train_examples = [InputExample(texts=[data[\"sentence1\"], data[\"sentence2\"]]) for data in dataset]\n", 96 | "\n", 97 | "# Create a DataLoader object\n", 98 | "train_dataloader = DataLoader(train_examples, shuffle=True, batch_size=8)\n", 99 | "\n", 100 | "# Define the loss function\n", 101 | "train_loss = losses.MultipleNegativesRankingLoss(model)\n", 102 | "\n", 103 | "EPOCHS=100\n", 104 | "\n", 105 | "model.fit(\n", 106 | " train_objectives=[(train_dataloader, train_loss)],\n", 107 | " epochs=EPOCHS,\n", 108 | " show_progress_bar=True,\n", 109 | ")\n", 110 | "\n", 111 | "# Save the fine-tuned model\n", 112 | "model.save(\"opt/ml/model/\",safe_serialization=False)" 113 | ] 114 | }, 115 | { 116 | "cell_type": "markdown", 117 | "id": "03d874e8", 118 | "metadata": {}, 119 | "source": [ 120 | "\n", 121 | "## Create inference.py File\n", 122 | "\n", 123 | "To deploy and serve the fine-tuned embedding model for inference, we create an `inference.py` Python script that serves as the entry point. This script implements two essential functions: `model_fn` and `predict_fn`, as required by AWS SageMaker for deploying and using machine learning models.\n", 124 | "\n", 125 | "The `model_fn` is responsible for loading the fine-tuned embedding model and the associated tokenizer. On the other hand, the `predict_fn` takes input sentences, tokenizes them using the loaded tokenizer, and computes their sentence embeddings using the fine-tuned model. To obtain a single vector representation for each sentence, it performs mean pooling over the token embeddings, followed by normalization of the resulting embedding. Finally, the `predict_fn` returns the normalized embeddings as a list, which can be further processed or stored as required.\n" 126 | ] 127 | }, 128 | { 129 | "cell_type": "code", 130 | "execution_count": null, 131 | "id": "0251ce77-43d8-4a9c-9315-c65e3b53c1d8", 132 | "metadata": { 133 | "tags": [] 134 | }, 135 | "outputs": [], 136 | "source": [ 137 | "%%writefile opt/ml/model/inference.py\n", 138 | "\n", 139 | "from transformers import AutoTokenizer, AutoModel\n", 140 | "import torch\n", 141 | "import torch.nn.functional as F\n", 142 | "import os\n", 143 | "\n", 144 | "def mean_pooling(model_output, attention_mask):\n", 145 | " token_embeddings = model_output[0] #First element of model_output contains all token embeddings\n", 146 | " input_mask_expanded = attention_mask.unsqueeze(-1).expand(token_embeddings.size()).float()\n", 147 | " return torch.sum(token_embeddings * input_mask_expanded, 1) / torch.clamp(input_mask_expanded.sum(1), min=1e-9)\n", 148 | "\n", 149 | "\n", 150 | "def model_fn(model_dir, context=None):\n", 151 | " # Load model from HuggingFace Hub\n", 152 | " tokenizer = AutoTokenizer.from_pretrained(f\"{model_dir}/model\")\n", 153 | " model = AutoModel.from_pretrained(f\"{model_dir}/model\")\n", 154 | " return model, tokenizer\n", 155 | "\n", 156 | "def predict_fn(data, model_and_tokenizer, context=None):\n", 157 | " # destruct model and tokenizer\n", 158 | " model, tokenizer = model_and_tokenizer\n", 159 | " \n", 160 | " # Tokenize sentences\n", 161 | " sentences = data.pop(\"inputs\", data)\n", 162 | " encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')\n", 163 | "\n", 164 | " # Compute token embeddings\n", 165 | " with torch.no_grad():\n", 166 | " model_output = model(**encoded_input)\n", 167 | "\n", 168 | " # Perform pooling\n", 169 | " sentence_embeddings = mean_pooling(model_output, encoded_input['attention_mask'])\n", 170 | "\n", 171 | " # Normalize embeddings\n", 172 | " sentence_embeddings = F.normalize(sentence_embeddings, p=2, dim=1)\n", 173 | " \n", 174 | " # return dictonary, which will be json serializable\n", 175 | " return {\"vectors\": sentence_embeddings[0].tolist()}\n" 176 | ] 177 | }, 178 | { 179 | "cell_type": "markdown", 180 | "id": "e875a2cc", 181 | "metadata": {}, 182 | "source": [ 183 | "\n", 184 | "## Upload the Model\n", 185 | "\n", 186 | "After creating the `inference.py` script, we package it together with the fine-tuned embedding model into a single `model.tar.gz` file. This compressed file can then be uploaded to an Amazon S3 bucket, making it accessible for deployment as a SageMaker endpoint." 187 | 188 | ] 189 | }, 190 | { 191 | "cell_type": "code", 192 | "execution_count": null, 193 | "id": "356331c8-2637-4d07-bad4-bb1e8acf88ab", 194 | "metadata": { 195 | "tags": [] 196 | }, 197 | "outputs": [], 198 | "source": [ 199 | "import boto3\n", 200 | "import tarfile\n", 201 | "import os\n", 202 | "\n", 203 | "model_dir = \"opt/ml/model\"\n", 204 | "model_tar_path = \"model.tar.gz\"\n", 205 | "\n", 206 | "with tarfile.open(model_tar_path, \"w:gz\") as tar:\n", 207 | " tar.add(model_dir, arcname=os.path.basename(model_dir))\n", 208 | " \n", 209 | "s3 = boto3.client('s3')\n", 210 | "\n", 211 | "# Get the region name\n", 212 | "session = boto3.Session()\n", 213 | "region_name = session.region_name\n", 214 | "\n", 215 | "# Get the account ID from STS (Security Token Service)\n", 216 | "sts_client = session.client(\"sts\")\n", 217 | "account_id = sts_client.get_caller_identity()[\"Account\"]\n", 218 | "\n", 219 | "model_path = f\"s3://sagemaker-{region_name}-{account_id}/model_trained_embedding/model.tar.gz\"\n", 220 | "\n", 221 | "bucket_name = f\"sagemaker-{region_name}-{account_id}\"\n", 222 | "s3_key = \"model_trained_embedding/model.tar.gz\"\n", 223 | "\n", 224 | "with open(model_tar_path, \"rb\") as f:\n", 225 | " s3.upload_fileobj(f, bucket_name, s3_key)\n", 226 | " " 227 | ] 228 | }, 229 | { 230 | "cell_type": "markdown", 231 | "id": "ecdd12ec", 232 | "metadata": {}, 233 | "source": [ 234 | "\n", 235 | "## Deploy Model on SageMaker\n", 236 | "\n", 237 | "Finally, we can deploy our fine-tuned model on a SageMaker Endpoint using `SageMaker HuggingFaceModel`." 238 | 239 | ] 240 | }, 241 | { 242 | "cell_type": "code", 243 | "execution_count": null, 244 | "id": "eaa9d0d1-60d8-4725-84e3-afbcfded5a88", 245 | "metadata": { 246 | "scrolled": true, 247 | "tags": [] 248 | }, 249 | "outputs": [], 250 | "source": [ 251 | "from sagemaker.huggingface.model import HuggingFaceModel\n", 252 | "import sagemaker\n", 253 | "\n", 254 | "\n", 255 | "# create Hugging Face Model Class\n", 256 | "huggingface_model = HuggingFaceModel(\n", 257 | " model_data=model_path, # path to your trained SageMaker model\n", 258 | " role=sagemaker.get_execution_role(), # IAM role with permissions to create an endpoint\n", 259 | " transformers_version=\"4.26\", # Transformers version used\n", 260 | " pytorch_version=\"1.13\", # PyTorch version used\n", 261 | " py_version='py39', # Python version used\n", 262 | " entry_point=\"opt/ml/model/inference.py\",\n", 263 | ")\n", 264 | "\n", 265 | "# deploy model to SageMaker Inference\n", 266 | "predictor = huggingface_model.deploy(\n", 267 | " initial_instance_count=1,\n", 268 | " instance_type=\"ml.m5.xlarge\"\n", 269 | ")\n", 270 | "\n" 271 | ] 272 | }, 273 | { 274 | "cell_type": "markdown", 275 | "id": "e1fe3822", 276 | "metadata": {}, 277 | "source": [ 278 | "\n", 279 | "## Invoke the Model\n", 280 | "\n", 281 | "You can invoke the model using the `predict` function." 282 | ] 283 | }, 284 | { 285 | "cell_type": "code", 286 | "execution_count": null, 287 | "id": "e1a8c26f-beae-416d-8233-0bda0ebca4ac", 288 | "metadata": { 289 | "scrolled": true, 290 | "tags": [] 291 | }, 292 | "outputs": [], 293 | "source": [ 294 | "# example request: you always need to define \"inputs\"\n", 295 | "data = {\n", 296 | " \"inputs\": \"Are Agents fully managed?.\"\n", 297 | "}\n", 298 | "\n", 299 | "# request\n", 300 | "predictor.predict(data)" 301 | ] 302 | }, 303 | { 304 | "cell_type": "markdown", 305 | "id": "b27e4d85", 306 | "metadata": {}, 307 | "source": [ 308 | "\n", 309 | "## Compare Predictions\n", 310 | "\n", 311 | "To illustrate the impact of fine-tuning, we can compare the cosine similarity scores between two semantically related sentences using both the original pre-trained model and the fine-tuned model. A higher cosine similarity score indicates that the two sentences are more semantically similar, as their embeddings are closer in the vector space." 312 | ] 313 | }, 314 | { 315 | "cell_type": "code", 316 | "execution_count": null, 317 | "id": "221624b7-acdd-4c31-b7bb-69d41e51c35b", 318 | "metadata": { 319 | "tags": [] 320 | }, 321 | "outputs": [], 322 | "source": [ 323 | "from sentence_transformers import SentenceTransformer, util\n", 324 | "\n", 325 | "pretrained_model = SentenceTransformer(\"sentence-transformers/all-MiniLM-L6-v2\")\n", 326 | "\n", 327 | "\n", 328 | "sentences = [\n", 329 | " \"What are Agents, and how can they be used?\"\n", 330 | " , \n", 331 | " \"Agents for Amazon Bedrock are fully managed capabilities that automatically break down tasks, create an orchestration plan, securely connect to company data through APIs, and generate accurate responses for complex tasks like automating inventory management or processing insurance claims.\"\n", 332 | "]\n", 333 | "\n", 334 | "#Compute embedding for both lists\n", 335 | "embedding_x= pretrained_model.encode(sentences[0], convert_to_tensor=True)\n", 336 | "embedding_y = pretrained_model.encode(sentences[1], convert_to_tensor=True)\n", 337 | "\n", 338 | "util.pytorch_cos_sim(embedding_x, embedding_y)" 339 | ] 340 | }, 341 | { 342 | "cell_type": "code", 343 | "execution_count": null, 344 | "id": "55be0ba2-7647-4e94-b323-1a059f1b1280", 345 | "metadata": { 346 | "tags": [] 347 | }, 348 | "outputs": [], 349 | "source": [ 350 | "from sentence_transformers import SentenceTransformer, util\n", 351 | "\n", 352 | "data1 = {\n", 353 | " \"inputs\": \n", 354 | " \"What are Agents, and how can they be used?\"\n", 355 | "}\n", 356 | "\n", 357 | "data2 = {\n", 358 | " \"inputs\": \n", 359 | " \"Agents for Amazon Bedrock are fully managed capabilities that automatically break down tasks, create an orchestration plan, securely connect to company data through APIs, and generate accurate responses for complex tasks like automating inventory management or processing insurance claims.\"\n", 360 | "}\n", 361 | "\n", 362 | "\n", 363 | "\n", 364 | "el1 = predictor.predict(data1)\n", 365 | "el2 = predictor.predict(data2)\n", 366 | "\n", 367 | "util.pytorch_cos_sim(el1[\"vectors\"], el2[\"vectors\"])\n" 368 | ] 369 | }, 370 | { 371 | "cell_type": "code", 372 | "execution_count": null, 373 | "id": "9e7b4e61-13a0-46e6-beec-5677ba48158a", 374 | "metadata": {}, 375 | "outputs": [], 376 | "source": [] 377 | } 378 | ], 379 | "metadata": { 380 | "kernelspec": { 381 | "display_name": "conda_python3", 382 | "language": "python", 383 | "name": "conda_python3" 384 | }, 385 | "language_info": { 386 | "codemirror_mode": { 387 | "name": "ipython", 388 | "version": 3 389 | }, 390 | "file_extension": ".py", 391 | "mimetype": "text/x-python", 392 | "name": "python", 393 | "nbconvert_exporter": "python", 394 | "pygments_lexer": "ipython3", 395 | "version": "3.10.13" 396 | } 397 | }, 398 | "nbformat": 4, 399 | "nbformat_minor": 5 400 | } 401 | -------------------------------------------------------------------------------- /sentence-transformer/multiple-negatives-ranking-loss/training.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "sentence1": "What is Amazon Bedrock and its key features?", 4 | "sentence2": "Amazon Bedrock is a fully managed service that offers a choice of high-performing foundation models along with a broad set of capabilities for building generative AI applications, simplifying development with security, privacy, and responsible AI features." 5 | }, 6 | { 7 | "sentence1": "How can I get started with using Amazon Bedrock?", 8 | "sentence2": "With the serverless experience of Amazon Bedrock, you can quickly get started by navigating to the service in the AWS console and trying out the foundation models in the playground or creating and testing an agent." 9 | }, 10 | { 11 | "sentence1": "Which foundation models are available on Amazon Bedrock?", 12 | "sentence2": "Amazon Bedrock customers can choose from some of the most cutting-edge foundation models available today, including Anthropic's Claude, AI21 Labs' Jurassic-2, Stability AI's Stable Diffusion, Cohere's Command and Embed, Meta's Llama 2, and the Amazon Titan language and embeddings models." 13 | }, 14 | { 15 | "sentence1": "How does Amazon Bedrock ensure data privacy and security when customizing foundation models?", 16 | "sentence2": "With Amazon Bedrock, you can privately customize foundation models, retaining control over how your data is used and encrypted. Your data, including prompts, supplementary information, model responses, and customized models, remain in the Region where the API call is processed and are never exposed to the public internet or model providers." 17 | }, 18 | { 19 | "sentence1": "What are Agents for Amazon Bedrock, and how can they be used?", 20 | "sentence2": "Agents for Amazon Bedrock are fully managed capabilities that automatically break down tasks, create an orchestration plan, securely connect to company data through APIs, and generate accurate responses for complex tasks like automating inventory management or processing insurance claims." 21 | }, 22 | { 23 | "sentence1": "How does Amazon Bedrock support retrieval-augmented generation (RAG) with Knowledge Bases?", 24 | "sentence2": "With Knowledge Bases for Amazon Bedrock, you can securely connect foundation models to your company's data sources for retrieval-augmented generation, integrating external data to enhance the accuracy and context-awareness of generated content." 25 | }, 26 | { 27 | "sentence1": "What is the Amazon Bedrock Model Evaluation feature, and how does it work?", 28 | "sentence2": "Model Evaluation on Amazon Bedrock allows you to evaluate and compare foundation models using automatic evaluation with predefined metrics or human evaluation workflows for subjective criteria, leveraging built-in or custom datasets." 29 | }, 30 | { 31 | "sentence1": "What are Guardrails for Amazon Bedrock, and how do they help with responsible AI development?", 32 | "sentence2": "Guardrails for Amazon Bedrock enables you to implement safeguards for your generative AI applications based on your use cases and responsible AI policies, helping control interactions by filtering undesirable content, redacting personally identifiable information, and enhancing content safety and privacy." 33 | }, 34 | { 35 | "sentence1": "How does Amazon Bedrock leverage AWS services for generative AI applications?", 36 | "sentence2": "Amazon Bedrock leverages AWS Lambda for invoking actions, Amazon S3 for storing training and validation data, and Amazon CloudWatch for tracking metrics, simplifying the development of enterprise-grade generative AI applications." 37 | }, 38 | { 39 | "sentence1": "What are some common use cases for Amazon Bedrock's generative AI capabilities?", 40 | "sentence2": "Amazon Bedrock supports a wide range of generative AI use cases, including creating new original content, generating realistic and artistic images, providing personalized product recommendations, summarizing textual content, and assisting with tasks like question answering and code generation." 41 | }, 42 | { 43 | "sentence1": "What are the benefits of using AWS services like Lambda and S3 for generative AI applications with Bedrock?", 44 | "sentence2": "Bedrock leverages AWS services like Lambda, S3, and CloudWatch to provide a scalable, serverless experience for generative AI. Serverless computing simplifies the development and deployment of generative AI applications, enabling faster time to market and efficient resource utilization." 45 | }, 46 | { 47 | "sentence1": "How can generative AI models assist with code generation and software development tasks?", 48 | "sentence2": "Generative AI can assist with code generation, automating the development of software applications and scripts. Task automation is a key application area for generative AI, leveraging models to assist with various programming and development tasks, thereby improving productivity and efficiency." 49 | }, 50 | { 51 | "sentence1": "What are some potential risks and ethical considerations associated with generative AI, and how does Bedrock address them?", 52 | "sentence2": "Responsible development of generative AI systems involves addressing ethical considerations, mitigating biases, and ensuring transparency and accountability. Bedrock's Guardrails feature incorporates best practices for responsible AI development, helping to build trustworthy and ethical generative AI applications by detecting biases, filtering inappropriate content, and implementing safeguards like watermarking." 53 | }, 54 | { 55 | "sentence1": "How does Bedrock leverage AWS Lambda for serverless deployment of generative AI applications?", 56 | "sentence2": "Bedrock leverages AWS Lambda to provide a fully serverless experience for deploying and running generative AI applications. Developers can package their models and code as Lambda functions, which can be automatically scaled and executed in response to events or API calls, without the need to manage underlying infrastructure." 57 | }, 58 | { 59 | "sentence1": "What are the benefits of using Amazon S3 for storing and accessing data in Bedrock's generative AI workflows?", 60 | "sentence2": "Amazon S3 (Simple Storage Service) plays a crucial role in Bedrock's generative AI workflows. S3 can be used to store and access large datasets, pre-trained models, and fine-tuned models securely and reliably. Bedrock integrates with S3 to enable efficient data ingestion, retrieval, and storage throughout the generative AI pipeline." 61 | }, 62 | { 63 | "sentence1": "How can Amazon CloudWatch be used for monitoring and observability in Bedrock's generative AI applications?", 64 | "sentence2": "Amazon CloudWatch is a monitoring and observability service that can be integrated with Bedrock's generative AI applications. CloudWatch allows developers to collect and analyze metrics, logs, and other observability data from their applications running on AWS, including Lambda functions and other AWS services used by Bedrock. This enables monitoring performance, detecting issues, and optimizing resources for generative AI workloads." 65 | }, 66 | { 67 | "sentence1": "What are the benefits of using cloud infrastructure for generative AI applications?", 68 | "sentence2": "Generative AI has a wide range of applications across industries, enabled by the flexibility and scalability of cloud infrastructure. Bedrock's serverless architecture and integration with other AWS services simplify the development of enterprise-grade generative AI apps, allowing organizations to leverage the scalability and reliability of the cloud for their generative AI workloads." 69 | }, 70 | { 71 | "sentence1": "How can generative AI models be deployed and scaled in a serverless manner?", 72 | "sentence2": "Bedrock leverages AWS Lambda to provide a fully serverless experience for deploying and running generative AI applications. Developers can package their models and code as Lambda functions, which can be automatically scaled and executed in response to events or API calls, without the need to manage underlying infrastructure. This enables seamless scaling and cost-effective deployment of generative AI models." 73 | }, 74 | { 75 | "sentence1": "What are some best practices for managing and versioning data and models in generative AI pipelines?", 76 | "sentence2": "Bedrock integrates with Amazon S3 (Simple Storage Service) for secure and reliable storage and versioning of data and models used in generative AI pipelines. S3 enables efficient data ingestion, retrieval, and storage throughout the generative AI workflow, allowing developers to manage and version their datasets, pre-trained models, and fine-tuned models in a centralized and durable manner." 77 | }, 78 | { 79 | "sentence1": "How can monitoring and observability be implemented for generative AI applications in a cloud environment?", 80 | "sentence2": "Amazon CloudWatch is a monitoring and observability service that can be integrated with Bedrock's generative AI applications. CloudWatch allows developers to collect and analyze metrics, logs, and other observability data from their applications running on AWS, including Lambda functions and other AWS services used by Bedrock. This enables monitoring performance, detecting issues, andoptimizing resources for generative AI workloads in a cloud environment." 81 | }, 82 | { 83 | "sentence1": "What types of data formats are accepted by Knowledge Bases for Amazon Bedrock?", 84 | "sentence2": "Supported data formats for Knowledge Bases in Amazon Bedrock include .pdf, .txt, .md, .html, .doc and .docx, .csv, .xls, and .xlsx files. Files must be uploaded to Amazon S3, and Knowledge Bases takes care of the entire ingestion workflow into your vector database." 85 | }, 86 | { 87 | "sentence1": "How does Knowledge Bases for Amazon Bedrock chunk the documents before converting them to embeddings?", 88 | "sentence2": "Knowledge Bases for Amazon Bedrock provides three options to chunk text before converting it to embeddings: 1) Automatically split documents into chunks of 200 tokens with 20% overlap, 2) Fixed size chunking based on specified token length and overlap percentage, or 3) Create one embedding per document if pre-processed." 89 | }, 90 | { 91 | "sentence1": "Which embeddings model is used by Knowledge Bases for Amazon Bedrock?", 92 | "sentence2": "At present, Knowledge Bases for Amazon Bedrock uses the latest version of the Titan Text Embeddings model available in Amazon Bedrock. This model supports 8K tokens, 25+ languages, and creates embeddings of 1,536 dimensions." 93 | }, 94 | { 95 | "sentence1": "Which vector databases are supported by Knowledge Bases for Amazon Bedrock?", 96 | "sentence2": "Knowledge Bases for Amazon Bedrock supports popular vector databases like Amazon OpenSearch Serverless vector engine, Pinecone, Redis Enterprise Cloud, Amazon Aurora (coming soon), and MongoDB (coming soon). If you don't have an existing vector database, Bedrock can create an Amazon OpenSearch Serverless vector store for you." 97 | }, 98 | { 99 | "sentence1": "Is it possible to do a periodic or event-driven sync from Amazon S3 to Knowledge Bases for Amazon Bedrock?", 100 | "sentence2": "Depending on your use case, you can use Amazon EventBridge to create a periodic or event-driven sync between Amazon S3 and Knowledge Bases for Amazon Bedrock to keep your data up-to-date." 101 | }, 102 | { 103 | "sentence1": "Against what metrics can I evaluate foundation models using Amazon Bedrock Model Evaluation?", 104 | "sentence2": "You can evaluate a variety of predefined metrics such as accuracy, robustness, and toxicity using automatic evaluations on Amazon Bedrock Model Evaluation. You can also use human evaluation workflows for subjective or custom metrics like friendliness, relevance, style, and alignment to brand voice." 105 | }, 106 | { 107 | "sentence1": "What is the difference between human-based and automatic evaluations in Amazon Bedrock Model Evaluation?", 108 | "sentence2": "Automatic evaluations allow you to quickly narrow down the list of available foundation models against standard criteria like accuracy, toxicity, and robustness. Human-based evaluations are often used to evaluate more nuanced or subjective criteria that require human judgment, such as brand voice, creative intent, and friendliness, where automatic evaluations might not exist." 109 | }, 110 | { 111 | "sentence1": "How does the automatic evaluation method work in Amazon Bedrock Model Evaluation?", 112 | "sentence2": "You can quickly evaluate Bedrock models for metrics like accuracy, robustness, and toxicity by leveraging curated built-in datasets or bringing your own prompt datasets. After sending prompts to the models for inference, the responses are scored with evaluation algorithms for each dimension, and the backend engine aggregates individual scores into summary reports." 113 | }, 114 | { 115 | "sentence1": "How does the human evaluation method work in Amazon Bedrock Model Evaluation?", 116 | "sentence2": "Amazon Bedrock allows you to set up human review workflows with a few clicks, leveraging your in-house employees or an AWS-managed team as reviewers. Humans can review and provide feedback on model responses through an intuitive interface, rating them on various criteria like accuracy, relevance, or style. This method is useful for evaluating subjective criteria that require human judgment and cannot be easily judged by automatic evaluations." 117 | }, 118 | { 119 | "sentence1": "What are the safeguards available in Guardrails for Amazon Bedrock?", 120 | "sentence2": "Guardrails for Amazon Bedrock allows you to define policies like denied topics, content filters for harmful content like hate speech and violence, word filters, and personally identifiable information (PII) redaction to safeguard your generative AI applications based on your use cases and responsible AI policies." 121 | }, 122 | { 123 | "sentence1": "Can I use Guardrails with all available foundation models and tools on Amazon Bedrock?", 124 | "sentence2": "Yes, Guardrails can be used with all large language models available on Amazon Bedrock, including Titan, Anthropic Claude, Meta Llama 2, AI21 Jurassic, and Cohere Command foundation models. It can also be used with fine-tuned foundation models as well as Agents for Amazon Bedrock." 125 | }, 126 | { 127 | "sentence1": "Does AWS offer an intellectual property indemnity for generative AI services like Amazon Bedrock?", 128 | "sentence2": "AWS offers an uncapped intellectual property (IP) indemnity for copyright claims arising from generative output of Amazon Titan models, Amazon CodeWhisperer Professional, and other listed generative AI services. This means customers are protected from third-party claims alleging copyright infringement by the output generated by these services, provided they use the services responsibly and do not disable filtering features." 129 | }, 130 | { 131 | "sentence1": "What is Amazon Titan, and how does it relate to Amazon Bedrock?", 132 | "sentence2": "Exclusive to Amazon Bedrock, the Amazon Titan family of models incorporates Amazon's 25 years of experience in AI and machine learning. Amazon Titan foundation models provide customers with high-performing image, multimodal, and text model choices via a fully managed API, offering powerful, general-purpose models that can be used as-is or privately customized with your own data." 133 | }, 134 | { 135 | "sentence1": "What is continued pre-training, and how is it supported in Amazon Bedrock?", 136 | "sentence2": "Bedrock's Continued Pre-training feature allows further customizing foundation models with your own data for improved generative AI performance by adapting the base model to domain-specific data. This enables building models for specific domains while preserving the capabilities of the base model." 137 | }, 138 | { 139 | "sentence1": "What are the benefits of continued pre-training in Amazon Bedrock?", 140 | "sentence2": "Continued pre-training on domain-specific data can improve the performance and relevance of generative AI models for specialized tasks. It enables adapting the base model to a new domain using unlabeled data, reducing the need for large amounts of labeled data and long training durations during fine-tuning." 141 | }, 142 | { 143 | "sentence1": "How do I use the continued pre-training feature in Amazon Bedrock?", 144 | "sentence2": "To create a continued pre-training job in Bedrock, navigate to the 'Custom Models' section in the console, select 'Continued Pre-training' from the 'Customize Model' dropdown, and provide the source model, input data, hyperparameters, and other details like model encryption and resource policies." 145 | }, 146 | { 147 | "sentence1": "How does the continued pre-training feature relate to other AWS services in Amazon Bedrock?", 148 | "sentence2": "Bedrock's continued pre-training and fine-tuning features have similar requirements, so they use unified APIs that support standard AWS features like CloudWatch Event Bridge for tracking long-running jobs, S3 integration for fetching training data, resource tags, and model encryption." 149 | }, 150 | { 151 | "sentence1": "What SDKs are supported for Amazon Bedrock?", 152 | "sentence2": "Amazon Bedrock supports SDKs for runtime services, including iOS and Android SDKs, as well as Java, JavaScript, Python, CLI, .NET, Ruby, PHP, Go, and C++ SDKs. Both text and speech input are supported across all SDKs." 153 | }, 154 | { 155 | "sentence1": "What SDKs support streaming functionality in Amazon Bedrock?", 156 | "sentence2": "Streaming functionality is supported on all the SDKs available for Amazon Bedrock, enabling real-time processing of input data streams for generative AI applications." 157 | }, 158 | { 159 | "sentence1": "How much does Amazon Bedrock cost?", 160 | "sentence2": "Please refer to the Amazon Bedrock Pricing Page for the currentpricing information for Amazon Bedrock." 161 | }, 162 | { 163 | "sentence1": "What support is provided for Amazon Bedrock?", 164 | "sentence2": "Depending on your AWS support contract, Amazon Bedrock is supported under Developer Support, Business Support, and Enterprise Support plans, providing varying levels of technical assistance and response times." 165 | }, 166 | { 167 | "sentence1": "How can I track the input and output tokens in Amazon Bedrock?", 168 | "sentence2": "You can use Amazon CloudWatch metrics to track the input and output token counts for your Bedrock applications, enabling monitoring and optimization of resource usage." 169 | }, 170 | { 171 | "sentence1": "How can I securely use my data to customize foundation models available through Amazon Bedrock?", 172 | "sentence2": "With Amazon Bedrock, you can privately customize foundation models, retaining control over how your data is used and encrypted. Bedrock makes a separate copy of the base model and trains this private copy with your data. Your data, including prompts, supplementary information, model responses, and customized models, remain in the Region where the API call is processed and are never exposed." 173 | }, 174 | { 175 | "sentence1": "How does Amazon Bedrock ensure my data used in fine-tuning remains private and confidential?", 176 | "sentence2": "When fine-tuning a model on Amazon Bedrock, your data is never exposed to the public internet, never leaves the AWS network, is securely transferred through your VPC, and is encrypted in transit and at rest. Bedrock enforces the same AWS access controls and encryption as other AWS services." 177 | }, 178 | { 179 | "sentence1": "Will AWS and third-party model providers use customer inputs or outputs from Amazon Bedrock to train models?", 180 | "sentence2": "No, AWS and the third-party model providers will not use any inputs to or outputs from Bedrock to train Amazon Titan or any third-party models. Your data remains private and confidential." 181 | }, 182 | { 183 | "sentence1": "Where can I learn more about data processed to develop and train Amazon Titan foundation models?", 184 | "sentence2": "To learn more about the data processed to develop and train Amazon Titan foundation models, you can visit the Amazon Titan Model Training & Privacy page, which provides detailed information on the data sources, processing, and privacy practices." 185 | }, 186 | { 187 | "sentence1": "What are the most common generative AI use cases that can be explored with Amazon Bedrock?", 188 | "sentence2": "Some of the most common generative AI use cases that can be explored with Amazon Bedrock include creating new pieces of original content like stories, essays, and social media posts; generating realistic and artistic images from language prompts; providing more relevant and personalized product recommendations; summarizing textual content; and assisting with tasks like question answering and code generation." 189 | }, 190 | { 191 | "sentence1": "How can I get hands-on experience with Amazon Bedrock?", 192 | "sentence2": "You can gain hands-on experience with Amazon Bedrock by exploring the common generative AI use cases through the Amazon Bedrock Workshop or by following the step-by-step tutorial video provided by AWS." 193 | }, 194 | { 195 | "sentence1": "What resources are available to learn more about AWS and generative AI?", 196 | "sentence2": "AWS provides various resources to learn more about its services and generative AI, including the AWS website, documentation, blogs, press releases, training and certification programs, solutions library, architecture center, product and technical FAQs, analyst reports, and partner resources." 197 | }, 198 | { 199 | "sentence1": "How can developers get started with AWS and generative AI?", 200 | "sentence2": "Developers can get started with AWS and generative AI by exploring the Developer Center, SDKs & Tools, and language-specific resources like .NET on AWS, Python on AWS, Java on AWS, PHP on AWS, and JavaScript on AWS. They can also seek expert help, file support tickets, and leverage the AWS knowledge center and community resources." 201 | }, 202 | { 203 | "sentence1": "What is the difference between fine-tuning and continued pre-training in Amazon Bedrock?", 204 | "sentence2": "Fine-tuning involves adapting a pre-trained foundation model to a specific task or domain using labeled data, while continued pre-training further trains the base model on unlabeled, domain-specific data to improve its performance before fine-tuning on labeled data." 205 | }, 206 | { 207 | "sentence1": "How can I integrate Amazon Bedrock with my existing applications and infrastructure?", 208 | "sentence2": "Amazon Bedrock can be seamlessly integrated with your existing applications and infrastructure using AWS services and SDKs. You can leverage AWS Lambda, Amazon S3, and other services to build generative AI capabilities into your applications and workflows." 209 | }, 210 | { 211 | "sentence1": "What security measures are in place to protect customer data in Amazon Bedrock?", 212 | "sentence2": "Amazon Bedrock implements various security measures, including data encryption at rest and in transit, access controls, private connectivity via AWS PrivateLink, and compliance with standards like SOC, ISO, HIPAA, and GDPR, to protect customer data and ensure privacy and security." 213 | }, 214 | { 215 | "sentence1": "How can I collaborate with others on generative AI projects using Amazon Bedrock?", 216 | "sentence2": "Amazon Bedrock supports collaboration by allowing you to share customized foundation models, agents, and other resources with team members or across your organization. You can also leverage AWS Identity and Access Management (IAM) for access control and permissions management." 217 | }, 218 | { 219 | "sentence1": "What are some advanced techniques for optimizing generative AI models in Amazon Bedrock?", 220 | "sentence2": "Advanced techniques for optimizing generative AI models in Amazon Bedrock include hyperparameter tuning, transfer learning, ensemble methods, domain adaptation, and incorporating external knowledge sources or constraints to improve performance, accuracy, and robustness." 221 | }, 222 | { 223 | "sentence1": "How can I monitor and manage the performance of my generative AI applications built with Amazon Bedrock?", 224 | "sentence2": "Amazon Bedrock integrates with Amazon CloudWatch, allowing you to monitor metrics, logs, and observability data for your generative AI applications. You can track performance, detect issues, and optimize resources based on this monitoring data." 225 | }, 226 | { 227 | "sentence1": "What are some best practices for developing and deploying generative AI applications with Amazon Bedrock?", 228 | "sentence2": "Best practices for developing and deploying generative AI applications with Amazon Bedrock include following responsible AI principles, implementing guardrails and safeguards, conducting thorough testing and evaluation, monitoring performance and security, and ensuring compliance with relevant regulations and standards." 229 | }, 230 | { 231 | "sentence1": "How can I ensure the responsible and ethical development of generative AI applications with Amazon Bedrock?", 232 | "sentence2": "To ensure responsible and ethical development of generative AI applications with Amazon Bedrock, you can leverage features like Guardrails for content filtering and bias detection, follow AI ethics guidelines and principles, conduct risk assessments, and implement appropriate governance and oversight mechanisms." 233 | }, 234 | { 235 | "sentence1": "What resources are available to learn more about Amazon Bedrock and generative AI best practices?", 236 | "sentence2": "AWS provides various resources to learn more about Amazon Bedrock and generative AI best practices, including documentation, whitepapers, blog posts, webinars, and training courses. Additionally, you can engage with the AWS Partner Network and community forums for further guidance and support." 237 | }, 238 | { 239 | "sentence1": "How can I stay up-to-date with the latest developments and updates related to Amazon Bedrock and generative AI?", 240 | "sentence2": "To stay up-to-date with the latest developments and updates related to Amazon Bedrock and generative AI, you can subscribe to AWS news and announcements, follow AWS social media channels, attend AWS events and conferences, and engage with the AWS community and partner ecosystem." 241 | }, 242 | { 243 | "sentence1": "What are some potential future enhancements or roadmap items for Amazon Bedrock's generative AI capabilities?", 244 | "sentence2": "Potential future enhancements or roadmap items for Amazon Bedrock's generative AI capabilities may include support for more advanced model architectures, expanded language and modality support, improved integration with other AWS services, enhanced customization and fine-tuning capabilities, and continued advancements in responsible AI and security features." 245 | }, 246 | { 247 | "sentence1": "How can I provide feedback or request new features for Amazon Bedrock?", 248 | "sentence2": "You can provide feedback or request new features for Amazon Bedrock by contacting AWS Support, engaging with the AWS Developer Forums, or reaching out to your AWS account representative or solution architect. AWS values customer feedback and input for improving its services and capabilities." 249 | }, 250 | { 251 | "sentence1": "What are some common challenges or limitations when working with generative AI models, and how does Amazon Bedrock help address them?", 252 | "sentence2": "Common challenges when working with generative AI models include data quality and availability, model bias and fairness, computational resources and scalability, interpretability and transparency, and security and privacy concerns. Amazon Bedrock helps address these challenges through its managed infrastructure, responsible AI features, customization capabilities, and integration with AWS services and best practices." 253 | }, 254 | { 255 | "sentence1": "How can I leverage Amazon Bedrock for multi-modal generative AI applications involving text, images, and other modalities?", 256 | "sentence2": "Amazon Bedrock supports multi-modal generative AI applications by offering a choice of foundation models for text, images, and other modalities, such as the Amazon Titan language and embeddings models and Stability AI's Stable Diffusion. You can combine these models or leverage their multi-modal capabilities for tasks like image generation from text prompts or captioning images with text." 257 | }, 258 | { 259 | "sentence1": "What are some industry-specific use cases or applications of generative AI that can be explored with Amazon Bedrock?", 260 | "sentence2": "Amazon Bedrock's generative AI capabilities can be applied to various industry-specific use cases, such as generating medical reports and patient education materials in healthcare, automating legal document generation and analysis in law, creating personalized financial reports and insights in finance, and generating creative content like scripts, stories, and advertising copy in media and entertainment." 261 | }, 262 | { 263 | "sentence1": "How can I leverage Amazon Bedrock's generative AI capabilities for natural language processing (NLP) tasks like text summarization, translation, and sentiment analysis?", 264 | "sentence2": "Amazon Bedrock offers foundation models like the Amazon Titan language models and Anthropic's Claude that can be fine-tuned for various NLP tasks, including text summarization, translation, sentiment analysis, and other language understanding and generation tasks. You can also leverage Bedrock's retrieval-augmented generation capabilities to enhance NLP performance." 265 | }, 266 | { 267 | "sentence1": "What are some best practices for managing and scaling generative AI workloads with Amazon Bedrock in an enterprise environment?", 268 | "sentence2": "Best practices for managing and scaling generative AI workloads with Amazon Bedrock in an enterprise environment include leveraging AWS's scalable and secure infrastructure, implementing robust governance and access controls, monitoring and optimizing resource usage, integrating with existing enterprise systems and workflows, and following best practices for model lifecycle management and deployment." 269 | }, 270 | { 271 | "sentence1": "How can I leverage Amazon Bedrock's generative AI capabilities for creative and artistic applications, such as storytelling, poetry, and music generation?", 272 | "sentence2": "Amazon Bedrock supports creative and artistic applications of generative AI through its foundation models for text and image generation. You can leverage these models for tasks like story generation, poetry composition, script writing, and creating artistic images and visuals from language prompts. The Bedrock Chat Playground also allows you to experiment with these creative use cases." 273 | }, 274 | { 275 | "sentence1": "How can I use Amazon Bedrock's generative AI capabilities for data augmentation and synthetic data generation?", 276 | "sentence2": "Amazon Bedrock's foundation models can be leveraged for data augmentation and synthetic data generation tasks, creating new diverse and realistic data samples to supplement existing datasets. This can be especially valuable in domains with limited data availability or for enhancing the robustness and generalization of machine learning models." 277 | }, 278 | { 279 | "sentence1": "What are some potential use cases for generative AI in cybersecurity and threat detection that could be explored with Amazon Bedrock?", 280 | "sentence2": "Potential use cases for generative AI in cybersecurity and threat detection with Amazon Bedrock include generating realistic simulated attack data for training security models, automating the creation of security advisories and incident response documentation, and leveraging language models for threat intelligence analysis and cyber threat hunting." 281 | }, 282 | { 283 | "sentence1": "How can I leverage Amazon Bedrock's generative AI capabilities for conversational AI and virtual assistant applications?", 284 | "sentence2": "Amazon Bedrock's foundation models, such as Anthropic's Claude and the Amazon Titan language models, can be fine-tuned for conversational AI and virtual assistant applications. You can leverage their natural language understanding and generation capabilities, as well as the Bedrock Chat Playground, to create engaging and intelligent conversational experiences." 285 | }, 286 | { 287 | "sentence1": "What are some potential applications of generative AI in scientific research and academia that could be enabled by Amazon Bedrock?", 288 | "sentence2": "Potential applications of generative AI in scientific research and academia with Amazon Bedrock include generating research papers and literature reviews, synthesizing and summarizing scientific findings, creating educational content and study materials, and assisting with data analysis and hypothesis generation tasks." 289 | }, 290 | { 291 | "sentence1": "How can I integrate Amazon Bedrock's generative AI capabilities with other AWS services and machine learning workflows?", 292 | "sentence2": "Amazon Bedrock can be integrated with various other AWS services and machine learning workflows, such as Amazon SageMaker for model training and deployment, AWS Lambda for serverless computing, Amazon Comprehend for natural language processing, and AWS IoT for intelligent edge devices, enabling end-to-end generative AI solutions." 293 | }, 294 | { 295 | "sentence1": "What are some best practices for managing and versioning generative AI models and their outputs in Amazon Bedrock?", 296 | "sentence2": "Best practices for managing and versioning generative AI models and their outputs in Amazon Bedrock include leveraging AWS services like Amazon S3 for storage and version control, implementing access controls and audit trails, maintaining model lineage and provenance information, and following data governance and compliance guidelines." 297 | }, 298 | { 299 | "sentence1": "How can I leverage Amazon Bedrock's generative AI capabilities for personalization and recommendation systems?", 300 | "sentence2": "Amazon Bedrock's generative AI models can be used to create personalized content, product descriptions, recommendations, and summaries tailored to individual user preferences and contexts. This can enhance the user experience and drive engagement in e-commerce, media, and other applications that require personalized content." 301 | }, 302 | { 303 | "sentence1": "What are some potential applications of generative AI in the gaming industry that could be enabled by Amazon Bedrock?", 304 | "sentence2": "Potential applications of generative AI in the gaming industry with Amazon Bedrock include generating realistic game assets and environments, creating dynamic and interactive narratives and storylines, enhancing non-player character (NPC) interactions and dialogue, and generating procedural content for game levels and challenges." 305 | }, 306 | { 307 | "sentence1": "How can I leverage Amazon Bedrock's generative AI capabilities for content moderation and filtering applications?", 308 | "sentence2": "Amazon Bedrock's foundation models and Guardrails feature can be used for content moderation and filtering applications, enabling the detection and filtering of harmful, offensive, or inappropriate content. This can be valuable for social media platforms, online communities, and other applications that require content moderation." 309 | }, 310 | { 311 | "sentence1": "What are some potential use cases for generative AI in the manufacturing and industrial sectors that could be explored with Amazon Bedrock?", 312 | "sentence2": "Potential use cases for generative AI in the manufacturing and industrial sectors with Amazon Bedrock include generating technical documentation and manuals, automating report writing and data analysis tasks, creating virtual training and simulation environments, and assisting with predictive maintenance and fault diagnosis." 313 | }, 314 | { 315 | "sentence1": "How can I leverage Amazon Bedrock's generative AI capabilities for knowledge management and information retrieval applications?", 316 | "sentence2": "Amazon Bedrock's Knowledge Bases feature and retrieval-augmented generation capabilities can be leveraged for knowledge management and information retrieval applications. This includes indexing and searching large document repositories, generating summaries and insights from unstructured data, and providing context-aware information retrieval and question answering." 317 | }, 318 | { 319 | "sentence1": "What are some potential applications of generative AI in the field of education and e-learning that could be enabled by Amazon Bedrock?", 320 | "sentence2": "Potential applications of generative AI in education and e-learning with Amazon Bedrock include generating personalized learning materials and study guides, creating interactive educational content and simulations, automating grading and feedback processes, and enabling intelligent tutoring systems and virtual teaching assistants." 321 | }, 322 | { 323 | "sentence1": "How can I leverage Amazon Bedrock's generative AI capabilities for text style transfer and content transformation tasks?", 324 | "sentence2": "Amazon Bedrock's foundation models can be fine-tuned for text style transfer and content transformation tasks, enabling the conversion of text from one style or format to another. This can be useful for applications like simplifying complex text, translating between formal and informal styles, or transforming content between different genres or domains." 325 | }, 326 | { 327 | "sentence1": "What are some potential use cases for generative AI in the field of social sciences and humanities that could be explored with Amazon Bedrock?", 328 | "sentence2": "Potential use cases for generative AI in the field of social sciences and humanities with Amazon Bedrock include generating research papers and literature reviews, analyzing and summarizing qualitative data, creating educational and informative content, and assisting with text analysis and interpretation tasks in fields like history, philosophy, and cultural studies." 329 | }, 330 | { 331 | "sentence1": "How can I leverage Amazon Bedrock's generative AI capabilities for creative writing and storytelling applications?", 332 | "sentence2": "Amazon Bedrock's foundation models for text generation can be leveraged for creative writing and storytelling applications, enabling the generation of original stories, narratives, character dialogues, and plot elements. The Bedrock Chat Playground also allows for interactive storytelling experiences using generative AI." 333 | }, 334 | { 335 | "sentence1": "What are some potential applications of generative AI in the field of journalism and media that could be enabled by Amazon Bedrock?", 336 | "sentence2": "Potential applications of generative AI in the field of journalism and media with Amazon Bedrock include generating news articles and reports, summarizing and curating content from various sources, creating personalized news feeds and content recommendations, and assisting with research and fact-checking tasks." 337 | }, 338 | { 339 | "sentence1": "How can I leverage Amazon Bedrock's generative AI capabilities for marketing and advertising applications?", 340 | "sentence2": "Amazon Bedrock's generative AI models can be used for marketing and advertising applications, such as generating personalized and engaging marketing copy, creating product descriptions and advertising content, developing targeted ad campaigns and messaging, and analyzing consumer sentiment and feedback." 341 | } 342 | ] 343 | --------------------------------------------------------------------------------