PyTorch’s Glow: Can it Beat TensorFlow’s Flow?
PyTorch or TensorFlow—the debate that forges many clashes and wars between developers. Many reports show that PyTorch has become the preferred choice for developers, instead of TensorFlow, which is entirely not true. A glance at the 2022 Developer Survey by Stack Overflow, which had around 60,000 respondents, shows that 12.95% of the people preferred TensorFlow for machine learning, which is 1.5X higher than PyTorch that only 8.61% of the respondents chose. In juxtapose, the Keras framework is rising closer to PyTorch, which was selected by 7.27% of the respondents. Not just PyTorch, the overall community of TensorFlow developers has also increased by approximately 30% compared to 2021. The same survey suggests that in the ML landscape, 57% of developers use TensorFlow while only 38% use PyTorch. Also, TensorFlow has 170K stars on GitHub which is relatively higher than PyTorch, which has 61K stars. This rating for TensorFlow has only witnessed further upward momentum since 2021. According to Stack Overflow insights, questions about TensorFlow have always been higher than PyTorch, nearly twice. This suggests that people are actively searching and learning TensorFlow more than PyTorch. It has to be noted that measuring the number of questions on Stack Overflow can also be a measurement of the amount of confusion and not necessarily popularity. Developers’ love for PyTorch If we revisit the same Stack Overflow survey and look at the most loved and dreaded frameworks and libraries, 68.2% of the respondents love PyTorch while TensorFlow was loved by 60% of them. The percentage might seem probable given the number of users of the TensorFlow is more, according to the survey. The problem gets highlighted in the same list. HuggingFace is the most loved library with 72.2% of the respondents voting for it. With HuggingFace, developers can use large, trained, and SOTA models in their pipelines without needing large infrastructures. Developers love it. However, the difference between model availability for TensorFlow and PyTorch is staggering. In 2022, 45,000 PyTorch exclusive models were added to HuggingFace, whereas only 4,000 new TensorFlow exclusives were added. This resulted in 92% exclusive models on HuggingFace for PyTorch and only 8% of the model being TensorFlow exclusive. Google, DeepMind love TensorFlow Google-backed DeepMind standardised the use of TensorFlow in 2016 and also started using JAX in 2020, which is similar to what Google Brain did. OpenAI has used PyTorch internally since 2020 but as their work in reinforcement learning increased, they relied on their older baselines repository, which is implemented exclusively in TensorFlow. However, these are merely the exceptions. Earlier, it seemed that Google was dominating the generative and NLP market with softwares like PaLM, LaMDA, and others. But, most of the groundbreaking innovations in recent times are based in PyTorch and developers are now settled around it. Google’s generative models are also being built on JAX, and not TensorFlow. However, most of the research publications and available models are now using PyTorch and it currently dominates the academic landscape. Looking at the data from Papers With Code, as of December 2022, 62% of the papers were implemented in PyTorch whereas only 4% were for TensorFlow, a decline from 10% in December 2021. This statistic unambiguously shows that the support for TensorFlow is dwindling. TensorFlow is Not Dead, Yet Google learned from Meta’s PyTorch and made TensorFlow 2.0, which is better and easier for research than its previous version. Still, researchers have no reason to return to giving TensorFlow another chance. Now, with the second version of PyTorch all set to launch in March, hopes for TensorFlow fall even shorter. Google developed TensorFlow in 2015, the first framework in the deep learning space. Meta, however, observed and took note of the limitations of the framework and built PyTorch in 2016. Then, the world witnessed the popularity of PyTorch soar. To compete, TensorFlow 2.0 was released in 2019 and has been pushing updates regularly. Now, PyTorch 2.0 is expected to release in March 2023. This hustle-bustle has led to a recent surge of firms pushing the “TensorFlow is dead” or “PyTorch has killed TensorFlow” narrative. But it’d be amiss to believe that it is entirely true. For ML, hardware developments have been the driving force and NVIDIA’s CUDA had the competitive advantage as they were the only ones in the business. Google was leading the software game but got isolated due to the lack of flexibility and usability when compared to PyTorch. Now, NVIDIA’s monopoly in the software stack market is breaking with the introduction of OpenAI’s Triton and PyTorch 2.0. More and more applications are now being built using PyTorch and it might outgrow the current deployment infrastructure of TensorFlow. Moreover, the introduction and improvements in PyTorch is making it an easier and simpler alternative for people for building machine learning models on Python. Interestingly, PyTorch is often referred to as “Pythony” by developers. This explains its wide adoption, and people shifting to PyTorch (built largely on Python) because it seemed comfortable and easy to use, and has a faster learning curve for new users. On the other hand, TensorFlow’s highest usage, according to GitHub, is in C++ language with 63% while Python is only 21%. Even though Python is the most popular language for machine learning, TensorFlow is widely used for C++ and also supports JavaScript and Java while simultaneously expanding for Rust, Scala, along with Julia in development. Suffice to say, TensorFlow is mostly preferred by experts and senior developers who like the flexibility to navigate across programming languages.
TensorFlow reaches far beyond Python and that is what is keeping it alive—for now.
Google learned from Meta’s PyTorch and made TensorFlow 2.0, which is better and easier for research than its previous version.
[]
["machine learning", "Keras", "OpenAI", "AI", "PyTorch", "ML", "NLP", "deep learning", "JAX", "TensorFlow"]
["AI", "machine learning", "ML", "deep learning", "NLP", "OpenAI", "TensorFlow", "PyTorch", "JAX", "Keras"]
Mohit writes about AI in simple, explainable, and often funny words. He's especially passionate about chatting with those building AI for Bharat, with the occasional detour into AGI.