AWS for Industries

Accelerate Semiconductor machine learning initiatives with Amazon Bedrock

The semiconductor industry, known for its intricate manufacturing processes, generates a vast amount of sensor data crucial for analytics and machine learning. However, due to legacy systems and complex data infrastructure, collecting this data in real-time and at scale can be a challenging task. This blog post explains some challenges faced by the semiconductor industry regarding data collection and how Amazon Web Services (AWS) is developing services, like Amazon Bedrock, to address them.

Data collection challenges

Manufacturing processes generate large amounts of sensor data that can be used for analytics and machine learning models. However, this data may contain sensitive or proprietary information that cannot be shared openly. Synthetic data allows the distribution of realistic example datasets that preserve the statistical properties and relationships in the real data, without exposing confidential information. This enables more open research and benchmarking on representative data. Additionally, synthetic data can augment real datasets to provide more training examples for machine learning algorithms to generalize better. Data augmentation with synthetic manufacturing data can help improve model accuracy and robustness. Overall, synthetic data enables sharing, enhanced research abilities, and expanded applications of AI in manufacturing while protecting data privacy and security.

The adoption of synthetic data generation with  Amazon Bedrock provides a distinct advantage in building machine learning models. By rapidly generating synthetic datasets that mirror the statistical properties of real data, semiconductor companies can accelerate their machine learning initiatives while overcoming the challenges posed by their legacy systems. It’s a strategic approach that not only addresses industry-specific hurdles, but can be seamlessly applied to revolutionize data practices across various other sectors.

Amazon Bedrock is a fully managed service that offers a choice of high-performing foundation models (FMs) from leading Artificial Intelligence (AI) companies like AI21 Labs, Anthropic, Cohere, Meta, Stability AI, and Amazon via a single API, along with a broad set of capabilities you need to build generative AI applications with security, privacy, and responsible AI. Using Amazon Bedrock, you can easily experiment with and evaluate top FMs for your use case, privately customize them with your data using techniques such as fine-tuning and Retrieval Augmented Generation (RAG), and build agents that execute tasks using your enterprise systems and data sources. Since Amazon Bedrock is serverless, you don’t have to manage any infrastructure, and you can securely integrate and deploy generative AI capabilities into your applications using the AWS services you are already know.

Solution Overview

In the architecture above, Amazon Bedrock takes center stage as the primary catalyst for synthetic data generation. However, to streamline the process and empower users to tailor their experience—whether in another industry, adjusting the number of generated machines, or accommodating different users—we employ a suite of additional services. The following explains the sequence of actions within the architecture, offering a straightforward explanation of the purpose of each service. See how you can setup a similar solution.

1. User-Initiated AWS Lambda Function:

Parameters:

    • industry: Specifies the industry for data generation (e.g., semiconductor).
    • number: Defines the quantity of shopfloor machines to be generated (recommended at 10).
    • user_id: Represents either an authentic user or a pseudonymous ID (e.g., michael-wallner).

2. AWS Lambda Leveraging Amazon Bedrock: Utilizes Amazon Bedrock to generate a list of machines, prompted by:

Generate a NUMBERED list of at least {number} different {industry} manufacturing machines.
IMPORTANT: Fence the list with '```'. DO NOT add any explanations, only the machine name.

3. AWS Lambda Writing to Amazon DynamoDB:

  • Stores the generated machine list and user_id in an Amazon DynamoDB table.
  • Sets an active flag, signaling AWS CodeBuild to process the specific request.

4. AWS Lambda Triggering AWS CodePipeline: Initiates an AWS CodePipeline with two key steps:

  • Source Code Retrieval: Accesses solution code through AWS CodeCommit.
  • Build Process Execution: Utilizes AWS CodeBuild to:
    • Extract active machine signals from Amazon DynamoDB.
    • Employ Amazon Bedrock to generate Python code for synthetic data creation.
    • Execute the Python code for data generation.
    • Store the generated data in an Amazon Simple Storage Service (S3) bucket.

5. Prompt Example for Amazon Bedrock:

  • Draws inspiration from Amazon Bedrock console examples, guiding users to write high-quality scripts tailored to specific tasks.
  • The specific prompt used in this use case is listed below:

