GPT-2 Transcends Fear: Integrated into Excel Spreadsheet, Unleashing New Possibilities

Unlocking the Essence of Large Language Models: OpenAI's GPT-2 in Microsoft Excel Demystifies LLMs


In the realm of AI, large language models (LLMs) have become ubiquitous, spurred by the emergence of ChatGPT. Now, Ishan Anand, a software developer, has ingeniously compressed a precursor to ChatGPT, known as GPT-2—initially introduced in 2019 amid cautious deliberations by OpenAI—into a functional Microsoft Excel spreadsheet. This innovative tool, aptly named "Spreadsheets-are-all-you-need," serves as an educational resource, offering insights into the inner workings of LLMs.


Anand explains on the sheet's official website that "Spreadsheets-are-all-you-need" enables anyone, regardless of their coding proficiency, to delve directly into the mechanics of a 'real' transformer model with minimal abstractions hindering exploration. The name pays homage to the seminal 2017 research paper "Attention is All You Need," which laid the groundwork for the Transformer architecture fundamental to LLMs


GPT-2 Transcends Fear: Integrated into Excel Spreadsheet, Unleashing New Possibilities


The GPT-2-packed Excel spreadsheet is formatted as an XLSB Microsoft Excel binary file, compatible only with the latest Excel version and not accessible via the web platform. Notably, it operates entirely offline, devoid of any reliance on cloud AI services.


While the spreadsheet encompasses a fully functional AI language model, it diverges from ChatGPT's conversational interface. Instead, users input text in designated cells, instantly witnessing predictive outcomes displayed in adjacent cells. GPT-2, like its successors, specializes in next-token prediction, where it endeavors to anticipate the subsequent text following an input prompt encoded into tokens. Although users are limited to just 10 tokens of input, significantly smaller than GPT-4 Turbo's expansive 128,000-token context window, the spreadsheet effectively illustrates fundamental principles underlying LLM operations. Anand supplements this educational resource with a series of complimentary tutorial videos available on YouTube, offering users a deeper understanding of LLM functionality.


Check out Iman Anand's YouTube tutorial showcasing the functionality of "Spreadsheets-are-all-you-need."


Speaking with Ars Technica, Anand reveals that his motivation for initiating the project stemmed from a personal quest for knowledge and comprehension of the Transformer architecture. He explains, "The landscape of modern AI differs greatly from the AI I encountered during my computer science studies. To develop a comprehensive understanding, I felt compelled to revisit the foundational principles."


Initially intending to recreate GPT-2 using JavaScript, Anand's passion for spreadsheets—a self-professed "spreadsheet addict"—diverted his focus. Drawing inspiration from data scientist Jeremy Howard's fast.ai and former OpenAI engineer Andrej Karpathy's AI tutorials on YouTube, he recognized the potential for utilizing spreadsheets to elucidate complex concepts. Reflecting on his epiphany, he recalls, "Karpathy's videos illuminated GPT as primarily a vast computational graph, akin to a spreadsheet. Jeremy's adept use of spreadsheets in his instructional materials further reinforced this notion. It suddenly dawned on me that crafting the entire GPT-2 model within a spreadsheet might be feasible."


When queried about challenges encountered during the implementation of a Large Language Model (LLM) in a spreadsheet, Anand emphasizes, "The GPT-2 algorithm predominantly consists of mathematical operations, making it well-suited for a spreadsheet environment." He elaborates, "However, the tokenization process, where words are converted into numerical representations, posed the greatest difficulty as it involves text processing—an area that diverges from pure mathematics. Performing this task within a traditional programming language would have been more straightforward than within a spreadsheet."


Throughout the development process, Anand sought assistance from GPT-2's descendant, ChatGPT. While acknowledging its invaluable aid in troubleshooting and comprehending algorithmic intricacies, he remains cautious due to its propensity for generating erroneous outputs, necessitating diligent verification.


Reviving GPT-2's Legacy


The genesis of this remarkable achievement traces back to OpenAI's decision to release the neural network weights and source code for GPT-2 in November 2019. It's a fascinating turn of events to witness this specific model integrated into an educational spreadsheet, given the apprehensions surrounding its initial announcement in February 2019. At the time, OpenAI harbored concerns that GPT-2 could potentially be exploited for generating deceptive, biased, or abusive content on a large scale.


Despite these reservations, OpenAI eventually made the full GPT-2 model available, including the requisite weights files for local execution. However, unlike its predecessor, GPT-3, which debuted in 2020, GPT-3 has not seen an open-weights release. Nevertheless, a derivative of GPT-3 served as the foundation for the inaugural version of ChatGPT, introduced in 2022.


Catch Anand's captivating demonstration of "Spreadsheets-are-all-you-need" at AI Tinkerers Seattle in October 2023.


Anand's spreadsheet iteration operates on "GPT-2 Small," boasting 124 million parameters, a far cry from the full-scale 1.5-billion-parameter GPT-2 model. (Parameters are numerical values within AI models that encode learned patterns from training data.) Compared to the colossal 175 billion parameters in GPT-3 and subsequent larger models, the "GPT-2 Small" variant may not qualify as a "large" language model by contemporary standards. Nonetheless, in 2019, GPT-2 epitomized cutting-edge technology in the field.


Anand's adaptation within the spreadsheet operates on the "GPT-2 Small" variant, housing 124 million parameters, distinct from the expansive 1.5-billion-parameter iteration of GPT-2. Parameters, the numerical values within AI models, encode learned patterns from training data. Relative to GPT-3's staggering 175 billion parameters and subsequent larger models, this rendition may not meet the criteria of a "large" language model by contemporary standards. Nonetheless, in 2019, GPT-2 epitomized cutting-edge technology in the field.



The GPT-2-enhanced spreadsheet is available for download on GitHub, albeit at a hefty size of approximately 1.2GB. Due to its intricacy, Anand cautions that it may frequently cause Excel to freeze or crash, particularly on Mac systems; he suggests utilizing Windows for optimal performance. "It is highly recommended to use the manual calculation mode in Excel and the Windows version of Excel (either on a Windows directory or via Parallels on a Mac)," he advises on his website.


As for Google Sheets, Anand clarifies that it's currently not feasible: "This project actually started on Google Sheets, but the full 124M model was too large and switched to Excel," he explains. "I’m still exploring ways to make this work in Google Sheets, but it is unlikely to fit into a single file as it can with Excel."