Academic Appointments

Honors & Awards

  • National Science Foundation CAREER Award, Stanford University (2016)
  • William Pierskalla best paper award, INFORMS Health Applications Society (2016)
  • Best paper award, INFORMS Applied Probability Society (2015)
  • William Pierskalla best paper award, INFORMS Health Applications Society (2014)
  • Gold Medal, International Mathematics Olympiad (1997)

Current Research and Scholarly Interests

2023-24 Courses

Stanford Advisees

Graduate and Fellowship Programs

  • Biomedical Informatics (Phd Program)

All Publications

  • Large language models for preventing medication direction errors in online pharmacies. Nature medicine Pais, C., Liu, J., Voigt, R., Gupta, V., Wade, E., Bayati, M. 2024


    Errors in pharmacy medication directions, such as incorrect instructions for dosage or frequency, can increase patient safety risk substantially by raising the chances of adverse drug events. This study explores how integrating domain knowledge with large language models (LLMs)-capable of sophisticated text interpretation and generation-can reduce these errors. We introduce MEDIC (medication direction copilot), a system that emulates the reasoning of pharmacists by prioritizing precise communication of core clinical components of a prescription, such as dosage and frequency. It fine-tunes a first-generation LLM using 1,000 expert-annotated and augmented directions from Amazon Pharmacy to extract the core components and assembles them into complete directions using pharmacy logic and safety guardrails. We compared MEDIC against two LLM-based benchmarks: one leveraging 1.5 million medication directions and the other using state-of-the-art LLMs. On 1,200 expert-reviewed prescriptions, the two benchmarks respectively recorded 1.51 (confidence interval (CI) 1.03, 2.31) and 4.38 (CI 3.13, 6.64) times more near-miss events-errors caught and corrected before reaching the patient-than MEDIC. Additionally, we tested MEDIC by deploying within the production system of an online pharmacy, and during this experimental period, it reduced near-miss events by 33% (CI 26%, 40%). This study shows that LLMs, with domain expertise and safeguards, improve the accuracy and efficiency of pharmacy operations.

    View details for DOI 10.1038/s41591-024-02933-8

    View details for PubMedID 38664535

  • Predicting Primary Care Physician Burnout From Electronic Health Record Use Measures. Mayo Clinic proceedings Tawfik, D., Bayati, M., Liu, J., Nguyen, L., Sinha, A., Kannampallil, T., Shanafelt, T., Profit, J. 2024


    To evaluate the ability of routinely collected electronic health record (EHR) use measures to predict clinical work units at increased risk of burnout and potentially most in need of targeted interventions.In this observational study of primary care physicians, we compiled clinical workload and EHR efficiency measures, then linked these measures to 2 years of well-being surveys (using the Stanford Professional Fulfillment Index) conducted from April 1, 2019, through October 16, 2020. Physicians were grouped into training and confirmation data sets to develop predictive models for burnout. We used gradient boosting classifier and other prediction modeling algorithms to quantify the predictive performance by the area under the receiver operating characteristics curve (AUC).Of 278 invited physicians from across 60 clinics, 233 (84%) completed 396 surveys. Physicians were 67% women with a median age category of 45 to 49 years. Aggregate burnout score was in the high range (≥3.325/10) on 111 of 396 (28%) surveys. Gradient boosting classifier of EHR use measures to predict burnout achieved an AUC of 0.59 (95% CI, 0.48 to 0.77) and an area under the precision-recall curve of 0.29 (95% CI, 0.20 to 0.66). Other models' confirmation set AUCs ranged from 0.56 (random forest) to 0.66 (penalized linear regression followed by dichotomization). Among the most predictive features were physician age, team member contributions to notes, and orders placed with user-defined preferences. Clinic-level aggregate measures identified the top quartile of clinics with 56% sensitivity and 85% specificity.In a sample of primary care physicians, routinely collected EHR use measures demonstrated limited ability to predict individual burnout and moderate ability to identify high-risk clinics.

    View details for DOI 10.1016/j.mayocp.2024.01.005

    View details for PubMedID 38573301

  • Optimal Experimental Design for Staggered Rollouts MANAGEMENT SCIENCE Xiong, R., Athey, S., Bayati, M., Imbens, G. 2023
  • Technical Note-The Elliptical Potential Lemma for General Distributions with an Application to Linear Thompson Sampling OPERATIONS RESEARCH Hamidi, N., Bayati, M. 2022
  • On Low-rank Trace Regression under General Sampling Distribution JOURNAL OF MACHINE LEARNING RESEARCH Hamdi, N., Bayati, M. 2022; 23
  • Frustration With Technology and its Relation to Emotional Exhaustion Among Health Care Workers: Cross-sectional Observational Study. Journal of medical Internet research Tawfik, D. S., Sinha, A., Bayati, M., Adair, K. C., Shanafelt, T. D., Sexton, J. B., Profit, J. 2021; 23 (7): e26817


    BACKGROUND: New technology adoption is common in health care, but it may elicit frustration if end users are not sufficiently considered in their design or trained in their use. These frustrations may contribute to burnout.OBJECTIVE: This study aimed to evaluate and quantify health care workers' frustration with technology and its relationship with emotional exhaustion, after controlling for measures of work-life integration that may indicate excessive job demands.METHODS: This was a cross-sectional, observational study of health care workers across 31 Michigan hospitals. We used the Safety, Communication, Operational Reliability, and Engagement (SCORE) survey to measure work-life integration and emotional exhaustion among the survey respondents. We used mixed-effects hierarchical linear regression to evaluate the relationship among frustration with technology, other components of work-life integration, and emotional exhaustion, with adjustment for unit and health care worker characteristics.RESULTS: Of 15,505 respondents, 5065 (32.7%) reported that they experienced frustration with technology on at least 3-5 days per week. Frustration with technology was associated with higher scores for the composite Emotional Exhaustion scale (r=0.35, P<.001) and each individual item on the Emotional Exhaustion scale (r=0.29-0.36, P<.001 for all). Each 10-point increase in the frustration with technology score was associated with a 1.2-point increase (95% CI 1.1-1.4) in emotional exhaustion (both measured on 100-point scales), after adjustment for other work-life integration items and unit and health care worker characteristics.CONCLUSIONS: This study found that frustration with technology and several other markers of work-life integration are independently associated with emotional exhaustion among health care workers. Frustration with technology is common but not ubiquitous among health care workers, and it is one of several work-life integration factors associated with emotional exhaustion. Minimizing frustration with health care technology may be an effective approach in reducing burnout among health care workers.

    View details for DOI 10.2196/26817

    View details for PubMedID 34255674

  • Matrix Completion Methods for Causal Panel Data Models JOURNAL OF THE AMERICAN STATISTICAL ASSOCIATION Athey, S., Bayati, M., Doudchenko, N., Imbens, G., Khosravi, K. 2021
  • Mostly Exploration-Free Algorithms for Contextual Bandits MANAGEMENT SCIENCE Bastani, H., Bayati, M., Khosravi, K. 2021; 67 (3)
  • PatientFlowNet: A Deep Learning Approach to Patient Flow Prediction in Emergency Departments IEEE ACCESS Sharafat, A. R., Bayati, M. 2021; 9: 45552–61
  • Online Decision Making with High-Dimensional Covariates OPERATIONS RESEARCH Bastani, H., Bayati, M. 2020; 68 (1): 276–94
  • Recommendation on a Budget: Column Space Recovery from Partially Observed Entries with Random or Active Sampling Kim, C., Bayati, M., Chiappa, S., Calandra, R. ADDISON-WESLEY PUBL CO. 2020: 445–54
  • Evidence of Upcoding in Pay-for-Performance Programs MANAGEMENT SCIENCE Bastani, H., Goh, J., Bayati, M. 2019; 65 (3): 1042–60
  • Scalable Approximations for Generalized Linear Problems JOURNAL OF MACHINE LEARNING RESEARCH Erdogdu, M. A., Bayati, M., Dicker, L. H. 2019; 20
  • Personalizing Many Decisions with High-Dimensional Covariates Hamidi, N., Bayati, M., Gupta, K., Wallach, H., Larochelle, H., Beygelzimer, A., d'Alche-Buc, F., Fox, E., Garnett, R. NEURAL INFORMATION PROCESSING SYSTEMS (NIPS). 2019
  • Personalizing Many Decisions with High-Dimensional Covariates Advances in Neural Information Processing Systems 32 Hamidi, N., Bayati, M., Gupta, K. 2019
  • Generating Random Networks Without Short Cycles OPERATIONS RESEARCH Bayati, M., Montanari, A., Saberi, A. 2018; 66 (5): 1227–46
  • Data Uncertainty in Markov Chains: Application to Cost-Effectiveness Analyses of Medical Innovations OPERATIONS RESEARCH Goh, J., Bayati, M., Zenios, S. A., Singh, S., Moore, D. 2018; 66 (3): 697–715
  • Accurate Emergency Department Wait Time Prediction M&SOM-MANUFACTURING & SERVICE OPERATIONS MANAGEMENT Ang, E., Kwasnick, S., Bayati, M., Plambeck, E. L., Aratow, M. 2016; 18 (1): 141-156
  • Scaled Least Squares Estimator for GLMs in Large-Scale Problems Erdogdu, M. A., Bayati, M., Dicker, L. H., Lee, D. D., Sugiyama, M., Luxburg, U. V., Guyon, Garnett, R. NEURAL INFORMATION PROCESSING SYSTEMS (NIPS). 2016
  • Statistical analysis of a low cost method for multiple disease prediction. Statistical methods in medical research Bayati, M., Bhaskar, S., Montanari, A. 2016: 962280216680242-?


    Early identification of individuals at risk for chronic diseases is of significant clinical value. Early detection provides the opportunity to slow the pace of a condition, and thus help individuals to improve or maintain their quality of life. Additionally, it can lessen the financial burden on health insurers and self-insured employers. As a solution to mitigate the rise in chronic conditions and related costs, an increasing number of employers have recently begun using wellness programs, which typically involve an annual health risk assessment. Unfortunately, these risk assessments have low detection capability, as they should be low-cost and hence rely on collecting relatively few basic biomarkers. Thus one may ask, how can we select a low-cost set of biomarkers that would be the most predictive of multiple chronic diseases? In this paper, we propose a statistical data-driven method to address this challenge by minimizing the number of biomarkers in the screening procedure while maximizing the predictive power over a broad spectrum of diseases. Our solution uses multi-task learning and group dimensionality reduction from machine learning and statistics. We provide empirical validation of the proposed solution using data from two different electronic medical records systems, with comparisons over a statistical benchmark.

    View details for DOI 10.1177/0962280216680242

    View details for PubMedID 27932665

  • Active Postmarketing Drug Surveillance for Multiple Adverse Events OPERATIONS RESEARCH Goh, J., Bjarnadottir, M. V., Bayati, M., Zenios, S. A. 2015; 63 (6): 1528-1546

    View details for DOI 10.1214/14-AAP1010

    View details for Web of Science ID 000350708000012

  • Bargaining dynamics in exchange networks JOURNAL OF ECONOMIC THEORY Bayati, M., Borgs, C., Chayes, J., Kanoria, Y., Montanari, A. 2015; 156: 417-454
  • A Low-Cost Method for Multiple Disease Prediction. AMIA ... Annual Symposium proceedings / AMIA Symposium. AMIA Symposium Bayati, M., Bhaskar, S., Montanari, A. 2015; 2015: 329-338


    Recently, in response to the rising costs of healthcare services, employers that are financially responsible for the healthcare costs of their workforce have been investing in health improvement programs for their employees. A main objective of these so called "wellness programs" is to reduce the incidence of chronic illnesses such as cardiovascular disease, cancer, diabetes, and obesity, with the goal of reducing future medical costs. The majority of these wellness programs include an annual screening to detect individuals with the highest risk of developing chronic disease. Once these individuals are identified, the company can invest in interventions to reduce the risk of those individuals. However, capturing many biomarkers per employee creates a costly screening procedure. We propose a statistical data-driven method to address this challenge by minimizing the number of biomarkers in the screening procedure while maximizing the predictive power over a broad spectrum of diseases. Our solution uses multi-task learning and group dimensionality reduction from machine learning and statistics. We provide empirical validation of the proposed solution using data from two different electronic medical records systems, with comparisons to a statistical benchmark.

    View details for PubMedID 26958164

  • Data-driven decisions for reducing readmissions for heart failure: general methodology and case study. PloS one Bayati, M., Braverman, M., Gillam, M., Mack, K. M., Ruiz, G., Smith, M. S., Horvitz, E. 2014; 9 (10): e109264


    Several studies have focused on stratifying patients according to their level of readmission risk, fueled in part by incentive programs in the U.S. that link readmission rates to the annual payment update by Medicare. Patient-specific predictions about readmission have not seen widespread use because of their limited accuracy and questions about the efficacy of using measures of risk to guide clinical decisions. We construct a predictive model for readmissions for congestive heart failure (CHF) and study how its predictions can be used to perform patient-specific interventions. We assess the cost-effectiveness of a methodology that combines prediction and decision making to allocate interventions. The results highlight the importance of combining predictions with decision analysis.We construct a statistical classifier from a retrospective database of 793 hospital visits for heart failure that predicts the likelihood that patients will be rehospitalized within 30 days of discharge. We introduce a decision analysis that uses the predictions to guide decisions about post-discharge interventions. We perform a cost-effectiveness analysis of 379 additional hospital visits that were not included in either the formulation of the classifiers or the decision analysis. We report the performance of the methodology and show the overall expected value of employing a real-time decision system.For the cohort studied, readmissions are associated with a mean cost of $13,679 with a standard error of $1,214. Given a post-discharge plan that costs $1,300 and that reduces 30-day rehospitalizations by 35%, use of the proposed methods would provide an 18.2% reduction in rehospitalizations and save 3.8% of costs.Classifiers learned automatically from patient data can be joined with decision analysis to guide the allocation of post-discharge support to CHF patients. Such analyses are especially valuable in the common situation where it is not economically feasible to provide programs to all patients.

    View details for DOI 10.1371/journal.pone.0109264

    View details for PubMedID 25295524

    View details for PubMedCentralID PMC4190088


    View details for DOI 10.1214/12-AOP816

    View details for Web of Science ID 000328255600008

  • Message-Passing Algorithms for Sparse Network Alignment ACM TRANSACTIONS ON KNOWLEDGE DISCOVERY FROM DATA Bayati, M., Gleich, D. F., Saberi, A., Wang, Y. 2013; 7 (1)
  • Estimating LASSO Risk and Noise Level Neural Information Processing Systems 26 Bayati, M., Erdogdu, M., Montanari, A. 2013
  • The LASSO Risk for Gaussian Matrices IEEE TRANSACTIONS ON INFORMATION THEORY Bayati, M., Montanari, A. 2012; 58 (4): 1997-2017
  • The Dynamics of Message Passing on Dense Graphs, with Applications to Compressed Sensing IEEE International Symposium on Information Theory Bayati, M., Montanari, A. IEEE-INST ELECTRICAL ELECTRONICS ENGINEERS INC. 2011: 764–85

    View details for DOI 10.1137/090753115

    View details for Web of Science ID 000292302000033

  • A Sequential Algorithm for Generating Random Graphs ALGORITHMICA Bayati, M., Kim, J. H., Saberi, A. 2010; 58 (4): 860-910
  • A rigorous analysis of the cavity equations for the minimum spanning tree JOURNAL OF MATHEMATICAL PHYSICS Bayati, M., Braunstein, A., Zecchina, R. 2008; 49 (12)

    View details for DOI 10.1063/1.2982805

    View details for Web of Science ID 000262225000007

  • Statistical mechanics of Steiner trees PHYSICAL REVIEW LETTERS Bayati, M., Borgs, C., Braunstein, A., Chayes, J., Ramezanpour, A., Zecchina, R. 2008; 101 (3): 037208


    The minimum weight Steiner tree (MST) is an important combinatorial optimization problem over networks that has applications in a wide range of fields. Here we discuss a general technique to translate the imposed global connectivity constrain into many local ones that can be analyzed with cavity equation techniques. This approach leads to a new optimization algorithm for MST and allows us to analyze the statistical mechanics properties of MST on random graphs of various types.

    View details for DOI 10.1103/PhysRevLett.101.037208

    View details for Web of Science ID 000258184500053

    View details for PubMedID 18764290

  • On the exactness of the cavity method for weighted b-matchings on arbitrary graphs and its relation to linear programs JOURNAL OF STATISTICAL MECHANICS-THEORY AND EXPERIMENT Bayati, M., Borgs, C., Chayes, J., Zecchina, R. 2008
  • Max-product for maximum weight matching: Convergence, correctness, and LP duality Bayati, M., Shah, D., Sharma, M. IEEE-INST ELECTRICAL ELECTRONICS ENGINEERS INC. 2008: 1241–51
  • Simple Deterministic Approximation Algorithms for Counting Matchings STOC 07: PROCEEDINGS OF THE 39TH ANNUAL ACM SYMPOSIUM ON THEORY OF COMPUTING Bayati, M., Gamarnik, D., Katz, D., Nair, C., Tetali, P. 2007: 122-127
  • Iterative scheduling algorithms 26th IEEE Conference on Computer Communications (INFOCOM 2007) Bayati, M., Prabhakar, B., Shah, D., Sharma, M. IEEE. 2007: 445–453
  • A simpler max-product Maximum Weight Matching algorithm and the auction algorithm IEEE International Symposium on Information Theory Bayati, M., Shah, D., Sharma, M. IEEE. 2006: 557–561
  • Maximum weight matching via max-product belief propagation IEEE International Symposium on Information Theory and Its Applications Bayati, M., Shah, D., Sharma, M. IEEE. 2005: 1763–1767
  • Achieving stability in networks of input-queued switches using a local online scheduling policy GLOBECOM '05: IEEE GLOBAL TELECOMMUNICATIONS CONFERENCE, VOLS 1-6 Nabar, S. U., Kumar, N., Bayati, M., Keshavarzian, A. 2005: 694-698