Write a high-quality {language} script for the following task, something a {context} {language} expert would write. You are writing code for an experienced developer so only add comments for things that are non-obvious. Make sure to include any imports required.

NEVER write anything before the ```{language}``` block. After you are done generating the code and after the ```{language}``` block, check your work VERY CAREFULLY to make sure there are no mistakes, errors, or inconsistencies. It's IMPORTANT that if there are ERRORS, LIST THOSE ERRORS in <error> tags, then GENERATE a new version with those ERRORS FIXED. If there are no errors, write "CHECKED: NO ERRORS" in <error> tags.

Here is the task:
<task>
* Write code to generate synthetic {question} data using ACTUAL and REALISTIC physical signal names and values
* Add some occasional anomalies to the signals that are created
* The first column is `Timestamp` in the format `yyyy-MM-dd HH:mm:ss`
* The `Timestamp` is collected every minute and the dataset should span an entire year
* Write a `main` function that executes the data generation and saves the entire data to local disk. Make sure the file contains the headers!
* Use object-oriented programming for all code and add docstrings
</task>

Where language is the programming language to use, the context is set to skilled developer and the question is the machine name used for synthetic data generation.

6. Amazon S3 Bucket for Data Storage:

  • Tailored for each user_id, this bucket serves as a repository for machine-generated data.
  • Offers utility in machine learning endeavors, including applications like Amazon Lookout for Equipment for automated anomaly detection.

This comprehensive approach, while exemplified within the semiconductor industry, holds the potential to revolutionize data practices across diverse sectors. By combining the capabilities of Amazon Bedrock with a thoughtful orchestration of AWS services, this solution demonstrates a practical pathway for users seeking to harness the power of synthetic data generation in their machine learning endeavors.

Deploying the solution

If you intend to deploy the complete solution and integrate it into your applications, begin by downloading the corresponding GitHub repository. To ensure a seamless deployment, adhere to the following prerequisites:

  • AWS Account: A valid AWS account is required.
  • AWS User Permissions: An AWS user with a minimum of PowerUserAccess rights should be in place.
  • AWS CDK Installation: Ensure the AWS Cloud Development Kit (CDK) is installed.
  • Python Version: The code necessitates Python version 3.10 or above.
  • Recommended Region: We recommend deploying the solution in us-east-1.

Upon downloading the code from GitHub and navigating to the amazon-bedrock-synthetic-data-generator folder, proceed with the following steps:

  1. Create a virtual environment in Python: python3 -m venv .venv
  2. Activate the virtual environment: source .venv/bin/activate
  3. Install the required libraries: pip install -r requirements.txt
  4. Synthesize the CloudFormation template for this code: cdk synth
  5. Deploy the stack: cdk deploy —all —require-approval never

Following the deployment, verify the successful completion in the AWS CloudFormation console. The interface may resemble the provided example.

With your AWS resources now accessible, you can commence utilizing the solution for your specific use case.

Using the solution

To commence interaction with your solution, access the AWS Lambda console and locate the deployed function named “synthetic-data-api-async.” Upon selecting the function, the console will display its details. Click on “Test” and generate a test event, exemplified by the following JSON structure:

{
  "number": "10",
  "industry": "semiconductor",
  "user_id": "michael-wallner"
}

Your AWS Lambda function screen should look similar to:

After filling in the Event JSON with your setting, you can click the Save button on the right side of the screen, followed by the Test button next to it. After successfully running the function and example output looks as follows:

Once the function succeeded, you can navigate to the AWS CodeBuild console on which you will find one build project with the name synthetic-data-cicd-run in progress. Once the build job succeeded you can navigate to the Amazon S3 console and look up your data:

Conclusion

Amazon Bedrock offers practical solutions for the semiconductor industry’s data challenges. By efficiently generating synthetic datasets, it streamlines machine learning efforts, paving the way for faster go-to-market with data-driven products. The versatility of this solution extends beyond the semiconductor sector, promising a straightforward path to modernizing data practices across manufacturing industries.

Michael Wallner

Michael Wallner

Michael Wallner is a Sr. Customer Delivery Architect with AWS Professional Services focused on manufacturing customers and is passionate about the semiconductor industry. On top, he likes thinking big with customers to innovate and invent new ideas with them to transform their business.