<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Antti Puurula on Medium]]></title>
        <description><![CDATA[Stories by Antti Puurula on Medium]]></description>
        <link>https://medium.com/@antti.puurula?source=rss-d31c16454dd3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*6mfcKt2dAi56EU5HR3m1Dw.jpeg</url>
            <title>Stories by Antti Puurula on Medium</title>
            <link>https://medium.com/@antti.puurula?source=rss-d31c16454dd3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 07:58:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@antti.puurula/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A Human-curated List of Essential GPT4 and LLM Resources]]></title>
            <link>https://medium.com/@antti.puurula/a-human-curated-list-of-essential-gpt4-and-llm-resources-c9cbc7fce1cf?source=rss-d31c16454dd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9cbc7fce1cf</guid>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[gpt-4]]></category>
            <dc:creator><![CDATA[Antti Puurula]]></dc:creator>
            <pubDate>Tue, 11 Apr 2023 00:09:56 GMT</pubDate>
            <atom:updated>2023-07-16T10:03:43.981Z</atom:updated>
            <content:encoded><![CDATA[<p>A List of Informative Resources on the LLM Revolution</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*lfFw0rC3x_EHdyLK" /><figcaption>“A friendly robot assistant doing paperwork” by Stable Diffusion</figcaption></figure><h3>Overview</h3><p>This article is a manually curated list of essential reading and viewing material for anyone who’s interested in following the LLM transformer revolution started by GPT4. The links cover the technical side of LLMs and developments likely to influence the course of the technology.</p><p>The links are intended to give the reader an in-depth understanding of LLM technology, and a comprehensive, up-to-date selection of the material needed to stay up-to-date on the topic. I’ve chosen the links based on authority, novelty, usefulness, and expected impact on LLM technology. The link categories span:</p><ul><li>commentary videos summarizing developments</li><li>the most recent discussion videos featuring key technology and research leaders on the topic</li><li>assorted relevant web resources</li><li>blog articles discussing developments and implications of LLMs</li><li>scientific publications with a high impact or expected impact</li><li>GitHub projects developing LLMs and use cases</li></ul><p>It is expected lists of this type can be automatically generated later this year by a prompt to an LLM with access to search tools. For the time being, this list will be manually updated with the most relevant links as the LLM situation progresses.</p><h3><strong>Commentary Videos</strong></h3><p><a href="https://www.youtube.com/watch?v=V2RoqUr0qDU">https://www.youtube.com/watch?v=V2RoqUr0qDU</a> OpenAI ChatGPT: The Future Is Here!<br><a href="https://www.youtube.com/watch?v=jPhJbKBuNnA">https://www.youtube.com/watch?v=jPhJbKBuNnA</a> I tried using AI. It scared me.<br><a href="https://www.youtube.com/watch?v=7VSWyghVZIg">https://www.youtube.com/watch?v=7VSWyghVZIg</a> OpenAI GPT-4 — The Future Is Here!<br><a href="https://www.youtube.com/watch?v=FceQxb96GO8">https://www.youtube.com/watch?v=FceQxb96GO8</a> How Well Can GPT-4 See? And the 5 Upgrades That Are Next<br><a href="https://www.youtube.com/watch?v=CUR1FN3Ok_w">https://www.youtube.com/watch?v=CUR1FN3Ok_w</a> Bing (GPT 4) Just Made Smartphones MUCH Smarter (next-level Android and iOS app)<br><a href="https://www.youtube.com/watch?v=c4aR_smQgxY">https://www.youtube.com/watch?v=c4aR_smQgxY</a> GPT 5 is All About Data<br><a href="https://www.youtube.com/watch?v=DIU48QL5Cyk">https://www.youtube.com/watch?v=DIU48QL5Cyk</a> AI is Evolving Faster Than You Think [GPT-4 and beyond]<br><a href="https://www.youtube.com/watch?v=at9zPRcvPIw">https://www.youtube.com/watch?v=at9zPRcvPIw</a> OpenAI GPT-4 — See How Everyone Is Using It!<br><a href="https://www.youtube.com/watch?v=5SgJKZLBrmg">https://www.youtube.com/watch?v=5SgJKZLBrmg</a> GPT 4 Can Improve Itself — (ft. Reflexion, HuggingGPT, Bard Upgrade and much more)<br><a href="https://www.youtube.com/watch?v=8OpW5qboDDs">https://www.youtube.com/watch?v=8OpW5qboDDs</a> ‘Pause Giant AI Experiments’ — Letter Breakdown w/ Research Papers, Altman, Sutskever and more<br><a href="https://www.youtube.com/watch?v=f3o1MW2G5Rs">https://www.youtube.com/watch?v=f3o1MW2G5Rs</a> Do We Get the $100 Trillion AI Windfall? Sam Altman’s Plans, Jobs &amp; the Falling Cost of Intelligence<br><a href="https://www.youtube.com/watch?v=8hrSmX0jeXg">https://www.youtube.com/watch?v=8hrSmX0jeXg</a> The AI Race — Training &amp; commercializing 2T parameters: UK, Anthropic, Meta, Google/DeepMind, OpenAI<br><a href="https://www.youtube.com/watch?v=6NoTuqDAkfg">https://www.youtube.com/watch?v=6NoTuqDAkfg</a> Can GPT 4 Prompt Itself? MemoryGPT, AutoGPT, Jarvis, Claude-Next [10x GPT 4!] and more…<br><a href="https://www.youtube.com/watch?v=wHiOKDlA8Ac">https://www.youtube.com/watch?v=wHiOKDlA8Ac</a> OpenAI’s GPT-4: A Spark Of Intelligence!<br><a href="https://www.youtube.com/watch?v=Mqg3aTGNxZ0">https://www.youtube.com/watch?v=Mqg3aTGNxZ0</a> ‘Sparks of AGI’ — Bombshell GPT-4 Paper: Fully Read w/ 15 Revelations<br><a href="https://www.youtube.com/watch?v=Fjh1kwOzr7c">https://www.youtube.com/watch?v=Fjh1kwOzr7c</a> OpenAI’s GPT-4 Just Got Supercharged!<br><a href="https://www.youtube.com/watch?v=hX0OUFJs9nQ">https://www.youtube.com/watch?v=hX0OUFJs9nQ</a> OpenAI’s GPT-4: Next Level AI Assistant!<br><a href="https://www.youtube.com/watch?v=FC01lHMtq2U">https://www.youtube.com/watch?v=FC01lHMtq2U</a> Software Engineer Asks To STOP AI RESEARCH<br><a href="https://www.youtube.com/watch?v=kZazs6V3314">https://www.youtube.com/watch?v=kZazs6V3314</a> DOLLY 2 LLM explained: New Open-Source LLM w/ code<br><a href="https://www.youtube.com/watch?v=1NAmLp5i4Ps">https://www.youtube.com/watch?v=1NAmLp5i4Ps</a> GPT 5 Will be Released ‘Incrementally’ — 5 Points from Brockman Statement [plus Timelines &amp; Safety]<br><a href="https://www.youtube.com/watch?v=jO5Wev0nAjM">https://www.youtube.com/watch?v=jO5Wev0nAjM</a> GPT-4 is already old news<br><a href="https://www.youtube.com/watch?v=qOoe3ZpciI0">https://www.youtube.com/watch?v=qOoe3ZpciI0</a> ‘We Must Slow Down the Race’ — X AI, Musk, GPT 4 Can Now Do Science &amp; Altman GPT 5 Statement<br><a href="https://www.youtube.com/watch?v=qu-vXAFUpLE">https://www.youtube.com/watch?v=qu-vXAFUpLE</a> LLM Ecosystem explained: Your ultimate Guide to AI<br><a href="https://www.youtube.com/watch?v=HQI6O5DlyFc">https://www.youtube.com/watch?v=HQI6O5DlyFc</a> Foundation models and the next era of AI<br><a href="https://www.youtube.com/watch?v=5Nsqv3FWXio">https://www.youtube.com/watch?v=5Nsqv3FWXio</a> Sam Altman on UBI, OpenAI to $100 TRILLION and Massive Job Losses from AI Automation<br><a href="https://www.youtube.com/watch?v=5cnk5zpf1EA">https://www.youtube.com/watch?v=5cnk5zpf1EA</a> AutoGPT &amp; BabyAGI: autonomous AI Agents for LLMs explained<br><a href="https://www.youtube.com/watch?v=ivexBzomPv4">https://www.youtube.com/watch?v=ivexBzomPv4</a> What’s Behind the ChatGPT History Change? How You Can Benefit + The 6 New Developments This Week<br><a href="https://www.youtube.com/watch?v=mzdQOwxypCM">https://www.youtube.com/watch?v=mzdQOwxypCM</a> ChatGPT: My emotional Firewall<br><a href="https://www.youtube.com/watch?v=SxAn6f7gM44">https://www.youtube.com/watch?v=SxAn6f7gM44</a> The best LLMs (3B to 13B models) — Conversational AI<br><a href="https://www.youtube.com/watch?v=wVzuvf9D9BU">https://www.youtube.com/watch?v=wVzuvf9D9BU</a> GPT 4 is Smarter than You Think: Introducing SmartGPT<br><a href="https://www.youtube.com/watch?v=u_dSUtp4eM8">https://www.youtube.com/watch?v=u_dSUtp4eM8</a> Enter PaLM 2 (New Bard): Full Breakdown — 92 Pages Read and Gemini Before GPT 5? Google I/O<br><a href="https://www.youtube.com/watch?v=pzh2oc6shic">https://www.youtube.com/watch?v=pzh2oc6shic</a> Direct Preference Optimization: Forget RLHF (PPO)</p><h3>Video Interviews and Discussions</h3><p><a href="https://www.youtube.com/watch?v=Rp3A5q9L_bg">https://www.youtube.com/watch?v=Rp3A5q9L_bg</a> OpenAI’s Greg Brockman: The Future of LLMs, Foundation &amp; Generative Models (DALL·E 2 &amp; GPT-3)<br><a href="https://www.youtube.com/watch?v=UHSkjro-VbE">https://www.youtube.com/watch?v=UHSkjro-VbE</a> OpenAI Co-Founder Ilya Sutskever: What’s Next for Large Language Models (LLMs)<br><a href="https://www.youtube.com/watch?v=WHoWGNQRXb0">https://www.youtube.com/watch?v=WHoWGNQRXb0</a> OpenAI CEO Sam Altman | AI for the Next Era<br><a href="https://www.youtube.com/watch?v=DEvbDq6BOVM">https://www.youtube.com/watch?v=DEvbDq6BOVM</a> The Rise of Artificial Intelligence | AngelList Confidential 2022<br><a href="https://www.youtube.com/watch?v=Rp3A5q9L_bg">https://www.youtube.com/watch?v=Rp3A5q9L_bg</a> OpenAI’s Greg Brockman: The Future of LLMs, Foundation &amp; Generative Models (DALL·E 2 &amp; GPT-3)<br><a href="https://www.youtube.com/watch?v=L_Guz73e6fw">https://www.youtube.com/watch?v=L_Guz73e6fw</a> Sam Altman: OpenAI CEO on GPT-4, ChatGPT, and the Future of AI | Lex Fridman Podcast #367<br><a href="https://www.youtube.com/watch?v=DEvbDq6BOVM">https://www.youtube.com/watch?v=DEvbDq6BOVM</a> The Rise of Artificial Intelligence | AngelList Confidential 2022<br><a href="https://www.youtube.com/watch?v=bHb_eG46v2c">https://www.youtube.com/watch?v=bHb_eG46v2c</a> Bill Gates on AI and the rapidly evolving future of computing<br><a href="https://www.youtube.com/watch?v=Yf1o0TQzry8">https://www.youtube.com/watch?v=Yf1o0TQzry8</a> Ilya Sutskever (OpenAI Chief Scientist) — Building AGI, Alignment, Spies, Microsoft, &amp; Enlightenment<br><a href="https://www.youtube.com/watch?v=SjhIlw3Iffs">https://www.youtube.com/watch?v=SjhIlw3Iffs</a> GPT-4 Creator Ilya Sutskever<br><a href="https://www.youtube.com/watch?v=YtJEfTTD_Y4">https://www.youtube.com/watch?v=YtJEfTTD_Y4</a> OpenAI Co-founder Greg Brockman on ChatGPT, DALL·E and the Impact of Generative AI | SXSW 2023<br><a href="https://www.youtube.com/watch?v=tPJIpx3KscY">https://www.youtube.com/watch?v=tPJIpx3KscY</a> Reid Hoffman and Sam Altman | AI Field Notes<br><a href="https://www.youtube.com/watch?v=qbIk7-JPB2c">https://www.youtube.com/watch?v=qbIk7-JPB2c</a> Sparks of AGI: early experiments with GPT-4<br><a href="https://www.youtube.com/watch?v=ZZ0atq2yYJw">https://www.youtube.com/watch?v=ZZ0atq2yYJw</a> CONFERENCE JENSEN HUANG (NVIDIA) and ILYA SUTSKEVER (OPEN AI).AI TODAY AND VISION OF THE FUTURE<br><a href="https://www.youtube.com/watch?v=BY9KV8uCtj4">https://www.youtube.com/watch?v=BY9KV8uCtj4</a> Yann LeCun and Andrew Ng: Why the 6-month AI Pause is a Bad Idea<br><a href="https://www.youtube.com/watch?v=ow3XrwTmFA8">https://www.youtube.com/watch?v=ow3XrwTmFA8</a> Beyond ChatGPT: Stuart Russell on the Risks and Rewards of A.I.<br><a href="https://www.youtube.com/watch?v=xoVJKj8lcNQ">https://www.youtube.com/watch?v=xoVJKj8lcNQ</a> The A.I. Dilemma — March 9, 2023<br><a href="https://www.youtube.com/watch?v=C_78DM8fG6E">https://www.youtube.com/watch?v=C_78DM8fG6E</a> The Inside Story of ChatGPT’s Astonishing Potential | Greg Brockman | TED<br><a href="https://www.youtube.com/watch?v=Q_1Bco0AkcM">https://www.youtube.com/watch?v=Q_1Bco0AkcM</a> ETL Speaker Series: Ilya Sutskever, OpenAI<br><a href="https://www.youtube.com/watch?v=sitHS6UDMJc">https://www.youtube.com/watch?v=sitHS6UDMJc</a> Possible End of Humanity from AI? Geoffrey Hinton at MIT Technology Review’s EmTech Digital<br><a href="https://www.youtube.com/watch?v=T5cPoNwO7II">https://www.youtube.com/watch?v=T5cPoNwO7II</a> Breakthrough potential of AI | Sam Altman | MIT 2023<br><a href="https://www.youtube.com/watch?v=Y6Sgp7y178k">https://www.youtube.com/watch?v=Y6Sgp7y178k</a> “Godfather of AI” Geoffrey Hinton Warns of the “Existential Threat” of AI | Amanpour and Company<br><a href="https://www.youtube.com/watch?v=rLG68k2blOc">https://www.youtube.com/watch?v=rLG68k2blOc</a> S3 E9 Geoff Hinton, the “Godfather of AI”, quits Google to warn of AI risks (Host: Pieter Abbeel)<br><a href="https://www.youtube.com/watch?v=1egAKCKPKCk">https://www.youtube.com/watch?v=1egAKCKPKCk</a> Sohn 2023 | Patrick Collison in conversation Sam Altman<br><a href="https://www.youtube.com/watch?v=lGH4b-rHqwQ">https://www.youtube.com/watch?v=lGH4b-rHqwQ</a> AI means Business: Performance vs Price of LLMs — New Insights<br><a href="https://www.youtube.com/watch?v=TO0J2Yw7usM">https://www.youtube.com/watch?v=TO0J2Yw7usM</a> OpenAI CEO Sam Altman testifies at Senate artificial intelligence hearing | full video<br><a href="https://www.youtube.com/watch?v=lGH4b-rHqwQ">https://www.youtube.com/watch?v=lGH4b-rHqwQ</a> New AI cascade of LLMs — FrugalGPT (Stanford)<br><a href="https://www.youtube.com/watch?v=Fquj2u7ay40">https://www.youtube.com/watch?v=Fquj2u7ay40</a> LLMOps (LLM Bootcamp)<br><a href="https://build.microsoft.com/en-US/sessions/db3f4859-cd30-4445-a0cd-553c3304f8e2">https://build.microsoft.com/en-US/sessions/db3f4859-cd30-4445-a0cd-553c3304f8e2</a> State of GPT<br><a href="https://www.youtube.com/watch?v=mC-0XqTAeMQ">https://www.youtube.com/watch?v=mC-0XqTAeMQ</a> Chat with OpenAI CEO and and Co-founder Sam Altman, and Chief Scientist Ilya Sutskever<br><a href="https://www.youtube.com/watch?v=T-lj7ItGjZE">https://www.youtube.com/watch?v=T-lj7ItGjZE</a> ChatGPT founder Sam Altman: AI is not a creature but a tool | Full Q&amp;A<br><a href="https://www.youtube.com/watch?v=AiE7FsdRzz8">https://www.youtube.com/watch?v=AiE7FsdRzz8</a> Watch ET Conversations with OpenAI CEO Sam Altman | An ET Exclusive<br><a href="https://www.youtube.com/watch?v=0RknkWgd6Ck">https://www.youtube.com/watch?v=0RknkWgd6Ck</a> Dissecting The Extinction Threat of AI | Yoshua Bengio | Eye on AI #128</p><h3>Web Resources</h3><p><a href="https://chat.openai.com/chat">https://chat.openai.com/chat</a><br><a href="https://learnprompting.org/">https://learnprompting.org/</a><br><a href="https://crfm.stanford.edu/2023/03/13/alpaca.html">https://crfm.stanford.edu/2023/03/13/alpaca.html</a><br><a href="https://www.latent.space/p/chatgpt-plugins">https://www.latent.space/p/chatgpt-plugins</a><br><a href="https://openai.com/research/gpt-4">https://openai.com/research/gpt-4</a><br><a href="https://futureoflife.org/open-letter/pause-giant-ai-experiments/">https://futureoflife.org/open-letter/pause-giant-ai-experiments/</a><br><a href="https://magazine.sebastianraschka.com/p/finetuning-large-language-models">https://magazine.sebastianraschka.com/p/finetuning-large-language-models</a><br><a href="https://ai.v-gar.de/ml/transformer/timeline/">https://ai.v-gar.de/ml/transformer/timeline/</a><br><a href="https://home.mlops.community/public/events/llms-in-production-conference-2023-04-13">https://home.mlops.community/public/events/llms-in-production-conference-2023-04-13</a><br><a href="https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard">https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard</a><br><a href="https://laion.ai/blog/oig-dataset/">https://laion.ai/blog/oig-dataset/</a><br><a href="https://huggingface.co/docs/transformers/transformers_agents">https://huggingface.co/docs/transformers/transformers_agents</a><br><a href="https://huggingface.co/CalderaAI/30B-Lazarus">https://huggingface.co/CalderaAI/30B-Lazarus</a></p><h3>Blog Articles</h3><p><a href="https://moores.samaltman.com/">https://moores.samaltman.com/</a><br><a href="https://ai.googleblog.com/2021/10/introducing-flan-more-generalizable.html">https://ai.googleblog.com/2021/10/introducing-flan-more-generalizable.html</a><br><a href="https://sebastianraschka.com/blog/2023/llm-reading-list.html">https://sebastianraschka.com/blog/2023/llm-reading-list.html</a><br><a href="https://medium.com/@tr_18329/learning-languages-with-gpt-3-5-e7692ac15d32">https://medium.com/@tr_18329/learning-languages-with-gpt-3-5-e7692ac15d32</a><br><a href="https://jmcdonnell.substack.com/p/openai-comes-clean-about-gpt-35">https://jmcdonnell.substack.com/p/openai-comes-clean-about-gpt-35</a><br><a href="https://jrodthoughts.medium.com/instructgpt-is-one-of-the-models-behidn-the-magic-of-chatgpt-59813dd8aabc">https://jrodthoughts.medium.com/instructgpt-is-one-of-the-models-behidn-the-magic-of-chatgpt-59813dd8aabc</a><br><a href="https://blogs.microsoft.com/blog/2023/03/16/introducing-microsoft-365-copilot-your-copilot-for-work/">https://blogs.microsoft.com/blog/2023/03/16/introducing-microsoft-365-copilot-your-copilot-for-work/</a><br><a href="https://workspace.google.com/blog/product-announcements/generative-ai">https://workspace.google.com/blog/product-announcements/generative-ai</a><br><a href="https://www.gatesnotes.com/The-Age-of-AI-Has-Begun">https://www.gatesnotes.com/The-Age-of-AI-Has-Begun</a><br><a href="https://betterprogramming.pub/jarvis-an-experiment-leveraging-the-open-ai-api-apple-homekit-and-siri-98995d1b2f1f">https://betterprogramming.pub/jarvis-an-experiment-leveraging-the-open-ai-api-apple-homekit-and-siri-98995d1b2f1f</a><br><a href="https://medium.com/@shukic/foundation-models-introduce-the-ai-tamer-profession-39f651b8631f">https://medium.com/@shukic/foundation-models-introduce-the-ai-tamer-profession-39f651b8631f</a><br><a href="https://medium.com/@ignacio.de.gregorio.noblejas/why-chatgpts-new-killer-feature-risks-google-s-entire-ad-business-cda05ff612e">https://medium.com/@ignacio.de.gregorio.noblejas/why-chatgpts-new-killer-feature-risks-google-s-entire-ad-business-cda05ff612e</a><br><a href="https://maithraraghu.com/blog/2023/does-one-model-rule-them-all/">https://maithraraghu.com/blog/2023/does-one-model-rule-them-all/</a><br><a href="https://robotic.substack.com/p/behind-the-curtain-ai">https://robotic.substack.com/p/behind-the-curtain-ai</a><br><a href="https://kipp.ly/blog/transformer-taxonomy/">https://kipp.ly/blog/transformer-taxonomy/</a><br><a href="https://yoshuabengio.org/2023/04/05/slowing-down-development-of-ai-systems-passing-the-turing-test/">https://yoshuabengio.org/2023/04/05/slowing-down-development-of-ai-systems-passing-the-turing-test/</a><br><a href="https://bair.berkeley.edu/blog/2023/04/03/koala/">https://bair.berkeley.edu/blog/2023/04/03/koala/</a><br><a href="https://towardsdatascience.com/what-are-the-data-centric-ai-concepts-behind-gpt-models-a590071bb727">https://towardsdatascience.com/what-are-the-data-centric-ai-concepts-behind-gpt-models-a590071bb727</a><br><a href="https://cacm.acm.org/magazines/2023/1/267976-the-end-of-programming/fulltext">https://cacm.acm.org/magazines/2023/1/267976-the-end-of-programming/fulltext</a><br><a href="https://lightning.ai/pages/community/community-discussions/the-ultimate-battle-of-language-models-lit-llama-vs-gpt3.5-vs-bloom-vs/">https://lightning.ai/pages/community/community-discussions/the-ultimate-battle-of-language-models-lit-llama-vs-gpt3.5-vs-bloom-vs/</a><br><a href="https://lilianweng.github.io/posts/2023-01-27-the-transformer-family-v2/">https://lilianweng.github.io/posts/2023-01-27-the-transformer-family-v2/</a><br><a href="https://www.semianalysis.com/p/google-we-have-no-moat-and-neither?utm_source=substack&amp;utm_medium=email">https://www.semianalysis.com/p/google-we-have-no-moat-and-neither?utm_source=substack&amp;utm_medium=email</a><br><a href="https://www.mosaicml.com/blog/mpt-7b">https://www.mosaicml.com/blog/mpt-7b</a><br><a href="https://www.harmdevries.com/post/model-size-vs-compute-overhead/">https://www.harmdevries.com/post/model-size-vs-compute-overhead/</a><br><a href="https://www.stochastic.ai/blog/xfinance-vs-bloomberg-gpt">https://www.stochastic.ai/blog/xfinance-vs-bloomberg-gpt</a><br><a href="https://blog.google/technology/ai/google-palm-2-ai-large-language-model/">https://blog.google/technology/ai/google-palm-2-ai-large-language-model/</a><br><a href="https://openai.com/blog/governance-of-superintelligence">https://openai.com/blog/governance-of-superintelligence</a><br><a href="https://www.kdnuggets.com/2023/05/ai-eating-data-science.html">https://www.kdnuggets.com/2023/05/ai-eating-data-science.html</a><br><a href="https://albertoromgar.medium.com/open-source-ai-is-not-winning-incumbents-are-61cd7779366">https://albertoromgar.medium.com/open-source-ai-is-not-winning-incumbents-are-61cd7779366</a><br><a href="https://www.mosaicml.com/blog/mpt-30b">https://www.mosaicml.com/blog/mpt-30b</a> MPT-30B: Raising the bar for open-source foundation models<br><a href="https://towardsdatascience.com/harnessing-the-falcon-40b-model-the-most-powerful-open-source-llm-f70010bc8a10">https://towardsdatascience.com/harnessing-the-falcon-40b-model-the-most-powerful-open-source-llm-f70010bc8a10</a><br><a href="https://www.anyscale.com/blog/continuous-batching-llm-inference">https://www.anyscale.com/blog/continuous-batching-llm-inference</a></p><h3>Scientific Publications</h3><p><a href="https://paperswithcode.com/paper/improving-language-understanding-by">https://paperswithcode.com/paper/improving-language-understanding-by</a> Improving Language Understanding by Generative Pre-Training<br><a href="https://paperswithcode.com/paper/language-models-are-unsupervised-multitask">https://paperswithcode.com/paper/language-models-are-unsupervised-multitask</a> Language Models are Unsupervised Multitask Learners<br><a href="https://arxiv.org/abs/2104.08773">https://arxiv.org/abs/2104.08773</a> Cross-Task Generalization via Natural Language Crowdsourcing Instructions<br><a href="https://arxiv.org/abs/2106.09685">https://arxiv.org/abs/2106.09685</a> LoRA: Low-Rank Adaptation of Large Language Models<br><a href="https://arxiv.org/abs/2005.14165">https://arxiv.org/abs/2005.14165</a> Language Models are Few-Shot Learners<br><a href="https://arxiv.org/abs/2109.01652">https://arxiv.org/abs/2109.01652</a> Finetuned Language Models Are Zero-Shot Learners<br><a href="https://arxiv.org/abs/2112.04426">https://arxiv.org/abs/2112.04426</a> Improving language models by retrieving from trillions of tokens<br><a href="https://arxiv.org/abs/2206.07682">https://arxiv.org/abs/2206.07682</a> Emergent Abilities of Large Language Models<br><a href="https://arxiv.org/abs/2201.11903">https://arxiv.org/abs/2201.11903</a> Chain-of-Thought Prompting Elicits Reasoning in Large Language Models<br><a href="https://arxiv.org/abs/2205.06175">https://arxiv.org/abs/2205.06175</a> A Generalist Agent<br><a href="https://arxiv.org/abs/2205.11916">https://arxiv.org/abs/2205.11916</a> Large Language Models are Zero-Shot Reasoners<br><a href="https://arxiv.org/abs/2204.02311">https://arxiv.org/abs/2204.02311</a> PaLM: Scaling Language Modeling with Pathways<br><a href="https://arxiv.org/abs/2208.07339">https://arxiv.org/abs/2208.07339</a> LLM.int8(): 8-bit Matrix Multiplication for Transformers at Scale<br><a href="https://arxiv.org/abs/2203.02155">https://arxiv.org/abs/2203.02155</a> Training language models to follow instructions with human feedback<br><a href="https://arxiv.org/abs/2203.15556">https://arxiv.org/abs/2203.15556</a> Training Compute-Optimal Large Language Models<br><a href="https://arxiv.org/abs/2212.10560">https://arxiv.org/abs/2212.10560</a> Self-Instruct: Aligning Language Model with Self Generated Instructions<br><a href="https://arxiv.org/abs/2212.12017">https://arxiv.org/abs/2212.12017</a> OPT-IML: Scaling Language Model Instruction Meta Learning through the Lens of Generalization<br><a href="https://arxiv.org/abs/2302.08582">https://arxiv.org/abs/2302.08582</a> Pretraining Language Models with Human Preferences<br><a href="https://arxiv.org/abs/2302.13971">https://arxiv.org/abs/2302.13971</a> LLaMA: Open and Efficient Foundation Language Models<br><a href="https://arxiv.org/abs/2302.04761">https://arxiv.org/abs/2302.04761</a> Toolformer: Language Models Can Teach Themselves to Use Tools<br><a href="https://arxiv.org/abs/2303.10130">https://arxiv.org/abs/2303.10130</a> GPTs are GPTs: An Early Look at the Labor Market Impact Potential of Large Language Models<br><a href="https://arxiv.org/abs/2303.11366">https://arxiv.org/abs/2303.11366</a> Reflexion: an autonomous agent with dynamic memory and self-reflection<br><a href="https://arxiv.org/abs/2303.15056">https://arxiv.org/abs/2303.15056</a> ChatGPT Outperforms Crowd-Workers for Text-Annotation Tasks<br><a href="https://arxiv.org/abs/2303.16199">https://arxiv.org/abs/2303.16199</a> LLaMA-Adapter: Efficient Fine-tuning of Language Models with Zero-init Attention<br><a href="https://arxiv.org/abs/2303.12712">https://arxiv.org/abs/2303.12712</a> Sparks of Artificial General Intelligence: Early experiments with GPT-4<br><a href="https://arxiv.org/abs/2304.03442">https://arxiv.org/abs/2304.03442</a> Generative Agents: Interactive Simulacra of Human Behavior<br><a href="https://arxiv.org/abs/2304.11062">https://arxiv.org/abs/2304.11062</a> Scaling Transformer to 1M tokens and beyond with RMT<br><a href="https://arxiv.org/abs/2304.08354">https://arxiv.org/abs/2304.08354</a> Tool Learning with Foundation Models<br><a href="https://arxiv.org/abs/2303.18223">https://arxiv.org/abs/2303.18223</a> A Survey of Large Language Models<br><a href="https://arxiv.org/abs/2304.14402">https://arxiv.org/abs/2304.14402</a> LaMini-LM: A Diverse Herd of Distilled Models from Large-Scale Instructions<br><a href="https://arxiv.org/abs/2304.13712">https://arxiv.org/abs/2304.13712</a> Harnessing the Power of LLMs in Practice: A Survey on ChatGPT and Beyond<br><a href="https://arxiv.org/abs/2304.07327">https://arxiv.org/abs/2304.07327</a> OpenAssistant Conversations — Democratizing Large Language Model Alignment<br><a href="https://arxiv.org/abs/2305.02301">https://arxiv.org/abs/2305.02301</a> Distilling Step-by-Step! Outperforming Larger Language Models with Less Training Data and Smaller Model Sizes<br><a href="https://arxiv.org/abs/2302.10866">https://arxiv.org/abs/2302.10866</a> Hyena Hierarchy: Towards Larger Convolutional Language Models<br><a href="https://arxiv.org/abs/2305.13048">https://arxiv.org/abs/2305.13048</a> RWKV: Reinventing RNNs for the Transformer Era<br><a href="https://arxiv.org/abs/2203.11171">https://arxiv.org/abs/2203.11171</a> Self-Consistency Improves Chain of Thought Reasoning in Language Models<br><a href="https://arxiv.org/abs/2305.14314">https://arxiv.org/abs/2305.14314</a> QLoRA: Efficient Finetuning of Quantized LLMs<br><a href="https://arxiv.org/abs/2305.14201">https://arxiv.org/abs/2305.14201</a> Goat: Fine-tuned LLaMA Outperforms GPT-4 on Arithmetic Tasks<br><a href="https://arxiv.org/abs/2305.11206">https://arxiv.org/abs/2305.11206</a> LIMA: Less Is More for Alignment<br><a href="https://arxiv.org/abs/2305.16291">https://arxiv.org/abs/2305.16291</a> Voyager: An Open-Ended Embodied Agent with Large Language Models<br><a href="https://arxiv.org/abs/2305.05176">https://arxiv.org/abs/2305.05176</a> FrugalGPT: How to Use Large Language Models While Reducing Cost and Improving Performance<br><a href="https://arxiv.org/abs/2305.15717">https://arxiv.org/abs/2305.15717</a> The False Promise of Imitating Proprietary LLMs<br><a href="https://arxiv.org/abs/2304.12244">https://arxiv.org/abs/2304.12244</a> WizardLM: Empowering Large Language Models to Follow Complex Instructions<br><a href="https://arxiv.org/abs/2305.10601">https://arxiv.org/abs/2305.10601</a> Tree of Thoughts: Deliberate Problem Solving with Large Language Models<br><a href="https://arxiv.org/abs/2305.15324">https://arxiv.org/abs/2305.15324</a> Model evaluation for extreme risks<br><a href="https://arxiv.org/abs/2305.19466">https://arxiv.org/abs/2305.19466</a> The Impact of Positional Encoding on Length Generalization in Transformers<br><a href="https://arxiv.org/abs/2306.01116">https://arxiv.org/abs/2306.01116</a> The RefinedWeb Dataset for Falcon LLM: Outperforming Curated Corpora with Web Data, and Web Data Only<br><a href="https://arxiv.org/abs/2306.03078">https://arxiv.org/abs/2306.03078</a> SpQR: A Sparse-Quantized Representation for Near-Lossless LLM Weight Compression<br><a href="https://arxiv.org/abs/2306.02707">https://arxiv.org/abs/2306.02707</a> Orca: Progressive Learning from Complex Explanation Traces of GPT-4<br><a href="https://arxiv.org/abs/2305.18290">https://arxiv.org/abs/2305.18290</a> Direct Preference Optimization: Your Language Model is Secretly a Reward Model<br><a href="https://arxiv.org/abs/2306.06070">https://arxiv.org/abs/2306.06070</a> Mind2Web: Towards a Generalist Agent for the Web<br><a href="https://arxiv.org/abs/2303.16755">https://arxiv.org/abs/2303.16755</a> Training Language Models with Language Feedback at Scale<br><a href="https://arxiv.org/abs/2306.11644">https://arxiv.org/abs/2306.11644</a> Textbooks Are All You Need<br><a href="https://arxiv.org/abs/2305.14233">https://arxiv.org/abs/2305.14233</a> Enhancing Chat Language Models by Scaling High-quality Instructional Conversations<br><a href="https://arxiv.org/abs/2306.17806">https://arxiv.org/abs/2306.17806</a> Stay on topic with Classifier-Free Guidance<br><a href="https://arxiv.org/abs/2306.10209">https://arxiv.org/abs/2306.10209</a> ZeRO++: Extremely Efficient Collective Communication for Giant Model Training</p><h3>Github</h3><p><a href="https://github.com/nomic-ai/gpt4all">https://github.com/nomic-ai/gpt4all</a> GPT4All<br><a href="https://github.com/biobootloader/wolverine">https://github.com/biobootloader/wolverine</a> Wolverine<br><a href="https://github.com/TheAppleTucker/backend-GPT">https://github.com/TheAppleTucker/backend-GPT</a> GPT is all you need for the backend<br><a href="https://github.com/mayooear/gpt4-pdf-chatbot-langchain">https://github.com/mayooear/gpt4-pdf-chatbot-langchain</a> GPT-4 &amp; LangChain — Create a ChatGPT Chatbot for Your PDF Files<br><a href="https://github.com/promptslab/Awesome-Prompt-Engineering">https://github.com/promptslab/Awesome-Prompt-Engineering</a> Awesome Prompt Engineering<br><a href="https://github.com/Hannibal046/Awesome-LLM">https://github.com/Hannibal046/Awesome-LLM</a> Awesome-LLM<br><a href="https://github.com/Torantulino/Auto-GPT">https://github.com/Torantulino/Auto-GPT</a> Auto-GPT: An Autonomous GPT-4 Experiment<br><a href="https://github.com/hwchase17/langchain/">https://github.com/hwchase17/langchain/</a> LangChain<br><a href="https://github.com/huggingface/peft">https://github.com/huggingface/peft</a> PEFT<br><a href="https://github.com/declare-lab/flan-alpaca">https://github.com/declare-lab/flan-alpaca</a> Flan-Alpaca: Instruction Tuning from Humans and Machines<br><a href="https://github.com/togethercomputer/RedPajama-Data">https://github.com/togethercomputer/RedPajama-Data</a> RedPajama-Data: An Open Source Recipe to Reproduce LLaMA training dataset<br><a href="https://github.com/lm-sys/FastChat">https://github.com/lm-sys/FastChat</a> FastChat<br><a href="https://github.com/Mooler0410/LLMsPracticalGuide">https://github.com/Mooler0410/LLMsPracticalGuide</a> The Practical Guides for Large Language Models<br><a href="https://github.com/openlm-research/open_llama">https://github.com/openlm-research/open_llama</a> OpenLLaMA: An Open Reproduction of LLaMA<br><a href="https://github.com/ZrrSkywalker/LLaMA-Adapter">https://github.com/ZrrSkywalker/LLaMA-Adapter</a> LLaMA-Adapter: Efficient Fine-tuning of LLaMA<br><a href="https://github.com/stochasticai/xturing">https://github.com/stochasticai/xturing</a> Build, customize and control your own personal LLMs<br><a href="https://github.com/haotian-liu/LLaVA">https://github.com/haotian-liu/LLaVA</a> LLaVA: Large Language and Vision Assistant<br><a href="https://github.com/kuleshov-group/llmtune">https://github.com/kuleshov-group/llmtune</a> LLMTune: 4-Bit Finetuning of LLMs on a Consumer GPU<br><a href="https://github.com/kagisearch/pyllms">https://github.com/kagisearch/pyllms</a> PyLLMs<br><a href="https://github.com/MineDojo/Voyager">https://github.com/MineDojo/Voyager</a> Voyager: An Open-Ended Embodied Agent with Large Language Models<br><a href="https://github.com/rogeriochaves/litechain">https://github.com/rogeriochaves/litechain</a> LiteChain<br><a href="https://github.com/microsoft/guidance">https://github.com/microsoft/guidance</a> guidance<br><a href="https://github.com/skypilot-org/skypilot">https://github.com/skypilot-org/skypilot</a> Run LLMs and AI on Any Cloud</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9cbc7fce1cf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Journey in Building Data-Centric Autonomous AI]]></title>
            <link>https://pub.towardsai.net/a-journey-in-building-data-centric-autonomous-ai-dcc98d39d6f7?source=rss-d31c16454dd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/dcc98d39d6f7</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Antti Puurula]]></dc:creator>
            <pubDate>Thu, 16 Jun 2022 00:03:06 GMT</pubDate>
            <atom:updated>2022-06-16T00:18:25.219Z</atom:updated>
            <content:encoded><![CDATA[<p>Learnings from four years as the Head of Machine Learning at a VC-backed early-stage startup</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UeVMZ8jxtVJbPci0" /><figcaption><a href="https://creator.nightcafe.studio/creation/xugPhlPE3nhQhdwtoZzy">“Accounting AI autopilot</a>” by CLIP-Guided Diffusion</figcaption></figure><h3>Introduction</h3><p>This week concluded my four-year role as the Head of Machine Learning for <a href="https://www.vic.ai/">Vic.ai</a>, as I have moved to a research position. <strong>My years in this role were an epic journey in building a next-generation commercial AI product and the team that operates it today</strong>. When I accepted the role, Vic was a first-year startup in Oslo with around 15 employees and $1.5M of seed-stage funding. Vic has since grown exponentially and gained the <a href="https://medium.com/iconiq-growth/vic-ai-putting-accounting-on-autopilot-490856b6462">backing of leading US-based VC investors</a>. Today Vic operates globally, and thousands of companies have their accounting done with the AI I’ve designed for Vic.</p><p>The vision for Vic.ai is ambitious and far-reaching: <strong>building an autonomous AI that will entirely replace the manual accounting workflow for processing invoices</strong>. This reminded me of the initial reason for inventing computers: replacing the work of human “computers” whose occupation was to meticulously calculate and correct numbers. Like the human computers a century ago, accountants today increasingly work through volumes of invoices, instead of tasks requiring creative problem solving and human interaction. To an ML scientist, this problem had a real-world impact, and raised questions: how to build the AI, and if this type of task could be made autonomous, what other types of tedious work could be automated using autonomous AI?</p><p>The role of the initial<strong> “Head of Machine Learning” in early-growth startups is considerably different than in larger companies</strong> and involves wearing many hats. During my tenure, I managed all of the data science projects, designed the ML algorithms Vic uses today, and hired the current ML and backend engineers. Until the last year, I did all of the analysis to drive the AI development forward, the technology choices for building the AI stack, trained the deployed models and did a fair share of the analysis to resolve prediction errors. This workload sounds exhausting, but in the early phase each of these takes limited time, and improved software has greatly reduced these times.</p><p>As someone who’s worked in AI research, startups, and consulting for the past two decades, Vic.ai struck me as unique in many ways. The usual pitfalls of AI projects were absent, and the work could focus on the core challenges of building an AI product. Many of these remaining challenges weren’t fully recognized by AI research or industry. <strong>I’ve decided to share the learnings gained along this journey</strong>, as these challenges are common to most organizations building AI, and this experience can be of interest to others.</p><h3>CRISP-DM Meets DevOps Culture</h3><p>Before Vic, my commercial AI experience was as an external consultant, and as an in-house ML developer for several startups. It hadn’t taken me long to notice the <strong>mismatch between managing AI and software development projects</strong>. The majority of AI development projects were conducted with the <a href="https://www.kdnuggets.com/2014/10/crisp-dm-top-methodology-analytics-data-mining-data-science-projects.html">CRISP-DM</a> framework originating in data mining consulting, resulting in a high success rate and fast turnaround for clients. Software development was done with Scrum-influenced practices, with less than half of the projects succeeding. The two solved different problems and didn’t fit together. CRISP-DM is non-linear, with undetermined outcomes. Scrum is linear, with planned outcomes. Most commonly, AI projects were prototyped and delivered for production use, but the organizational support failed to turn these into successful products.</p><p>Like most of the AI community, I got increasingly pessimistic about commercial AI due to these organizational problems, and the complete mismatch between CRISP-DM and Scrum. Encountering Vic changed this, as the company had an exceptionally professional early developer team. Many of them had CTO-level experience or continued to a CTO role from Vic. <strong>Engineering and the rest of the company practiced DevOps culture</strong> and unlike Scrum applied the Agile #1 value “<a href="https://agilemanifesto.org/">people before processes</a>”. After close encounters with Scrum, this changed my perception of software engineering.</p><p>The <strong>ML efforts had the complete support of the company</strong>, and I was fortunate that the CTO had a passion for ML, having led ML projects for the past few years. There had been some temporary contractors who had done some initial AI work for Vic. Some of the organizational planning was solved before I started, and there was implicitly already a type of “Agile CRISP-DM” framework in practice.</p><p>My team consisted of <strong>2–4 experienced backend and ML developers for the first three years, and this was the ideal team size</strong> for building the foundation of the AI codebase. Later, I expanded this into an 8-person MLOps team with more specialized roles. The work was asynchronous and fully remote, with typically weekly or biweekly meetings over a Kanban board. Areas of responsibility were clearly defined as per <a href="https://en.wikipedia.org/wiki/Conway%27s_law">Conway’s Law</a>, with the main splits being between backend/ML and dev/ops.</p><p><strong>The team worked on a DevOps basis</strong>, both developing and maintaining the code in production with regular release cycles. If there were requests from other teams, these were addressed first, so that their work was unblocked. Our requests to other teams were handled likewise, usually within a day or two, so that company-wide goals progressed rapidly. This prevented silo effects from blocking projects and allowed us to consider new projects since we could trust to have rapid support and prioritization from other teams. Typically around half of any member’s work time went to development, and the other half to responding to issues and requests.</p><p>The goals and milestones for the team were negotiated at the company level, and <strong>projects were handled autonomously</strong> by the team. This meant that tasks were often rapidly added, changed, and reprioritized between sync calls. Early termination, parallel tasks, task halting, and even failures were all normal parts of the process. In the Scrum context, these would be unthinkable, but for developing AI this is just the normal routine. What mattered was reaching the long-term goals, not the outcome of individual tasks.</p><p>Another aspect of this framework was fully <strong>data-driven development for AI</strong>. Instead of executives mandating “use deep learning to solve X”, every problem went through the same process. The best solution for the problem could be string matching completed within a day, a complex AI solution taking several months to develop, or reporting that the problem would need to be revised. All of these were common outcomes. Using this approach, the best solutions for problems were achieved at a fast rate of completion. The overall outcome was an AI system that combined techniques from traditional software and AI, selected by data-driven analysis for each case.</p><h3>Data-centric AI</h3><p>Some time after developing my first models, I got feedback about one. Reported accuracy from initial testing was around 30%. This was stunning, as we trusted the development metrics, which gave good results for the model. Looking into the details, it seemed there were multiple data quality issues for any type of AI trained from this data. I understood that this was a technical problem and we could still produce high-accuracy models, by <strong>treating the data preprocessing and model development as a single problem</strong>. I started working on solutions for this type of AI, like many others who discovered the limits of model-centric AI, and around this time the field was named “data-centric AI”.</p><p><strong>Developing labeling processes through “label engineering”</strong> was a critical type of data-centric AI for us. There are various data quality problems in accounting platforms, but the most severe for AI is that label information is often uncertain, incomplete, incorrect, outdated, or available as indirectly matchable meta-data. As a thumb rule, 20% of labels are missing or have wrong values. Supervised ML trained on the data requires correct label information, or it reproduces the errors seen in training. Some of the techniques I used to address this included noisy regex matching, score-based heuristics, decision trees, information theory-based matching, and model-based pseudo-labeling. In some cases, these were best applied as an external process. In other cases, it was useful, even mandatory, that the ML model had an internal labeling process. For all of the problems I encountered, various techniques could be combined to yield high-quality training data, although at the cost of engineering and analyzing the labeling process for each model.</p><p>The labeling processes were the most crucial part to get completed, but <strong>data-centric AI presents a whole host of challenges on top of normal DevOps for ML</strong>. As more models were deployed and more customers were onboarded, more different types of data issues would arrive. These included data conversion issues, OCR errors, platform bugs, etc. Data issues would be detected from a variety of sources: release QA, incident management, client feedback, bug reports, monitoring, data validation, metrics, etc. Many more went undetected until exploratory data analysis (EDA) was done, which took time. I essentially needed to automate EDA for data quality and found a dedicated developer to work on this as my first hire to the team.</p><p>Detecting the issues was crucial, but soon the majority of our time went to maintaining the models and acceptable accuracy. It was obvious that <strong>we’d need better tooling and processes in the long run</strong>. Some of the ops toolings we built early on were metrics and monitoring dashboards, with support from the engineering ops team. On the model side, we built held-out testing of all models as part of training, as well as model-testing with a worker process at each pull request, and a QA procedure following each release. The model-testing was a game-changer in preventing any production issues from models. We had close to no model failures and had to roll back models around once a year, due to having these tests in place. One additional layer of prevention I did was adding variable typing and validation to all of the models so that data incoming to the models was always typed and validated.</p><h3>Autonomous AI</h3><p>Once I had tackled the main data quality problems in building ML models in this domain, I started developing the autonomous AI solution for invoice processing. This was a challenging task, as there was no existing research on the topic, and it wasn’t known how well this could be done with the current technology. But, <strong>I saw no problems from an ML design point of view</strong>. I had access to massive amounts of data, solid support from both engineering and management, and relaxed time-frames to build the solution. I had zero doubts about accepting the challenge.</p><p>The <strong>autonomous AI problem in accounting has some simplifying properties,</strong> compared to the commonly known problem of autonomous driving. Most importantly, we don’t need to automate all documents. With autonomous driving, the AI can’t choose to stop controlling the vehicle in a difficult situation. In our case, it is acceptable or even desirable that an anomalous document will get sent for human review instead of automation. Another simplification is that automation error rates don’t need to be arbitrarily close to 0. With autonomous driving, any type of error has a potential cost of a life. In our case, the worst types of errors can be easily prevented, many types of errors are inconsequential or average out, and many important types require only an error rate matching humans.</p><p>A <strong>key advantage was that I was designing the system on top of the platform we controlled</strong>, which at this stage was processing invoices for hundreds of companies, with an exponentially growing stream of documents. This meant I could develop the system to work on exactly the stream of data that it was deployed on, eliminating any bias coming from transferring an ML model from an external source. Also, I could fix any ML components causing issues, and request changes when needed to the backend, and the increasing data volume would enable better modeling later.</p><p>One complication in our case was the number and diversity of required predictions to automate. To automate the accounting workflow, the AI needed to predict all of the outcomes produced by an accountant, for invoices in different languages and legislations. Fortunately, <strong>AI toolkits were going through constant evolution, providing better tools to address each modeling problem</strong>. When I started, Vowpal Wabbit and CPU-based gradient boosting were industry-standard solutions for large-scale problems. Available ML tools have since gone through numerous developments, such as GPU-based gradient boosting, Pytorch for deep learning, and transformer-based AI. Transformers in particular is a true revolution in applied ML and could become for AI what transistors were for electronics. This expanding toolkit allowed the design of solutions that were inconceivable just a few years before.</p><p>It took me a couple of months of focused work, and a third major iteration of the modeling approach to find a solution that worked well. I proposed the name “Accounting Autopilot” for the product, which got shortened to Autopilot. The <strong>solution was conceptually simple but would require considerable work getting the details right</strong>. Any solution to this problem would require high accuracy from all of the ML components, consistency of the platform, and detailed information from the platform at the time of each prediction. This meant I had to double down on the data-centric AI efforts, but at the same time, we were growing exponentially, so we had to upscale our AI stack and platform to match the growth.</p><h3>Scaling AI on the Cloud</h3><p>Since the beginning, we’ve had a partnership with one of the largest accounting technology companies in the Nordics, providing access to hundreds of millions of invoices. As we expanded across US and EU, I had data on a similar scale arriving from multiple regions from our clients. It was clear <strong>the solution needed to scale massively, regularly training and predicting on millions of documents</strong>. The AI had to be scalable from the beginning, and portable to distributed cloud-based processing. Effectively this is composed of two parts: writing efficient, maintainable, and distributable code, and setting up distributed processing for both training and prediction.</p><p>The choice of Python tooling and best practices was a simple way to improve scalability. I discarded Jupyter Notebooks from any prototyping work. Instead, <strong>we deployed the same Python scripts that were prototyped</strong>. Soon after I came across Joel Grus’s famous “<a href="https://conferences.oreilly.com/jupyter/jup-ny/public/schedule/detail/68282.html">I Don’t Like Notebooks</a>” presentation, which said everything I had been thinking about notebooks. Deploying scripts instead of notebooks removed the time required for production conversions, and meant that production issues could be debugged using the same exact code offline. The scripts could be optimized much further as well, starting with multiprocessing and serialization. This was done as far as reasonable with the Python data stack, so the base cost of operating the models was minimized. This included caching dataframes, Cython extensions for critical model code, use of GPU where possible, model pruning and compression, and regular analysis and optimization of processing bottlenecks.</p><p>A while before Vic, I had worked with Spark for a couple of years. The functional MapReduce paradigm it offered was exciting, but the PySpark integration had fundamental shortcomings. Inspired by Spark, I developed my own Python library <a href="https://github.com/anttttti/Wordbatch">Wordbatch</a>, which could do MapReduce processing of any Python method or function, executed by a chosen scheduler backend, such as a serial process, multiprocessing, Dask, or Spark. I could <strong>develop code on a single node, and scale it on the cloud using Wordbatch, with nearly linear speedups in the number of cores</strong>. On a single 128-thread workstation, Wordbatch speeded up most bottlenecks by 100x, enabling fast development iteration and model training. Soon after developing the first models, Ray was announced. I started <a href="https://towardsdatascience.com/benchmarking-python-distributed-ai-backends-with-wordbatch-9872457b785c">using Ray as a Wordbatch backend extensively</a>, for both model development and training. It simplified using nested parallelism and allowed production training of models at a massive scale at a low cost. Today, we train and operate hundreds of thousands of models simultaneously in production.</p><p>On model serving, I considered the alternatives, as our initial Celery-based workers were not scalable or reliable. A couple of the senior developers in the team thought about the FastAPI-based model serving. I considered FastAPI or Ray Serve, and even discussed with the FastAPI creator Sebastián Ramírez about collaborating with us. Ultimately, the Ops team was determined on AWS serverless processing and wanted us to use Lambda and other AWS serverless tools. The choice was up to the backend developers, and the<strong> model serving side was scaled with AWS serverless tooling</strong>.</p><p>The third type of cloud computing was the <strong>use of external AI microservices</strong>. When I started these were not available, but over the past four years, the cloud giants (Amazon, Google, Microsoft) started to offer an increasingly comprehensive selection of AI APIs, many usable for the type of document processing we were doing. None of these directly competed with our AI but offered useful basic building blocks for building a solution, including OCR, machine translation, table processing, document AI, etc. I organized systematic evaluations on many of these, and we started using external APIs for some AI workloads. This had several benefits: the external services were scalable and reliable, the costs of each process were known, and the AI results were high accuracy in many cases. I could jumpstart projects knowing that the external API could be deployed to production within a couple of weeks, and the executive threshold for approving projects was reduced, compared to launching internal R&amp;D efforts with uncertain costs and outcomes.</p><h3>Building an MLOps Team</h3><p>Building and maintaining a <strong>commercial AI such as ours eventually required a larger team</strong>, due to the high requirements for accuracy and automation. I recruited the teams for Vic.ai in two stages, first as the 2–4 person ML team to build the initial solution, then expanding this to an 8-person MLOps team once the workloads became unsustainable for the small team. I received the full support of the execs to proceed with this, and personally planned each role and conducted the hiring processes.</p><p>One obstacle during this time was the “<a href="https://en.wikipedia.org/wiki/Great_Resignation">Great Resignation</a>” which was starting to affect hiring in AI. Especially US-based candidates had a wide selection of companies to choose from, high expectations for the role, and a low threshold to move on. Rather than compete for the talent pool in the US,<strong> engineering had the idea early on to hire EU-based developers</strong> and started an engineering office in Oslo before covid. Many of these early developers were great hires and became valuable contributors.</p><p>I took this idea further and decided to hire in regions with time zones close to New York and Oslo, but with better talent pools for hiring: especially <strong>developers with advanced engineering degrees in data and ML, but with limited local AI companies to offer them roles</strong>. For Oslo, countries such as Poland, Spain, Portugal, Italy, and France had good engineering colleges and universities, but limited AI startup scenes. For New York, Brazil and Canada were countries with similar qualities. Thanks to remote work, developers in the southern hemisphere were just as close to collaboration. Only the time difference to their team mattered, and even this not much.</p><p>I planned <strong>each role according to current and future requirements we’d have for operating the AI</strong>, roughly corresponding to Google’s “<a href="https://cloud.google.com/architecture/mlops-continuous-delivery-and-automation-pipelines-in-machine-learning">Data science steps for ML</a>”. For the small team, the hires were for data analysis, OCR, and backend engineering. With the larger team, I divided the team into data, ML, and ops, with at least 2-3 people operating each area. This meant that for each area of the codebase there would be at least two people who knew that area in detail, in case of the proverbial bus incident, as well as to have multiple developers for pair coding on each area. The overall goal of the larger team would be building towards <a href="https://cloud.google.com/architecture/mlops-continuous-delivery-and-automation-pipelines-in-machine-learning">full MLOps maturity</a>. All candidates were required to have a minimum of a CS-related degree, some years of commercial software development experience, and specialization skills for their role.</p><p>The rest of our process was fairly standard. For <strong>all roles, we had multiple interviews, with the full team given a chance to interview and veto a candidate</strong>. All our advertised positions received hundreds of candidates, some thousands, so we needed to efficiently screen the suitable hires if any were available. From the beginning, I conducted an initial screening interview, followed by a technical interview with the team, a coding test, and a final interview with one of the execs present. For the larger team, we had support from a technical recruiter, including an additional HR screening round. The process created a funnel that selected suitable candidates, but the time committed by the team was still considerable. Overall this was worth it. We got amazing coworkers who started contributing from their first weeks.</p><h3>Epilogue</h3><p>The most important lesson from these years is that the <strong>organizational foundation is a key requirement for building an AI solution</strong>. This includes several matters outside the work of AI developers, including the company vision, culture, executives, product, and industry connections. The executives and culture are required for AI development to have sufficient support and autonomy to succeed, while other matters external to AI development determine if the developed solution will lead to success in the market.</p><p>The success with Vic has shown that <strong>autonomous small remote teams are highly effective in building commercial AI</strong>. During the first 4 years, I designed, developed, and trained all of the models deployed in production, while the 1–3 other developers in the ML team handled the required ops, data engineering, and backend workloads. Moreover, the work was conducted almost entirely remotely, due to the pandemic. The effectiveness of small teams is well established in software engineering, and AI is not an exception. The crucial difference is in task management, where AI and data science require a different process at the project level.</p><p>Building a <strong>commercial AI solution is altogether separate from what is learned in ML degrees, research, or competitions</strong>, even if the theory and tools learned from these provide the required technical foundation. Commercial AI solutions are built in a cutting-edge environment, where the product vision strives for solutions not possible with last-generation technologies, and perhaps not with current ones. At the same time, the data-centric and scalability considerations introduce additional layers of complexity to the design problem. Finally, the work integrates with software engineering and product management, in a dynamic environment where various events determine the planning and long-term goals.</p><p>We’re <strong>currently in a golden age for AI</strong>, with the amounts of research, data, computation, software, developers, applications, companies, and funding <a href="https://aiindex.stanford.edu/report/">all growing at exponential rates for the past decade</a>. This is a period similar to what the 90s were for PCs when every year brought unexpected ways to use increasingly better computers. At the same time, there’s increasingly heavy competition from both startups and the cloud giants. If one wants to build a product in AI, one strategy is to target a new AI application and establish a leadership position, much like Vic has done with autonomous accounting. Most of all, this is a time to be excited about the numerous uses for AI that are coming available.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dcc98d39d6f7" width="1" height="1" alt=""><hr><p><a href="https://pub.towardsai.net/a-journey-in-building-data-centric-autonomous-ai-dcc98d39d6f7">A Journey in Building Data-Centric Autonomous AI</a> was originally published in <a href="https://pub.towardsai.net/">Towards AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python One-liner Distributed Acceleration with Wordbatch Apply]]></title>
            <link>https://medium.com/data-science/python-one-liner-distributed-acceleration-with-wordbatch-apply-efccecec22dd?source=rss-d31c16454dd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/efccecec22dd</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Antti Puurula]]></dc:creator>
            <pubDate>Sun, 05 Jan 2020 05:41:50 GMT</pubDate>
            <atom:updated>2020-01-06T00:52:14.839Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>Using the Wordbatch Apply-decorator to Process Any Function by Distributed Map-Reduce</em></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ytpbOXtVALK37n6tHoHIjg.jpeg" /></figure><h3>Python One-liner Distributed Acceleration</h3><h4>Parallel and Distributed Python</h4><p>Computing hardware is undergoing a period of rapid evolution due to advances in semiconductor manufacturing processes, with 64-core consumer CPUs and 80-core server CPUs arriving at the market this year. This is bringing about a quantitative leap in CPU performance, after a decade of stagnant development.</p><p>Utilising this increased parallel computing power in Python programs is best done using the multiprocessing library, due to the Global Interpreter Lock (GIL) complicating efficient thread-level parallelism. However, multiprocessing is limited to a single computing node, and setting up multiprocessing tasks requires additional boilerplate code for each task to be parallelized.</p><p>Recent distributed Python processing frameworks such as <a href="https://github.com/ray-project/ray">Ray</a>, <a href="https://github.com/dask/dask">Dask</a> and <a href="https://github.com/apache/spark">Spark</a> enable distribution of Python processes and data much like multiprocessing, but across a network of workers. <a href="https://github.com/anttttti/Wordbatch">Wordbatch</a> is a toolkit that enables using these frameworks as swappable distributed backends. It provides the orchestrator class Batcher, which distributes pipelines of processing tasks on a distributed backend, or a local one, such as multiprocessing or <a href="https://github.com/tomMoral/loky">Loky</a>. The most basic pipeline is the Apply-class, which takes an input function, and runs it as a single Map-Reduce operation on the backend.</p><h4>Simple Distributed Map-Reduce with the Apply Decorator</h4><p>Apply is a minimal processing pipeline taking a function or method, and executing it as a minibatch Map-Reduce operation to any iterable data, such as a list, Numpy array, Pandas Series or DataFrame. Starting from <a href="https://github.com/anttttti/Wordbatch/releases/tag/1.4.4">Wordbatch 1.4.4</a>, you can import a decorator wrapper to Apply, called decorator_apply, or imported simply as apply. Apply can be used as a Python “@” decorator, or calling it on a function to distribute, as is done in this article. Simply:</p><pre><strong>from </strong>wordbatch.pipelines <strong>import </strong>decorator_apply <strong>as </strong>apply<br>results = apply(function_or_method)(iterable_data)</pre><p>This produces a one-liner Map-Reduce convention for list operations, that can be conveniently used throughout compute-intensive Python programs, AI and data science pipelines in particular.</p><p>The example above uses the default Python multiprocessing backend with all available cores on the computing node. We can choose the backend by passing a Batcher object that has been initialized with the backend, and optionally the backend handle for distributed processing. With Ray this would be done as follows:</p><pre><strong>import </strong>ray<br>ray.init(redis_address=IP+&quot;:&quot;+PORT) # Or ray.init() for local-only<br>batcher = Batcher(backend=&quot;ray&quot;, backend_handle=ray)</pre><pre>results = apply(function_or_method, batcher)(iterable_data)</pre><p>By changing the backend and backend_handle arguments for Batcher, one can easily choose the backend. In fact, the backend is swappable, so that simply changing the batcher.backend and batcher.backend_handle attributes between processing runs will change the scheduler.</p><p>Apply was initially added as a basic minimal pipeline template to Wordbatch. However, as known to those familiar with the Map-Reduce framework, entire data processing pipelines can be executed as Map-Reduce operations over a large network of computing nodes. Aside from feature engineering pipelines shown in this blog post, other practical tasks for Apply include distributing:</p><ul><li>AI model training by data/parameter subsets</li><li>AI model inference by data/parameter subsets</li><li>general compute-intensive functions by input subset</li><li>hyperparameter optimizations by hyperparameter configurations</li></ul><p>The following code snippets are adapted from the <a href="https://github.com/anttttti/Wordbatch/blob/master/scripts/decorator_test.py">benchmark script</a>, which runs benchmarks using different backend schedulers to Apply. These examples can be easily adjusted for real-world use cases.</p><h4>Accelerating Global and Local Functions</h4><p>As a first example, we can distribute a <strong>global function</strong> “normalize_text” across an iterable of text strings, and store the result as a column “text” in a DataFrame “df”:</p><pre><strong>def </strong>normalize_text(text):<br>   text= <strong>&quot; &quot;</strong>.join([word <strong>for </strong>word <strong>in </strong>re.compile(<strong>&#39;[\W+]&#39;</strong>).sub(<strong>&quot; &quot;</strong>,text.lower()).strip().split() <strong>if </strong>len(word)&gt;1])<br>   <strong>return </strong>text</pre><pre>df[<strong>&#39;text&#39;</strong>] = apply(normalize_text, batcher)(texts)</pre><p>References to global functions and variables get automatically sent to each new process. This makes serialization of all required objects trivial, but with longer programs unnecessary variables left in the global namespace will add to the parallelization overhead. <strong>Local functions</strong> are used the same way as global ones, but standard Python multiprocessing won’t serialize a local function. Loky-fork of multiprocessing and the distributed backends will handle local functions.</p><h4>Lambda Functions and Object Methods</h4><p>Other types of functions are accelerated just as easily, with minor caveats. We can accelerate a <strong>lambda function</strong>:</p><pre>df[<strong>&#39;first_word&#39;</strong>] = apply(<strong>lambda </strong>x: x.split(<strong>&quot; &quot;</strong>)[0], batcher)(df[<strong>&#39;text&#39;</strong>])</pre><p>Just like local functions, lambda functions are not serialized by standard Python multiprocessing. There are many workarounds for this, such as using Loky, or just defining the lambda function as a global function instead.</p><p>An <strong>object method</strong> can be accelerated the same way:</p><pre><strong>from </strong>nltk.stem.porter <strong>import </strong>PorterStemmer<br>stemmer= PorterStemmer()</pre><pre>df[<strong>&#39;first_word_stemmed&#39;</strong>] = apply(stemmer.stem)(df[<strong>&#39;first_word&#39;</strong>])</pre><p>With object methods no changes are updated to the original object from the method call, since the method is executed on parallelized copies. If changes are required, basic use of Apply wouldn’t be sufficient. A workaround in many cases would be a more complex pipeline, handling both the processed list data, and updates to the parallelized object.</p><h4>Pandas GroupBy Operations</h4><p>Finally, Pandas GroupBy aggregations are a very common type of data processing operation, often forming the bottlenecks in AI and data science processing pipelines, such as feature engineering tasks. There are several ways to use Apply here, for example:</p><pre>batcher.minibatch_size = 200<br>group_ids, groups = zip(*df[[<strong>&#39;first_word_stemmed&#39;</strong>, <strong>&#39;text&#39;</strong>]].groupby(<strong>&#39;first_word_stemmed&#39;</strong>))<br>res = apply(<strong>lambda </strong>x: x[<strong>&#39;text&#39;</strong>].str.len().agg(<strong>&#39;mean&#39;</strong>), batcher)(groups)<br>df[<strong>&#39;first_word_stemmed_mean_text_len&#39;</strong>] = df[<strong>&#39;first_word_stemmed&#39;</strong>].map(<br>   {x: y <strong>for </strong>x, y <strong>in </strong>zip(group_ids, res)})</pre><p>The aggregation results are mapped back to the original DataFrame using the group ids of the GroupBy. For the purpose of clarity, the operation is expanded into three lines. The minibatch size for Batcher is modified to 200 from the default 20000, since there will be a relatively small number of groups to iterate through, compared to the original DataFrame rows.</p><p>A problem with any group-wise parallelized GroupBy operation is that with real data groups are unevenly distributed, often following a power-law distribution, with most groups having few members. This often negates any benefit from parallelization, since simple per-group operations result in a large parallelization overhead compared to the gains. A simple non-optimal solution is to bin the grouping variable, by hashing and binning it to produce a less sparse grouping variable, and then do the original GroupBy-operations within each binned GroupBy, as follows:</p><pre>batcher.minibatch_size = 10<br>df[<strong>&#39;first_word_stemmed_hashbin&#39;</strong>] = [hash(x) % 500 <strong>for </strong>x <strong>in </strong>df[<strong>&#39;first_word_stemmed&#39;</strong>]]<br>_, groups = zip(*df[[<strong>&#39;first_word_stemmed&#39;</strong>, <strong>&#39;text&#39;</strong>, <br><strong>&#39;first_word_stemmed_hashbin&#39;</strong>]].groupby(<strong>&#39;first_word_stemmed_hashbin&#39;</strong>))<br>res = pd.concat(apply(<strong>lambda </strong>x: x.groupby(<strong>&#39;first_word_stemmed&#39;</strong>).apply(<strong>lambda </strong>z: z[<strong>&#39;text&#39;</strong>].str.len().agg(<strong>&#39;mean&#39;</strong>)), batcher)(groups))<br>df[<strong>&#39;first_word_stemmed_mean_text_len&#39;</strong>] = df[<strong>&#39;first_word_stemmed&#39;</strong>].map(res)</pre><p>Compared to the unbinned parallel GroupBy, the “first_word_stemmed” variable is now the unbinned variable that gets processed within each minibatch, and “first_word_stemmed_hashbin” is the binned grouping variable that splits data into the distributed minibatches. Here 500 bins are used for the binning variable, and the minibatch size for batches is reduced to 10, as each minibatch has more data now on average. Optimal values for these depend on the data.</p><h3>Minibatch Speedup Options: Cache and Numba Vectorize</h3><p>Apply also has basic options for per-minibatch acceleration with caching and vectorization. Cache uses functools.lru_cache of the chosen size to store results within each processed minibatch, and should be used when there are multiple repeated values and each function to evaluate is costly. Vectorize uses Numba vectorization of the function, and can be used when the input and output variable types are known in advance.</p><p>Taking the stemming example, caching can be simply added:</p><pre>df[<strong>&#39;first_word_stemmed&#39;</strong>] = apply(stemmer.stem, cache=1000)(df[<strong>&#39;first_word&#39;</strong>])</pre><p>Running combinations of the speedup options, backends and tasks reveals some edge cases where workarounds are needed. For instance, caching with lru_cache won’t directly work with DataFrames, as DataFrames are mutable, and lru_cache will only take immutable input data.</p><p>Accelerating the minibatch processing with Numba is supported for basic cases. Following shows an example with two input variable columns:</p><pre><strong>def </strong>div(x, y):<br>   <strong>return </strong>0 <strong>if </strong>y==0 <strong>else </strong>x / y</pre><pre>df[<strong>&#39;len_text&#39;</strong>] = df[<strong>&#39;text&#39;</strong>].str.len().astype(int)<br>df[<strong>&#39;len_text_normalized&#39;</strong>] = df[<strong>&#39;text_normalized&#39;</strong>].str.len().astype(int)</pre><pre>#Without Wordbatch, plain zip comprehension<br>df[<strong>&#39;len_ratio&#39;</strong>] = [div(x, y) <strong>for </strong>x, y <strong>in </strong>zip(df[<strong>&#39;len_text&#39;</strong>], df[<strong>&#39;len_text_normalized&#39;</strong>])]</pre><pre>#With Batcher, no Numba<br>df[<strong>&#39;len_ratio&#39;</strong>] = apply(<strong>lambda </strong>x:div(*x), batcher)(df[[<strong>&#39;len_text&#39;</strong>, <br><strong>&#39;len_text_normalized&#39;</strong>]].values)</pre><pre>#With Batcher and Numba vectorization<br>df[<strong>&#39;len_ratio&#39;</strong>] = apply(div, batcher, vectorize=[float64(int64, int64)])(df[[<strong>&#39;len_text&#39;</strong>, <strong>&#39;len_text_normalized&#39;</strong>]].values)</pre><p>Here the Numba variable types for vectorizing the “div” function are defined as the argument “vectorize=[float64(int64, int64)” ]. Float64 defines the output variable type, and int64s define the input variable type. The input for Batcher is constructed by selecting the 2-d Numpy array from the DataFrame columns “len_text” and “len_text_normalized”.</p><p>The main caveat with Numba is that it is still not a fully developed framework, and for more complex examples than this one would need a good understanding of Numba internals. For example, vectorizing over array inputs requires Numba guvectorize instead of the vectorize decorator, and several changes required by this. Numeric multidimensional array operations is where Numba could offer considerable acceleration over native Python code, including GPU acceleration with Cuda. But since these are complicated to set up and extend, a more promising path for mini-batch acceleration could be using Python extensions written with a full low-level language such as C, Cython, or Rust.</p><h3>Benchmarks</h3><p>The acceleration speedups can be compared to a baseline function without Apply, and with different scheduler backends for Batcher. Following numbers are from running the <a href="https://github.com/anttttti/Wordbatch/blob/master/scripts/decorator_test.py">benchmark script</a> on each backend separately. Tests times are from using a single i9–9900k CPU with 8 cores and 16 threads, running at 4.9GHz with all cores. All of the tests were run on over 1.28M rows of text data from Tripadvisor reviews, using minibatch sizes of 5000 for functions aside the GroupBy aggregations.</p><p>The first example used Apply to distribute a global text normalization function. This does relatively complex processing for each processed string, so the speedup is nearly core-linear with both Loky and Ray backends, with 6.9x speedup for Ray, and 6.6x speedup for Loky.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*c4dIXrrATIpO7oUxUb1A0Q.png" /></figure><p>Moving on to the lambda function splitting the first word of each textline, and the object method stemming the first word, we get smaller speedups, but still multiple times faster than not using Wordbatch, or using a single process as the backend. For splitting we get 1.8x speedup with Loky, and 3.2x speedup with Ray. For stemming these are 3.1x for Loky, 5.14x for Ray. Both operations are still relatively complex, so gains are achieved despite the parallelization overhead.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*wco2iEF4Zn7Q7y-a4HYK8w.png" /></figure><p>Comparing the GroupBy mean aggregation, we get the first case where parallelization doesn’t directly give a speedup. Since most of the groups distributed have only a few members, and the mean operation for each group is very simple, the parallelization overhead dominates the results of a simple parallelized GroupBy. When using a binned GroupBy with Ray backend, we still get a 1.9x speedup over not using Batcher. If a more intensive list of operations was done within each binned GroupBy, the speedups would again be closer to linear.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*BUWCtIf0YlJoROpwJN0PQw.png" /></figure><p>Caching seems to have a massive effect when applied to stemming. Since the input is highly repetitive and the per-item cost is high, caching works in this scenario. Best results are achieved without Batcher, where the lru_cache of 1000 items achieves 0.37s compared to 10.72s without caching. Applying caching within each minibatch of a Ray backend, we get 0.42s. If caching is exceptionally useful, it can be better not to use parallelization. Some use cases could benefit from both parallelization and within-minibatch caching.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*35jevhJGiEM-vp4Nm45hZw.png" /></figure><p>Finally, we can look at how well Numba vectorization works, when distributing a simple division function between two columns. The cost of compiling the Numba function within each minibatch far outweight the gain from parallelizing this simple function. The “no Wordbatch” baseline here additionally uses list comprehension instead of Numpy vectorized array division, which would be many times faster still. Overall, distributed Numba vectorization will only be useful for more complex mathematical expressions, but these could be limited by current Numba capabilities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*EAXFDRwBYNXOrnoM5QOX5g.png" /></figure><h3>Concluding Thoughts</h3><p>This blog post introduced basic use cases of the recently added apply-decorator in the Wordbatch toolkit. This provides a simple one-liner call that takes any Python function or method and distributes it on a Map-Reduce basis across a chosen backend, either locally or distributed on a scheduler such as Ray, Dask or Spark. Correct use can give close to linear speedups in the number of available cores for many processing tasks.</p><p>Taking full advantage of the apply-decorator requires some understanding of the computational costs of parallelization and the functions that are parallelized. If the methods are very computationally simple compared to the parallelization overhead, then there is little gain. If the opposite is true, one approaches linear speedups.</p><p>For real-world AI pipelines parallelization is best done at the highest level, distributing an entire pipeline function over large minibatches. This reduces the parallelization cost to a single data transfer to the processes, and each large mini-batch can be processed with the full pipeline. With the apply-decorator this can be done by distributing a per-DataFrame function over large groups, as shown in the binned GroupBy example. Alternatively, Wordbatch has a related class ApplyBatch and its decorator function decorator_apply_batch. These work like Apply, but apply functions to evenly-split batches directly, and don’t require setting up variable binning as with the binned GroupBy. My first <a href="https://towardsdatascience.com/benchmarking-python-distributed-ai-backends-with-wordbatch-9872457b785c">blog post</a> comparing the Python distributed AI backends gave an example of using ApplyBatch.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=efccecec22dd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/python-one-liner-distributed-acceleration-with-wordbatch-apply-efccecec22dd">Python One-liner Distributed Acceleration with Wordbatch Apply</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Benchmarking Python Distributed AI Backends with Wordbatch]]></title>
            <link>https://medium.com/data-science/benchmarking-python-distributed-ai-backends-with-wordbatch-9872457b785c?source=rss-d31c16454dd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/9872457b785c</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[wordbatch]]></category>
            <category><![CDATA[towards-data-science]]></category>
            <category><![CDATA[big-data]]></category>
            <dc:creator><![CDATA[Antti Puurula]]></dc:creator>
            <pubDate>Sun, 23 Jun 2019 14:46:24 GMT</pubDate>
            <atom:updated>2019-06-26T06:10:46.024Z</atom:updated>
            <content:encoded><![CDATA[<h4>A comparison of the three major backend schedulers: Spark, Dask and Ray</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yf4YiRUe6wAcScrb4pDQBA.png" /></figure><h3>Towards Distributed Artificial Intelligence</h3><p>Over the last few years Python has become the lingua franca of data science and artificial intelligence, with all of the prominent deep learning frameworks (Keras, Pytorch, MXNet) using Python as their main interface language. Compared to competing languages, Python rivals or exceeds in almost every aspect of DS&amp;AI: latest machine learning algorithms and their efficient implementations (Scikit-Learn, LightGBM, XGBoost), data manipulation and analysis (Pandas, cuDF), efficient numerical computation libraries (Numpy, PyPy, Numba), GPU computing (CuPY), and web API programming (Flask, Celery).</p><p>The Achilles heel of Python is its weakness in parallel multi-threaded and multi-process workloads, due to the Global Interpreter Lock (GIL) as a part of its core design. This has produced workaround solutions within the Python camp, as well as alternative languages with more emphasis on parallelism, such as GoLang. The need for parallelism has been accelerated by an ongoing arms-race period in hardware: consumer CPUs have gone from 4 cores to 32 cores (AMD 2990WX) in a matter of a few years, and affordable cloud computing nodes now provide 224 cores each (Amazon u-6tb1.metal).</p><p>For AI the need for parallelism is not just with single workstations or computing nodes, but for orchestrating AI processing pipelines distributed across potentially thousands of computing nodes. Similarly to the changes in CPU cores, network transfer speeds have gone from 1 Gb/s to commodity 10–100 Gb/s connections for both local and cloud use. Until recently much of this type of Big Data technology was based on Java frameworks such as Hadoop, but the changes in both software and hardware have brought about new types of solutions, including three major Python distributed processing frameworks for AI: PySpark, Dask, and Ray.</p><h3>Distributed Batch Processing Frameworks</h3><p>Apache Spark and its Python interface PySpark is the oldest of the frameworks, with initial GitHub version going back to 4th Oct 2010. Spark established itself as one of the main Big Data technologies, gaining wide adoption in the enterprise world. It provides an extension of the Map-Reduce programming paradigm, which solves batch-processing tasks by mapping a larger task into set of mini-batches distributed to workers (Map), and combines the results after each mini-batch has completed (Reduce). Spark processes Directed Acyclic Graphs (DAG) of Map-Reduce computing pipelines, keeping data distributed across workers throughout processing a DAG. The task graph is functionally defined, and tasks are executed lazily after optimizing the DAG computation order.</p><p>Both Dask and Ray build on Spark’s central idea of concurrent functional evaluation of a DAG, with data kept distributed throughout the process. Dask and its scheduler backend Distributed is a more recent framework, with original GitHub version on 29 Jan 2015. Whereas Spark was written for Java and Scala, Dask is written for Python and provides a rich set of distributed classes. Dask also provides a richer lower-level API, with support for actor classes that are crucial for distributed training of AI models.</p><p>Ray is the latest framework, with initial GitHub version dated 21 May 2017. Like Dask, Ray has a Python-first API and support for actors. It has several high-performance optimizations that make it more efficient. Unlike Spark and Dask, tasks are executed eagerly within each node, so that each worker process starts as soon it receives the data it needs. Data within a worker node is stored using Apache Arrow objects, that provide zero-copy sharing of objects between all processes that work on the node. The worker nodes have their own local schedulers, further reducing the overhead to the global scheduler.</p><h3>Wordbatch</h3><p>The three frameworks differ widely in the design and implementation of their scheduler engines: serialization, transfer, scheduling, need for configuration, memory requirements etc. It is difficult, if not impossible, to say for a given complex task which engine would work the best. For some tasks a specific framework wouldn’t work at all. Spark lacks actors, complicating large-scale training of models. Dask doesn’t serialize complex dependencies. Therefore, both for performance and feasibility it’s useful to test each framework for a given task, and choose one that works.</p><p>Wordbatch library v. 1.4 does batch-processing of pipelines, using swappable scheduler backends. Its orchestrator class Batcher keeps a reference to a backend handle, and handles mapping of tasks into mini-batches and reducing the results. The scheduler backend is swappable, so that if one backend can’t handle a processing task, any other backend can be swapped simply by replacing the Batcher object’s backend and backend_handle attributes. It supports both local (serial, threading, multiprocessing, Loky) and distributed backends (Spark, Dask, Ray). The distributed frameworks are similarly called, with data kept distributed throughout the pipeline, when possible.</p><p>Wordbatch also comes with a set of pipelines and classes that provide a full set of tools for text-based machine learning, and can serve as templates for processing in other domains. The Wordbatch classes can independently call Map-Reduce operations on Batcher if needed, and support both distributed storage throughout a pipeline, and stream processing with fit_partial() -methods.</p><h3>Benchmark Setup</h3><p>We can use Wordbatch as a neutral benchmark to test the three distributed frameworks, as well as the non-distributed backends as baselines. To keep the comparison simple, we’ll use two basic pipelines under two hardware setups. Both tasks use up to 1.28M reviews from the TripAdvisor review dataset <a href="http://times.cs.uiuc.edu/~wang296/Data/">http://times.cs.uiuc.edu/~wang296/Data/</a>.</p><p>Full version of the benchmark script is available at <a href="https://github.com/anttttti/Wordbatch/blob/master/scripts/backends_benchmark.py">https://github.com/anttttti/Wordbatch/blob/master/scripts/backends_benchmark.py</a>. For both tasks the test script initializes Batcher as follows:</p><pre><em>from wordbatch.batcher import Batcher<br>batcher = Batcher(procs=16, minibatch_size=5000, backend=backend[0], backend_handle=backend[1])</em></pre><p>Here “procs” are the number of processes used, “minibatch_size” is the number of data rows to be processed in each mini-batch, “backend” is the name of the backend, and “backend_handle” gives an API handle for Batcher to communicate.</p><p>The first pipeline <strong>ApplyBatch</strong> runs a Scikit-learn HashingVectorizer on each mini-batch of reviews and returns the reduced sparse matrix of hashed features.</p><pre><em>from sklearn.feature_extraction.text import HashingVectorizer<br>from wordbatch.pipelines import ApplyBatch<br>hv = HashingVectorizer(decode_error=’ignore’, n_features=2 ** 25, preprocessor=normalize_text, ngram_range=(1, 2), norm=’l2&#39;)<br>output = ApplyBatch(hv.transform,batcher=batcher).transform(texts_chunk)</em></pre><p>The second pipeline <strong>WordBatch</strong> is a full text processing pipeline, performing consecutive steps of 1) text normalization, 2) spelling correction and stemming, 3) dictionary counting, 4) bag-of-word feature extraction and TF-IDF weighting. Both spelling correction and dictionary counting steps perform their own Map-Reduce operations to compute word frequency tables, and spelling correction and feature extraction steps require sending a dictionary to each worker.</p><pre><em>from wordbatch.pipelines import WordBatch<br>from wordbatch.extractors import WordBag<br>from wordbatch.transformers import Tokenizer, Dictionary<br>wb = WordBatch(normalize_text=normalize_text,<br> dictionary=Dictionary(min_df=10, max_words=1000000),<br> tokenizer=Tokenizer(spellcor_count=2, spellcor_dist=2, raw_min_df= 2, stemmer=stemmer),<br> extractor=WordBag(hash_ngrams=0, norm= ‘l2’, tf= ‘binary’, idf= 50.0),<br> batcher=batcher)<br>output = wb.fit_transform(texts_chunk)</em></pre><p>The first hardware setup is using a single i9–9900K CPU with 8 cores and 64GB DDR4 RAM that can handle all of the covered tests. The second setup connects an additional worker node with 18-core i9–7980XE CPU, using a direct 10 Gb/s ethernet connection. OS used was Ubuntu 18.04.2 LTS, and library versions were pyspark 2.4.1, ray 0.7.0 and distributed 1.28.1.</p><h3>Results</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*cMT4UJAiTFqIrdhdEM0Hkg.jpeg" /><figcaption>Benchmark 1. Distributing Scikit-Learn HashingVectorizer on a single node</figcaption></figure><p>For the simple task of parallelizing HashingVectorizer on a single node, all parallel frameworks get roughly linear speedup compared to running a single serial process. Serial takes 256s for the largest case of 1.28M documents, while multiprocessing takes 36s. Interestingly, Ray is actually faster than multiprocessing, taking 33s, while Spark takes 50s.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*hvZFhEaW2staC3z1VyQ0JQ.jpeg" /><figcaption>Benchmark 2. Distributing the WordBatch feature extraction pipeline on a single node</figcaption></figure><p>The more complex task with WordBatch pipeline shows surprising results. Spark, Ray and multiprocessing show again linear speedups that stay constant with increasing data, but both Loky and Dask have trouble parallelizing the task. Compared to serial taking 460s for 1.28M documents, Ray does this again fastest in 91s. Loky and Dask both have increasing time uses that converge roughly on same time use as serial, but with increasing data sizes would likely exceed serial time use. The likely reason for this odd behaviour is the lack of sharing between processes and the need in this task to twice send dictionaries to each worker. The dictionaries become larger with more data, and the overhead of not efficiently sharing auxiliary data exceeds the benefit of parallelization. This is a surprising result, especially since sending shared data to workers is a basic operation in AI pipelines.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*gBL1CeL78G5tQa03ec0coA.jpeg" /><figcaption>Benchmark 3. Distributing HashingVectorizer using an additional node</figcaption></figure><p>Moving on to the second hardware setup with an additional 18 cores over 10 Gb/s, all three distributed benefit from the additional node. However, Spark has trouble with the largest 1.28M document task, due to larger memory requirements and operating close to the configured memory limits. In practice Spark requires considerable configuration of its components, which has been a source of frustration for its users. At best, the additional node gives 22% speedup for Spark. Dask and Ray perform much better, with 32% speedup for Dask and 41% for Ray at 1.28M documents. The speedups compared to single node also keep increasing with data sizes, and seem nowhere near saturation at the maximum tested size.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*THrDUcnRTMRijTGkZS2eIQ.jpeg" /><figcaption>Benchmark 4. Distributing WordBatch pipeline with an additional node</figcaption></figure><p>Testing the WordBatch pipeline with the additional node, we see that Dask doesn’t gain much. Its problem of efficiently dealing with auxiliary data seems to compound when using additional nodes, so that at the largest 1.28M document condition we get only a speedup from 457s to 420s, and the speedup constantly decreases with larger tasks. Both Spark and Ray can use the additional node better in this task, with the maximum speedups of 38% for Spark and 28% for Ray, at 0.64M documents. Due to the better use of the additional node, Spark with the additional node performs virtually on par with Ray, and could very well exceed it with larger data sizes and a more complex processing pipeline.</p><h3>Concluding Thoughts</h3><p>These basic benchmarks demonstrate some of the main properties of the distributed schedulers. All of the schedulers are useful for distributing Python workloads, but some are not suitable for every task. Actual applications would involve more complex pipelines on large clusters, but this would complicate straightforward comparisons due to: choices in configuring the schedulers, design decisions on how to implement shared data and remote classes such as actors, and how to use GPUs and other non-CPU processors.</p><p>As a preliminary conclusion Ray seems to be the most promising framework. It works around 10% faster than Python standard multiprocessing on a single node, and uses the additional node well in all conditions. Unlike Spark, cluster configuration is very minimal, and it has support for actors. Unlike Dask, it serializes nested Python object dependencies well, and shares data between processes efficiently, scaling complex pipelines linearly. Compared to a single serial process, Ray with an additional node provided 12.9x speedup distributing HashingVectorizer, and 6.7x speedup on the more complex task.</p><p>The available hardware also has a large impact on the performance of the schedulers. If a 1 Gb/s connection was used here, there would be close to no advantage from the additional node. 100 Gb/s over the 10 Gb/s would increase the benefit from additional nodes, as well as change the results between the tested backends. Dask in particular would benefit more from 100 Gb/s, compared to Ray. If data was ingested from a distributed storage as Spark does with Hadoop, this would somewhat reduce the dependency from a high bandwidth network. However, most actual pipelines will do data transfers requiring high bandwidth. With more nodes these frameworks should both use 100 Gb/s, and the AI pipeline should be planned as to minimize network traffic and maximize use of the distributed cores.</p><h4>Links</h4><ul><li><a href="https://github.com/apache/spark">GitHub - apache/spark: Apache Spark - A unified analytics engine for large-scale data processing</a></li><li><a href="https://github.com/dask/dask">GitHub - dask/dask: Parallel computing with task scheduling</a></li><li><a href="https://github.com/ray-project/ray">GitHub - ray-project/ray: Ray is an AI compute engine. Ray consists of a core distributed runtime and a set of AI Libraries for accelerating ML workloads.</a></li><li><a href="https://github.com/anttttti/Wordbatch">anttttti/Wordbatch</a></li><li><a href="http://docs.dask.org/en/stable/spark.html">Comparison to Spark - Dask 1.2.2 documentation</a></li><li><a href="https://github.com/ray-project/ray/issues/642">Comparison to dask · Issue #642 · ray-project/ray</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9872457b785c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/benchmarking-python-distributed-ai-backends-with-wordbatch-9872457b785c">Benchmarking Python Distributed AI Backends with Wordbatch</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>