iTranslated by AI
re:Invent 2024: Building an LLM Inference Platform at Robinhood using AWS Bedrock
Introduction
By transcribing various overseas lectures into Japanese articles, we make hidden, high-quality information more accessible. The presentation we are covering in this project is as follows!
📖 AWS re:Invent 2024 - Scaling secure large language models with Robinhood (FSI317)
This video showcases how Robinhood built an LLM inference platform leveraging AWS Bedrock. It explains in detail their journey of introducing the Claude Sonnet model to improve the efficiency of fraud investigation operations, and their transition from Provisioned Throughput Mode to On-demand API to overcome its limitations. A key feature is the construction of an LLM Gateway equipped with PII redaction services and fallback mechanisms, balancing security and scalability. Furthermore, practical optimizations such as doubling capacity through cross-region inference and ensuring compatibility with multiple SDKs are incorporated throughout. Looking toward 2025, they are planning to centralize AI data governance and provide a Prompt Playground.
- This article was automatically generated from the video. Please watch the original video for accurate information, as there may be typos, omissions, or incorrect content.
- Clicking on an image will take you to the corresponding scene in the video.
Information regarding re:Invent 2024 transcripts is summarized in this Spreadsheet. Please check it out as well!
Main Content
Robinhood's Mission and Overview of LLM Utilization
Welcome to the session. I would like to dive into how to scale Large Language Models reliably and securely with Robinhood. I am Trevor Spiers, a Solutions Architect at AWS. Over the past six months, I have been supporting Robinhood in building their LLM inference platform on Bedrock. Today, I will talk about their journey, various design trial and errors, their architecture, the LLM Gateway, and the tools they built to scale inference securely.
Hello, I'm Dolly, a Machine Learning Engineer at Robinhood. Today, I will introduce how Robinhood's AI platform addresses major scalability and security challenges and realizes state-of-the-art use cases. First, I will talk about the mission of the platform and the design decisions that shaped it, then explore the role of the LLM Gateway which provides flexibility and control. Finally, I will share our goals for 2025 as we continue to scale and strengthen our infrastructure.
For those who don't know Robinhood, Robinhood pioneered commission-free trading in 2013. We are the first brokerage firm fully hosted on cloud services. We offer services such as stock trading, cryptocurrencies, joint accounts, futures trading, credit cards, and spending cards. Our mission is to democratize finance for everyone through the most intuitive user experience. The mission of Robinhood's AI and ML platform is to provide developers with powerful AI and ML abstractions while supporting advanced tools for power users. We focus on smoothing the transition from experimentation to production, and enabling the rapid adoption of cutting-edge Gen AI technologies, whether open-source, closed-source, or internally developed.
Implementation of LLM Gateway and Future Outlook: Lessons from the Robinhood Case
Currently, our platform supports various critical use cases, including fraud investigation, document processing, agent workflows, data analysis, text-to-SQL conversion, chat applications, and content generation for marketing. Let's take a closer look at the fraud investigation use case. Over 80 fraud investigators create more than 300 case conclusions manually every day. Ensuring the consistency of this narrative and maintaining high quality has always been a challenge. Fraud investigators use the fraud management dashboard to take notes, summarize findings, and finally fill out long and complex resolution forms. Previously, they had to write all narratives manually based on their findings, which could take anywhere from 30 minutes to over an hour.
We implemented a solution using AWS Bedrock's Provisioned Throughput Mode with the Claude Sonnet model. This model ingests raw notes and important details from the forms and converts them into structured conclusion drafts in seconds. To prevent misuse of this feature, we implemented several safety measures—the narrative generation button is only enabled when changes are made to the form, and agents can only click it twice per browser session. While the generated narrative streamlines the process, we recommend that agents manually refine it to ensure accuracy and completeness. We also added a feedback loop where agents can rate the generation results on a scale of 1 to 5, allowing us to analyze performance offline and identify areas for improvement.
However, this use case comes with unique challenges. Prompts can exceed 15,000 tokens per request, and during peak times like 9:00 AM, multiple agents work simultaneously, often hitting weight limits. This high demand highlighted the limitations of our initial LLM inference approach. FinTech companies are subject to stricter data regulations due to the high sensitivity of financial information. Therefore, we initially chose AWS Bedrock's Provisioned Throughput Mode. In Provisioned Throughput Mode, you purchase one unit of a Claude model for a fixed cost. This provides isolated inference in the form of deploying the Claude model as a dedicated instance, allowing you to leverage the raw GPU performance of the model without being subject to Bedrock's weight limits.
To further enhance security, we configured VPC endpoints for Bedrock, ensuring all traffic remains secure within the AWS network via Private Link. VPC endpoints allow traffic from Robinhood's services to AWS Bedrock to flow without traversing the public internet. This combination of isolated inference and private connectivity makes it an ideal use case for FinTech. However, while there are benefits, we also observed several challenges. The first is a scalability issue. In Provisioned Throughput Mode, you need to reserve a fixed number of model units in advance, which is difficult because usage patterns can change rapidly. In Provisioned operations, bursty traffic often occurs when internal operators interact with the system simultaneously, and since the requests-per-minute limit of PT is relatively fixed, it becomes difficult to handle surges in demand.
Another issue we identified was the 'Noisy Neighbor' problem. If one team consumes a large amount of capacity, it can negatively impact other teams sharing the same model unit, potentially degrading overall performance. Using Provisioned Throughput Mode provided some important lessons. Securing the optimal price requires a six-month commitment to model units, but predicting traffic patterns months in advance is a major challenge as traffic spikes may not follow that pattern. Newer LLMs are typically released on the On-demand API first, and there is a lag of several months before they become available in Provisioned Throughput Mode, which delayed access to the latest models. Consequently, we were unable to adopt the Claude 3.5 Sonnet model as soon as it was released, limiting opportunities for innovation.
Cost constraints and the six-month commitment period limited us to purchasing only one model unit for each model. This not only made it difficult to support various models, from Sonnet to Haiku and Opus, but also reduced the flexibility to adapt to different use cases and for product teams to experiment with new models. This is a common challenge for many customers we collaborate with. Predicting the demand for Gen AI applications in advance is difficult because it requires significant computation and assumptions about how much prompting users will perform for those applications. For an innovative company like Robinhood, having access to models as soon as they are released is essential, which led to the design of our revised version.
V2 was moved to the AWS Bedrock On-demand API for greater flexibility and scalability, supported by a zero-day data retention agreement for security. A key improvement is AWS Bedrock's cross-region inference, which can double the quota allocated to the region where the inference profile exists. This handles surges by dynamically routing traffic to multiple regions without complex client-side load balancing. This ensures optimal availability, reduced latency, and improved resilience during high-load periods.
Cross-region inference models maintain the same design, and VPC security via VPC Endpoint remains unchanged, but we can now access models as soon as they are released and leverage multiple models on the backend for different tasks. Doubling the capacity with the number of tokens available in Large Language Models is essential, and it also accommodates failover use cases. Many customers want to ensure that operations can continue even if a regional incident occurs, and this system enables seamless and transparent failover of LLM inference on AWS to another region.
Thanks to the LLM Gateway, we were able to achieve a smooth transition from Provisioned Throughput Mode to the On-demand API without affecting client traffic. The LLM Gateway is designed to be compatible with various SDKs, such as OpenAI, Anthropic, and other open-source SDKs, offering many benefits. The Gateway handles processing to convert inputs to provider endpoints for text generation, embeddings, and image generation, enabling seamless integration. It also validates token sizes, image sizes, and other input parameters to ensure requests are appropriate and efficient.
Furthermore, all requests and responses are recorded in an offline high-pipe table, providing a robust audit trail and enabling detailed analysis over time. This flexibility allows each team at Robinhood to access LLMs through this centralized service while using their preferred stack. Here, I will talk about some of the components of the LLM Gateway.
First is the PII redaction service. Considering Robinhood's strict compliance requirements, the Gateway has a built-in PII redaction service that automatically detects and redacts sensitive information from inputs and outputs. Internally, we use the Microsoft Presidio API. This service allows us to leverage LLMs in various use cases while remaining fully compliant with data privacy regulations.
The second component is a fallback model mechanism to ensure high availability and continuity. If the primary model fails or exceeds capacity limits, the Gateway seamlessly switches to a secondary fallback model, minimizing the impact on ongoing processes. For example, if a team is using the OpenAI API, it falls back to a Llama model, and in the case of Claude Instant, it falls back to Claude Haiku. All of these are configurable by the client teams.
In LLM applications, evaluation is the most important aspect. The Gateway records request and response payloads, enabling continuous model evaluation, which allows teams to benchmark LLM performance, accuracy, and efficiency in real-time. This enables teams to experiment with new models, design fine-tuning, and select the best options for various use cases. Furthermore, the Gateway automatically calculates the cost of each request upon response. As a client team, you can set budgets and apply rate limits at multiple levels, such as project, API key, and model, allowing for very granular control over usage and costs.
What stands out about the LLM Gateway is that it gives developers choices when many are working on models. The flexibility for teams to bring their own tools and SDKs to build is extremely convenient for developers, especially when they want to re-host what they have already built elsewhere on a secure platform like Bedrock.
Heading into 2025, we are focusing on building a platform where teams can innovate faster with higher precision and reliability. Our goals are interconnected and designed to address the key challenges of scaling AI and ML at Robinhood. We are introducing built-in tools for model and prompt analysis, enabling effective model refinement and iteration. To ensure consistency and compliance, we are centralizing AI data governance and creating a unified framework for managing data across the platform.
We are enhancing the Gateway to enable dynamic model routing and fine-tuning options, ensuring the right request is handled by the right model at the right time. To scale these features further, we are deploying batch inference pipelines that can efficiently process large-scale tasks. Finally, by providing a Prompt Playground where users can switch models or change parameters for production data, we are fostering creativity and experimentation. This will be a space to explore and test ideas. We hope our efforts help you understand the benefits and trade-offs of the various options in AWS Bedrock and the importance of the LLM Gateway. Thank you very much.
Discussion