Pharmacies play a vital role in ensuring patients’ health, but the process of dispensing medications is far more complex than it may appear. At Amazon Pharmacy, we are using artificial intelligence (AI) and cutting-edge technologies to remove this complexity and improve patients’ experiences.
The pharmacy challenge
When a prescription arrives at a pharmacy, its details must be entered into the pharmacy's software system. Then, a licensed pharmacist reviews the prescription to verify the patient's information, check for potential drug interactions or allergies, and confirm that the prescribed medication, dosage, and instructions are appropriate and accurate.
This process is susceptible to errors — even if the prescription arrives electronically. A U.S. study estimated that there are approximately 51.5 million dispensing errors annually in community pharmacies, with a meta-analysis supporting an error rate of around 1.5%.
Pharmacies must also handle billing and insurance claims for their patients. These are involved calculations based on patients’ specific insurance policies, their copay responsibilities, and the rates that the pharmacy has negotiated with different insurance providers. In fact, just identifying a patient's insurance can be challenging. The result is that patients often do not know the prices they will pay for their medications until the end of the process, when they’re picking up their prescriptions at a retail pharmacy or checking out online.
After a prescription has been validated and the purchase completed, the pharmacy staff must locate the specific medication in their inventory. However, it's possible that at this stage, the prescribed medication, the required strength, or the preferred brand may no longer be available. Providing a substitute could necessitate contacting the prescribing physician again for approval. Additionally, depending on the substitution, the billing and insurance process may need to be re-initiated to account for any changes in pricing or coverage.
Once the medication is ready for dispensing, the pharmacist provides the patient with detailed instructions on how to properly take it. Patients may also have questions regarding their insurance coverage or costs. However, these conversations often take place in public areas, which can be uncomfortable for patients who have personal or sensitive questions.
Finally, patients need convenient access to pharmacists at any time, day or night. This allows patients to report how they are feeling while taking their medications, which can help pharmacists provide better guidance and support throughout the treatment process.
The AI-powered pharmacy
Amazon Pharmacy uses large language models (LLMs) to enhance the accuracy, safety, and speed of prescription processing. First, we use LLMs to transcribe raw prescription data into structured, standardized formats that are seamlessly processed by software and more easily understood by patients. For example, medical abbreviations like "PRN" and "QID" are transformed into their full-text equivalents, such as "take as needed" and "take four times a day," respectively.
After standardizing the prescription data, the system performs a validation step that includes checking the medication names, dosage forms, strengths, and directions for use against an industry database. After validation, all prescriptions are still carefully reviewed and verified by licensed pharmacists. By leveraging this automated process, Amazon Pharmacy has reduced the number of near-miss events (potential medication errors) by 50% and improved processing speed by up to 90%. This allows our pharmacists to focus their time and attention on critical tasks, such as providing personalized care and addressing complex medication-related issues.
Amazon Pharmacy understands the importance of price transparency for customers. When a patient is using insurance to cover the cost of medication, Amazon Pharmacy will first try to obtain the exact price directly from the insurance provider. However, if this real-time pricing information is not available, Amazon Pharmacy will provide an estimated out-of-pocket cost for the patient's copay, without requiring the customer to go through the entire checkout process first.
To generate accurate price estimates, Amazon Pharmacy uses an ensemble of decision-tree-based models. These models take into account factors such as historical claims data (time series features) and static information such as the specific medication, the number-of-days' supply, and the quantity prescribed. By providing upfront pricing information, either the exact cost or a reliable estimate, Amazon Pharmacy aims to increase transparency and help patients understand their out-of-pocket expenses before committing to purchases. Additionally, Amazon Pharmacy searches for applicable industry coupons and automatically applies them to orders. We also use ML to validate the patient's insurance registration and claim requests to insurance providers.
Amazon is known for its extensive logistics and fulfillment capabilities, and Amazon Pharmacy takes advantage of Amazon's vast network of same-day and local delivery facilities, as well as innovative transportation methods like Prime Air drones. Additionally, Amazon Pharmacy employs specialized automation technologies, such as robotic vial-filling systems, to streamline the medication-dispensing process, enabling prompt delivery of medications to patients across the nation.
Beyond the physical logistics infrastructure, Amazon Pharmacy has developed its own order fulfillment system to handle complex medication-routing and -dispensing logic, while ensuring compliance with over 160 different pharmacy regulatory bodies across the United States. For example, if a medication for an order is no longer available at the closest fulfillment center, Amazon Pharmacy can identify the next best eligible facility to fulfill the order, even if it's in a different state, provided that the relevant state regulations allow for such cross-state fulfillment.
Moreover, Amazon Pharmacy's order fulfillment algorithm takes into account regional variations in insurance eligibility. In such cases, Amazon Pharmacy will first validate that there are no changes to the patient's copay. If changes are required, Amazon Pharmacy will work with the insurance providers to clarify the benefits. To accomplish all of this, Amazon Pharmacy's order fulfillment solution employs a combination of operations research techniques, such as optimization solvers, and deep-learning models such as variational autoencoders and diffusion models. These models help simulate different scenarios and optimize the fulfillment process to ensure efficient and compliant delivery of medications to patients.
Amazon Pharmacy also introduced personalized AI-powered chatbots to assist users. These virtual assistants can answer frequently asked questions about Amazon Pharmacy, such as how to enroll in the service. In a first for the industry, Amazon Pharmacy's chatbot also provides personalized support, allowing patients to ask questions about their medication orders, delivery status, prescription transfers, and inventory availability. If a patient prefers, there is always 24/7 access to direct pharmacist support and the customer care team.
Implementing a personalized AI chatbot in the healthcare setting is a complex task. It's crucial to safeguard patients' privacy and ensure the highest level of accuracy, avoiding LLM hallucinations. To address these challenges, Amazon Pharmacy has enhanced the typical retrieval-augmented generation (RAG) approach used for LLM chatbots. The enhancements include input and output guardrails, the use of ensembles of specialized (mini) AI models, and a continuous model improvement process through reinforcement learning using human feedback (RLHF).
The digital pharmacy counter
Amazon Pharmacy is leveraging ML and optimization algorithms to streamline the complex process of dispensing medications. By addressing long-standing challenges such as data entry errors, lack of price transparency, intelligent nationwide medication fulfillment, and personalized-AI-based experiences, Amazon Pharmacy enables patients to save time, save money, and stay healthy.
For example, it is not uncommon for medications to go into short-term back order (STBO), especially new medications entering the market, as was recently the case with the GLP-1 line of medications used for diabetes and weight loss. Amazon Pharmacy’s intelligent-fulfillment solution has enabled an 85% decrease in delivery estimate misses for unforeseen reasons, including STBOs.
The AI-powered Amazon Pharmacy assistant helps customers navigate the complexities of the pharmacy industry, providing 24/7 assistance on topics like prescription tracking, insurance coverage, medication availability, and cost-saving strategies. Half of the customers who interact with the assistant don't require additional human support, which saves them time and effort. (For customers who still need assistance, Amazon Pharmacy likewise provides 24/7 access to pharmacist support.) Additionally, the assistant provides real-time medication transfer or shipment status updates in response to patient queries, handling follow-up questions to recommend next steps.
For all the success of our AI-based systems, however, Amazon Pharmacy’s research and engineering teams remain hard at work. We will continue pushing the envelope in scaling medication dispensing, improving personalized AI-based chatbots and assistants, and transitioning toward a longitudinal pharmacy that is proactively looking out for patients.