AWS Public Sector Blog

Leverage generative AI for biocuration using Amazon Bedrock and Amazon Nova foundation models

AWS branded background design with text overlay that says "Leverage generative AI for biocuration using Amazon Bedrock and Amazon Nova foundation models "

Personalized therapy for diseases such as cancer utilizes an individual’s unique genomic profile to guide treatment decisions. However, the effect and clinical significance of most genetic variants are uncertain. Accurate classification of the clinical significance of novel genetic variants requires extensive curation of peer-reviewed biomedical literature. When reviewing these articles, scientists must extract information regarding genetic-disease-drug associations to inform variant classification. But, with the thousands of new articles published each year, scientists tasked with reviewing the literature face a significant challenge in identifying meaningful genetic-disease-drug relationships.

In recent years, generative artificial intelligence (AI) has demonstrated promising results in information extraction and text summarization. However, the broad adoption of large language models (LLMs) faces several barriers, including data privacy concerns, the risk of hallucination, and the high cost of training and inference. In this post, we will explore how various Amazon Web Services (AWS) solutions can be used to create a secure, retrieval-augmented, and cost-effective biomedical chatbot designed to facilitate biocuration.

Building a comprehensive knowledge base

The development of comprehensive knowledge bases is crucial for LLMs to enable evidence-based responses and minimize hallucination. This is particularly critical in the biomedical domain, where information accuracy directly impacts personalized therapeutic decisions.

The exponential growth of biomedical research has rendered traditional manual curation methods increasingly insufficient. The solution we will discuss in this post aims to simplify and streamline this process through automated information extraction. The approach adopts a summary chunking method, through which medical article content is processed by a foundation model to extract important and relevant information. To maintain scientific rigor and enable verification, each generated summary includes the source article’s unique identifier, allowing scientists to identify the original source of the information and validate the responses of the chatbot.

Figure 1. Architecture for automated biocuration data ingestion and processing on AWS. The major components are Amazon EventBridge, AWS Fargate, Amazon Elastic Container Service, Amazon DynamoDB, Amazon Simple Queue Service, AWS Lambda, Amazon Bedrock, and an Amazon Simple Storage Service bucket.

The steps for automated biocuration data ingestion and processing—shown in the preceding diagram—are as follows:

  1. Trigger event: The process begins with a trigger event, which can be anything from a change in a database to a new file being uploaded to Amazon Simple Storage Service (S3). This event is triggered by an Amazon EventBridge rule, a serverless event bus that allows you to react to changes in your AWS resources. Alternatively, EventBridge Scheduler can be used to set up a recurring job.
  2. Curate articles from relevant sources: The trigger event initiates a task on Amazon Elastic Container Service (Amazon ECS), a container orchestration service that allows you to run containers on AWS. With AWS Fargate, a serverless compute engine for containers, you can run containers without managing the underlying infrastructure.
  3. Store curated article IDs and abstracts: The curated article IDs and abstracts are stored in a table on Amazon DynamoDB, a NoSQL-database service that allows you to store and retrieve key-value data.
  4. Message queue for buffering: The curated article IDs are sent to a queue on Amazon Simple Queue Service (SQS), a message queue service that enables you to buffer messages before they are processed further.
  5. Retry mechanism: Jobs that fail are placed in an Amazon SQS Dead Letter Queue, a type of SQS queue that allows you to retry failed jobs.
  6. Summarize article content: The article IDs in the Amazon SQS queue are processed by AWS Lambda, a serverless compute service that gives you the ability to run code without managing the underlying infrastructure. The Lambda function retrieves the article content from external sources, and uses Amazon Nova—a foundation model (FM) available on Amazon Bedrock—to analyze and summarize the article content. By sending the article text to Amazon Bedrock’s API, the Lambda function leverages LLMs to generate concise and relevant summaries while maintaining the key points and context of the original article.
  7. Store article summaries: The summarized articles are then stored in an Amazon DynamoDB database.
  8. Store final summaries: Finally, the summarized articles are stored in a bucket on Amazon S3. These files will then serve as a data source for Amazon Bedrock Knowledge Bases, a managed Retrieval-Augmented Generation (RAG) solution that streamlines the process of connecting your data with foundation models, eliminating the need to build and maintain complex RAG implementations from scratch.

The summaries generated are stored in an Amazon S3 bucket, which is configured as a data source for Amazon Bedrock Knowledge Bases. Amazon Bedrock Knowledge Bases processes these documents by retrieving them from Amazon S3, performing content chunking, and transforming the segments into vector embeddings using an embedding model (Amazon Titan Text Embedding v2). These processed embeddings, along with their metadata and original text references, are then stored in the vector store. The synchronization of this data can be managed in real time, scheduled at specific intervals, or executed manually through either the console or the Bedrock API endpoints.

Building a secure and efficient biocuration assistant

The solution leverages AWS serverless services to create a comprehensive biocuration assistant.

Figure 2. Architecture for serverless biocuration knowledge base with AWS Amplify and Amazon Bedrock. The other major components are AWS Amazon Cognito, AWS AppSync, AWS Lambda, Amazon DynamoDB, Amazon CloudFront, an Amazon S3 bucket, and Amazon OpenSearch Serverless.

