IDEAS home Printed from https://ideas.repec.org/p/arx/papers/2410.01265.html

Transformers Handle Endogeneity in In-Context Linear Regression

Author

Listed:
  • Haodong Liang
  • Krishnakumar Balasubramanian
  • Lifeng Lai

Abstract

We explore the capability of transformers to address endogeneity in in-context linear regression. Our main finding is that transformers inherently possess a mechanism to handle endogeneity effectively using instrumental variables (IV). First, we demonstrate that the transformer architecture can emulate a gradient-based bi-level optimization procedure that converges to the widely used two-stage least squares $(\textsf{2SLS})$ solution at an exponential rate. Next, we propose an in-context pretraining scheme and provide theoretical guarantees showing that the global minimizer of the pre-training loss achieves a small excess loss. Our extensive experiments validate these theoretical findings, showing that the trained transformer provides more robust and reliable in-context predictions and coefficient estimates than the $\textsf{2SLS}$ method, in the presence of endogeneity.

Suggested Citation

  • Haodong Liang & Krishnakumar Balasubramanian & Lifeng Lai, 2024. "Transformers Handle Endogeneity in In-Context Linear Regression," Papers 2410.01265, arXiv.org, revised May 2025.
  • Handle: RePEc:arx:papers:2410.01265
    as

    Download full text from publisher

    File URL: http://arxiv.org/pdf/2410.01265
    File Function: Latest version
    Download Restriction: no
    ---><---

    References listed on IDEAS

    as
    1. Joshua D. Angrist & Alan B. Krueger, 2001. "Instrumental Variables and the Search for Identification: From Supply and Demand to Natural Experiments," Journal of Economic Perspectives, American Economic Association, vol. 15(4), pages 69-85, Fall.
    2. Joshua D. Angrist & Jörn-Steffen Pischke, 2009. "Mostly Harmless Econometrics: An Empiricist's Companion," Economics Books, Princeton University Press, edition 1, number 8769, December.
    3. Joshua Angrist & Alan Krueger, 2001. "Instrumental Variables and the Search for Identification: From Supply and Demand to Natural Experiments," Working Papers 834, Princeton University, Department of Economics, Industrial Relations Section..
    4. Peter N. C. Mohr, 2018. "Sanjit Dhami: The foundations of behavioral economic analysis," Journal of Economics, Springer, vol. 123(3), pages 299-301, April.
    Full references (including those not matched with items on IDEAS)

    Most related items

    These are the items that most often cite the same works as this one and are cited by the same works as this one.
    1. Steven A. Boutcher & Jason N. Houle & Anna Raup‐Kounovksy & Carroll Seron, 2023. "A Faustian bargain? Rethinking the role of debt in law students' career choices," Journal of Empirical Legal Studies, John Wiley & Sons, vol. 20(1), pages 166-195, March.
    2. Caroline Krafft, 2020. "Why is fertility on the rise in Egypt? The role of women’s employment opportunities," Journal of Population Economics, Springer;European Society for Population Economics, vol. 33(4), pages 1173-1218, October.
    3. Ellis, Jimmy R. & Gershenson, Seth, 2016. "LATE for the Meeting: Gender, Peer Advising, and College Success," IZA Discussion Papers 9956, Institute of Labor Economics (IZA).
    4. Roberto Ezcurra & Andrés Rodríguez-Pose, 2017. "Does ethnic segregation matter for spatial inequality?," Journal of Economic Geography, Oxford University Press, vol. 17(6), pages 1149-1178.
    5. Rietveld, Cornelius A. & Webbink, Dinand, 2016. "On the genetic bias of the quarter of birth instrument," Economics & Human Biology, Elsevier, vol. 21(C), pages 137-146.
    6. Long Thanh Giang & Cuong Viet Nguyen & Tuyen Quang Tran & Vu Thieu, 2017. "Does Firm Agglomeration Matter to Labor and Education of Local Children? Evidence in Vietnam," Child Indicators Research, Springer;The International Society of Child Indicators (ISCI), vol. 10(4), pages 1015-1041, December.
    7. Mauricio Villamizar‐Villegas & Freddy A. Pinzon‐Puerto & Maria Alejandra Ruiz‐Sanchez, 2022. "A comprehensive history of regression discontinuity designs: An empirical survey of the last 60 years," Journal of Economic Surveys, Wiley Blackwell, vol. 36(4), pages 1130-1178, September.
    8. Sari, Emre & Moilanen, Mikko & Lindeboom, Maarten, 2023. "Role of grandparents in risky health behavior transmission: A study on smoking behavior in Norway," Social Science & Medicine, Elsevier, vol. 338(C).
    9. John Cawley & Euna Han & Edward C. Norton, 2011. "The validity of genes related to neurotransmitters as instrumental variables," Health Economics, John Wiley & Sons, Ltd., vol. 20(8), pages 884-888, August.
    10. Rezki, Jahen Fachrul, 2018. "Political Competition and Local Government Performance: Evidence from Indonesia," SocArXiv nekps, Center for Open Science.
    11. Duncan Chaplin & Arif Mamun & Ali Protik & John Schurrer & Divya Vohra & Kristine Bos & Hannah Burak & Laura Meyer & Anca Dumitrescu & Christopher Ksoll & Thomas Cook, "undated". "Grid Electricity Expansion in Tanzania by MCC: Findings from a Rigorous Impact Evaluation, Final Report," Mathematica Policy Research Reports 144768f69008442e96369195e, Mathematica Policy Research.
    12. Oesch, David & Walser, Tanja, 2025. "The impact of automation on firms' reporting quality," Journal of Corporate Finance, Elsevier, vol. 92(C).
    13. Luis Antonio Fantozzi Alvarez & Rodrigo Toneto, 2024. "The interpretation of 2SLS with a continuous instrument: a weighted LATE representation," Working Papers, Department of Economics 2024_11, University of São Paulo (FEA-USP).
    14. Mikel Bedayo, 2016. "Creating associations to substitute banks’direct credit. Evidence from Belgium," Working Paper Research 315, National Bank of Belgium.
    15. repec:dgr:rugsom:14009-eef is not listed on IDEAS
    16. Florian Flachenecker, 2018. "The causal impact of material productivity on macroeconomic competitiveness in the European Union," Environmental Economics and Policy Studies, Springer;Society for Environmental Economics and Policy Studies - SEEPS, vol. 20(1), pages 17-46, January.
    17. Cuong Viet Nguyen & Finn Tarp, 2023. "Cash Transfers and Labor Supply: New Evidence on Impacts and Mechanisms," DERG working paper series 23-18, University of Copenhagen. Department of Economics. Development Economics Research Group (DERG).
    18. Nguyen, Cuong Viet, 2021. "Can money buy friends? Evidence from a natural experiment," European Economic Review, Elsevier, vol. 136(C).
    19. Deepankar Basu, 2018. "When Can We Determine the Direction of Omitted Variable Bias of OLS Estimators?," UMASS Amherst Economics Working Papers 2018-16, University of Massachusetts Amherst, Department of Economics.
    20. repec:osf:socarx:3s784_v1 is not listed on IDEAS
    21. Mark J. Browne & Annette Hofmann & Andreas Richter & Sophie-Madeleine Roth & Petra Steinorth, 2021. "Peer effects in risk preferences: Evidence from Germany," Annals of Operations Research, Springer, vol. 299(1), pages 1129-1163, April.
    22. Jones, Benjamin A., 2016. "Work more and play less? Time use impacts of changing ecosystem services: The case of the invasive emerald ash borer," Ecological Economics, Elsevier, vol. 124(C), pages 49-58.

    More about this item

    NEP fields

    This paper has been announced in the following NEP Reports:

    Statistics

    Access and download statistics

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:arx:papers:2410.01265. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    If CitEc recognized a bibliographic reference but did not link an item in RePEc to it, you can help with this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: arXiv administrators (email available below). General contact details of provider: http://arxiv.org/ .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.