The architecture—which is shown in the preceding diagram—consists of:

  1. Secure user authentication: Users authenticate through Amazon Cognito, which provides secure sign-up, sign-in, and access control. This ensures a seamless and secure entry point for the application.
  2. Scalable serverless backend: AWS Amplify manages the backend, incorporating AWS AppSync for GraphQL API management, Amazon DynamoDB for NoSQL data storage, and AWS Lambda for serverless compute. With this combination, developers can efficiently manage APIs and data operations and seamlessly scale their applications while focusing on building core features—all without worrying about managing the underlying infrastructure.
  3. Frontend solution: The user interface is built with ReactJS, hosted on Amazon S3 for reliable object storage, and distributed globally via the Amazon CloudFront content delivery network (CDN).
  4. Generative AI functionality: The solution integrates Amazon Bedrock, offering foundation models via API, enabling generative AI capabilities without managing complex infrastructure. By utilizing Amazon Bedrock Flows—a service that enables the creation of multi-step AI workflows—the system implements a fixed workflow for the generative AI pipeline, providing a standardized and predictable flow. This approach fosters consistency in processing user inputs, interacting with the knowledge base, and generating final prompts—which makes the generative AI application more reliable and easier to maintain. Version control implemented in Amazon Bedrock Flows also allows the rapid and reproducible prototyping of the AI workflow.Additionally, the application leverages the Amazon Bedrock Knowledge Bases, a fully managed service for building and querying vector databases, to provide support for end-to-end RAG workflows. This streamlines the process of retrieving relevant information from external sources and incorporating it into the generative AI pipeline.

Cost and agility are two major considerations in the development and deployment of any generative AI application. We were able to reduce the infrastructural cost by extensively leveraging various serverless solutions such as AWS Lambda. However, the cost of inference is also significant when deploying generative AI applications. LLMs, while being able to perform various tasks, cost significantly more than smaller language models, which often show comparable performance in specific tasks.

We chose to use Amazon Nova Lite for our solution due to its lower latency (resulting in faster response time) and lower cost per token compared to other language models. Through extensive prompt and workflow engineering, we were able to generate context-aware and accurate responses using the more cost-effective Amazon Nova models.

Key to the rapid prototyping and deployment of our solution is the ability to use low-code no-code solutions to orchestrate workflows. Amazon Bedrock Flow provided us with a point-and-click interface for workflow engineering, significantly reducing the time-to-prototyping by eliminating the need to write code using other programming frameworks. In addition, Amazon Bedrock Flows simplified the development of tailored workflows by providing a graphic user interface that allowed the intuitive visualization of the workflow.

When a user submits a query, Bedrock Flows orchestrates a process that involves:

  1. Capturing user input
  2. Enriching it with relevant context from the knowledge base
  3. Leveraging Nova Lite to generate an accurate, context-aware response based on the user’s query

This approach enables a more personalized and effective interaction between the user and the application, ultimately enhancing the overall user experience.

The following diagram provides an example of Bedrock Flows activities.

Figure 3. Sample input and output of the Amazon Bedrock Flows for biocuration query processing.

Conclusion

By leveraging generative AI and RAG, the solution that we discussed in this post can be a valuable addition to the toolkit of biocurators, who must always keep abreast of the latest developments in biomedical research. By being able to automatically summarize the latest scientific findings at scale and facilitate literature prioritization, this solution can support geneticists in making more informed, evidence-based decisions about genetic variants and their clinical implications. Additionally, the modularity of our workflow gives us the ability to easily incorporate newer models and RAG approaches in the future. Finally, the cost-effectiveness of the solution reduces the barrier to entry for teams that are interested in adopting generative AI for biocuration.

Looking ahead, we will strive to continuously improve the solution’s capabilities by developing new features and enhancements. For example, we are creating robust guardrails that will help promote responsible and ethical AI usage. We are also exploring other data engineering approaches to improve the quality of data used in constructing the knowledge base. Additionally, we intend to extend this framework to other domains, fostering improved productivity across various fields of interest.

Contact an AWS representative to learn how we can help accelerate your generative AI use cases.

Jeremy Ng

Jeremy Ng

Dr. Jeremy Ng is a senior bioinformatician in the Division of Pathology at Singapore General Hospital (SGH). He completed his doctoral training at the National University of Singapore, where he studied the determinants of transforming growth factor-beta signaling (TGFB) outcome. He has been with SGH since September 2020, working in the oncology space.

Eugene Ng

Eugene Ng

Eugene is a solutions architect at Amazon Web Services (AWS), with a primary focus on the healthcare industry. He enjoys exploring and implementing new technologies, aiming to support AWS customers in their innovation journey within the healthcare domain.

Susanna Cheu

Susanna Cheu

Susanna is an Amazon Web Services (AWS) account manager for public sector healthcare in Singapore. She has worked in healthcare and IT for more than 20 years, including strategy, business development, and program management. Susanna helps customers envision and deliver on digital enabled transformations to drive meaningful business outcomes for their stakeholders, including patients.