30 Years of Data Science: A Review From a Data Science Practitioner

30 Years of Data Science: A Review From a Data Science Practitioner
Image by Editor

30 years of KDnuggets and 30 years of data science. More or less 30 years of my professional life. One of the privileges that comes with working in the same field for a long time — aka experience — is the chance to write about its evolution, as a direct eye witness.

The Algorithms

I started working at the beginning of the 90s on what was then called Artificial Intelligence, referring to a new paradigm that was self-learning, mimicking organizations of nervous cells, and that did not require any statistical hypothesis to be verified: yes, neural networks! An efficient usage of the Back-Propagation algorithm had been published just a few years earlier [1], solving the problem of training hidden layers in multilayer neural networks, enabling armies of enthusiastic students to tackle new solutions to a number of old use cases. Nothing could have stopped us … just the machine power.

Training a multilayer neural network requires quite some computational power, especially if the number of network parameters is high and the dataset is large. Computational power, that the machines at the time did not have. Theoretical frameworks were developed, like Back-Propagation Through Time (BPTT) in 1988 [2] for time series or Long Short Term Memories (LSTM) [3] in 1997 for selective memory learning. However, computational power remained an issue and neural networks were parked by most data analytics practitioners, waiting for better times.

In the meantime, leaner and often equally performing algorithms appeared. Decision trees in the form of C4.5 [4] became popular in 1993, even though in the CART [5] form had already been around since 1984. Decision trees were lighter to train, more intuitive to understand, and often performed well enough on the datasets of the time. Soon, we also learned to combine many decision trees together as a forest [6], in the random forest algorithm, or as a cascade [7] [8], in the gradient boosted trees algorithm. Even though those models are quite large, that is with a large number of parameters to train, they were still manageable in a reasonable time. Especially the gradient boosted trees, with its cascade of trees trained in sequence, diluted the required computational power over time, making it a very affordable and very successful algorithm for data science.

Till the end of the 90s, all datasets were classic datasets of reasonable size: customer data, patient data, transactions, chemistry data, and so on. Basically, classic business operations data. With the expansion of social media, ecommerce, and streaming platforms, data started to grow at a much faster pace, posing completely new challenges. First of all, the challenge of storage and fast access for such large amounts of structured and unstructured data. Secondly, the need for faster algorithms for their analysis. Big data platforms took care of storage and fast access. Traditional relational databases hosting structured data left space to new data lakes hosting all kinds of data. In addition, the expansion of ecommerce businesses propelled the popularity of recommendation engines. Either used for market basket analysis or for video streaming recommendations, two of such algorithms became commonly used: the apriori algorithm [9] and the collaborative filtering algorithm [10].

In the meantime, performance of computer hardware improved reaching unimaginable speed and … we are back to the neural networks. GPUs started being used as accelerators for the execution of specific operations in neural network training, allowing for more and more complex neural algorithms and neural architectures to be created, trained, and deployed. This second youth of neural networks took on the name of deep learning [11] [12]. The term Artificial Intelligence (AI) started resurfacing.

A side branch of deep learning, generative AI [13], focused on generating new data: numbers, texts, images, and even music. Models and datasets kept growing in size and complexity to attain the generation of more realistic images, texts, and human-machine interactions.

New models and new data were quickly substituted by new models and new data in a continuous cycle. It became more and more an engineering problem rather than a data science problem. Recently, due to an admirable effort in data and machine learning engineering, automatic frameworks have been developed for continuous data collection, model training, testing, human in the loop actions, and finally deployment of very large machine learning models. All this engineering infrastructure is at the basis of the current Large Language Models (LLMs), trained to provide answers to a variety of problems while simulating a human to human interaction.

The Life Cycle

More than around the algorithms, the biggest change in data science in the last years, in my opinion, has taken place in the underlying infrastructure: from frequent data acquisition to continuous smooth retraining and redeployment of models. That is, there has been a shift in data science from a research discipline into an engineering effort.

The life cycle of a machine learning model has changed from a single cycle of pure creation, training, testing, and deployment, like CRISP-DM [14] and other similar paradigms, to a double cycle covering creation on one side and productionisation — deployment, validation, consumption, and maintenance — on the other side [15].

30 Years of Data Science: A Review From a Data Science Practitioner
Fig. 1 The life cycle of a machine learning model The Tools

Consequently, data science tools had to adapt. They had to start supporting not only the creation phase but also the productionization phase of a machine learning model. There had to be two products or two separate parts within the same product: one to support the user in the creation and training of a data science model and one to allow for a smooth and error-free productionisation of the final result. While the creation part is still an exercise of the intellect, the productionisation part is a structured repetitive task.

Obviously for the creation phase, data scientists need a platform with extensive coverage of machine learning algorithms, from the basic ones to the most advanced and sophisticated ones. You never know which algorithm you will need to solve which problem. Of course, the most powerful models have a higher chance of success, that comes at the price of a higher risk of overfitting and slower execution. Data scientists in the end are like artisans who need a box full of different tools for the many challenges of their work.

Low code based platforms have also gained popularity, since low code enables programmers and even non-programmers to create and quickly update all sorts of data science applications.

As an exercise of the intellect, the creation of machine learning models should be accessible to everybody. This is why, though not strictly necessary, an open source platform for data science would be desirable. Open-source allows free access to data operations and machine learning algorithms to all aspiring data scientists and at the same time allows the community to investigate and contribute to the source code.

On the other side of the cycle, productionization requires a platform that provides a reliable IT framework for deployment, execution, and monitoring of the ready-to-go data science application.

Conclusion

Summarizing 30 years of data science evolution in less than 2000 words is of course impossible. In addition, I quoted the most popular publications at the time, even though they might not have been the absolute first ones on the topic. I apologize already for the many algorithms that played an important role in this process and that I did not mention here. Nevertheless, I hope that this short summary gives you a deeper understanding of where and why we are now in the space of data science 30 years later!

Bibliography

[1] Rumelhart, D.E.; Hinton, G.E.; Williams, R.J. (1986). “Learning representations by back-propagating errors”. Nature, 323, p. 533-536.

[2] Werbos, P.J. (1988). "Generalization of backpropagation with application to a recurrent gas market model". Neural Networks. 1 (4): 339–356. doi:10.1016/0893-6080(88)90007

[3] Hochreiter, S.; Schmidhuber, J. (1997). "Long Short-Term Memory". Neural Computation. 9 (8): 1735–1780.

[4] Quinlan, J. R. (1993). “C4.5: Programs for Machine Learning” Morgan Kaufmann Publishers.

[5] Breiman, L. ; Friedman, J.; Stone, C.J.; Olshen, R.A. (1984) “Classification and Regression Trees”, Routledge. https://doi.org/10.1201/9781315139470

[6] Ho, T.K. (1995). Random Decision Forests. Proceedings of the 3rd International Conference on Document Analysis and Recognition, Montreal, QC, 14–16 August 1995. pp. 278–282

[7] Friedman, J. H. (1999). "Greedy Function Approximation: A Gradient Boosting Machine, Reitz Lecture

[8] Mason, L.; Baxter, J.; Bartlett, P. L.; Frean, Marcus (1999). "Boosting Algorithms as Gradient Descent". In S.A. Solla and T.K. Leen and K. Müller (ed.). Advances in Neural Information Processing Systems 12. MIT Press. pp. 512–518

[9] Agrawal, R.; Srikant, R (1994) Fast algorithms for mining association rules. Proceedings of the 20th International Conference on Very Large Data Bases, VLDB, pages 487-499, Santiago, Chile, September 1994.

[10] Breese, J.S.; Heckerman, D,; Kadie C. (1998) “Empirical Analysis of Predictive Algorithms for Collaborative Filtering”, Proceedings of the Fourteenth Conference on Uncertainty in Artificial Intelligence (UAI1998)

[11] Ciresan, D.; Meier, U.; Schmidhuber, J. (2012). "Multi-column deep neural networks for image classification". 2012 IEEE Conference on Computer Vision and Pattern Recognition. pp. 3642–3649. arXiv:1202.2745. doi:10.1109/cvpr.2012.6248110. ISBN 978-1-4673-1228-8. S2CID 2161592.

[12] Krizhevsky, A.; Sutskever, I.; Hinton, G. (2012). "ImageNet Classification with Deep Convolutional Neural Networks". NIPS 2012: Neural Information Processing Systems, Lake Tahoe, Nevada.

[13] Hinton, G.E.; Osindero, S.; Teh, Y.W. (2006) ”A Fast Learning Algorithm for Deep Belief Nets”. Neural Comput 2006; 18 (7): 1527–1554. doi: https://doi.org/10.1162/neco.2006.18.7.1527

[14] Wirth, R.; Jochen, H.. (2000) “CRISP-DM: Towards a Standard Process Model for Data Mining.” Proceedings of the 4th international conference on the practical applications of knowledge discovery and data mining (4), pp. 29–39.

[15] Berthold, R.M. (2021) “How to move data science into production”, KNIME Blog
Rosaria Silipo is not only an expert in data mining, machine learning, reporting, and data warehousing, she has become a recognized expert on the KNIME data mining engine, about which she has published three books: KNIME Beginner’s Luck, The KNIME Cookbook, and The KNIME Booklet for SAS Users. Previously Rosaria worked as a freelance data analyst for many companies throughout Europe. She has also led the SAS development group at Viseca (Zürich), implemented the speech-to-text and text-to-speech interfaces in C# at Spoken Translation (Berkeley, California), and developed a number of speech recognition engines in different languages at Nuance Communications (Menlo Park, California). Rosaria gained her doctorate in biomedical engineering in 1996 from the University of Florence, Italy.

More On This Topic

  • Ten Years of AI in Review
  • move(data), The Data Practitioner Conference
  • Data Practitioner Survey: Want to know what you’re worth?
  • Hidden Technical Debts Every AI Practitioner Should be Aware of
  • Will There Be a Shortage of Data Science Jobs in the Next 5 Years?
  • Data Science is Not Becoming Extinct in 10 Years, Your Skills Might

Amazon’s $4 Bn Investment in Anthropic Raises Ethical Concerns 

Anthropic has announced to raise $4 billion from Amazon, with an initial $1.25 billion for a minority stake in the OpenAI rival. As part of the agreement, Anthropic will use Amazon’s cloud computing platform and its AI chips to create its artificially intelligent language models. The deal is a shift away from Google, which invested $300 million in the AI hotshot last year.

Earlier this year, Anthropic was valued at nearly $5 billion, according to inside information. Founded by ex-OpenAI sibling duo Dario and Daniela Amodel, the startup is a top OpenAI competitor raising huge funds this year, including Inflection AI, which raised $1.3 billion from Microsoft and Nvidia, and Cohere, which raised $270 million from Nvidia and others.

The above startups gained popularity amid the explosive generative AI caused by OpenAI’s chatbot, ChatGPT and its foundational model, GPT-4. As huge sums of money is being funnelled down in these startups, concerns have been raised regarding the race to develop a bigger and better GPT-4’s competitor. In March 2023, several AI insiders and businessmen called for a temporary 6-month pause for companies building language models with capabilities higher than the existing model.

An AI safety advocate, Dan Hendrycks, whose work was cited in the open letter, recently told AIM that Anthropic was started solely as an alternative to OpenAI, which was not taking safety seriously enough. “Two years later, they did the same thing as OpenAI,” he added.

“This shows that good intentions and people taking a risk seriously won’t be enough to counteract these extreme pressures on race,” he said. He suggested, “We should buy ourselves that ability or option and not just depend on the goodwill of these different companies.”

For Amazon, an e-commerce giant, the latest deal marks its latest push to capitalise on the excitement around generative AI, akin to its long time competitors Microsoft and Google.

Read more: No, the Infamous 6-Month AI Pause Letter Wasn’t a Failure

The post Amazon’s $4 Bn Investment in Anthropic Raises Ethical Concerns appeared first on Analytics India Magazine.

Apple Should be Scared of Windows Copilot

While Apple introduced new features with underlying hints of generative AI in Series 9 watch with Siri and iPhone 15, Microsoft is trying to define the next era of personal computing leveraging generative AI in the form of personal assistant—Copilot.

“It’s kind of like your PC is kind of now becoming CP (Copilot). We believe copilot will fundamentally transform our way with technology and usher in a new era of personal computing,” said Microsoft chief Satya Nadella.

With its presence right on the taskbar and a convenient Win+C keyboard shortcut, Copilot will be at your fingertips whenever you need it. Copilot is seamlessly integrated, offering assistance effortlessly across all your applications.

Copilot will start its early rollout as part of free Windows 11 update, beginning on September 26. Interestingly, on the same day, Apple is set to release the latest macOS update, macOS Sonoma.

We are standing at a very crucial juncture in the technological shift with generative AI. Surprisingly, in the recent Apple event, it didn’t mention the word AI even once with regards to macOS.

macOS needs an upgrade

Apple macOS Sonoma currently doesn’t boast of generative AI capabilities however it does improve on previous macOS versions. macOS Sonoma includes a number of new video conferencing features, such as Presenter Overlay and new reactions.

However, it comes nowhere close to Windows 11 who now truly has an AI personal assistant. While Apple currently hosts Siri on Mac, the Santa Clara based company should seriously consider rolling out an upgraded Siri with generative AI capabilities as soon as possible.

Moreover, history has proven the significance of being the first mover in the generative AI segment. We have seen this in the case of Google and OpenAI. Currently, OpenAI can be touted as leading the generative AI race with its GPT based models while Google is still trying to catch up. Meanwhile, Microsoft is making the most out of its partnership with OpenAI.

“What Microsoft did today was to reset customer expectations higher than all but a few competitors can even come close to meeting,” said AI advisor Vin Vashistha. He further elaborated that in the next 6 months customers won’t accept having to bounce between applications and having to remember which apps provide access to specific data types or support specific workflows. The Generative Interface must handle orchestration seamlessly.

By next year selling AI addon or “Copilot” will be seen like selling Windows as an addon to DOS in 1980s. People will just see AI as part of software, just like GUI.

— Amjad Masad (@amasad) September 22, 2023

Many businesses rely on Microsoft 365 for their daily work. If they discover that Copilot can significantly improve their productivity, it could become a significant challenge for macOS systems.

Even other Apple products require major upgrades, including the web browser Safari. In contrast, Microsoft has been actively enhancing its offerings, particularly Bing. Initially, it integrated ChatGPT into Bing, and now it’s taking another leap by incorporating DALL-E 3 as well.

Edge computing

It is still not clear that the updated version of Windows 11 would require an internet connection to work or not but Microsoft has made its intentions clear that it is soon going to host LLMs locally on PCs. The company has been in talks with Intel, Qualcomm, AMD, and NVIDIA for developing support for AI on the silicon level, allowing edge computing on Windows devices.

Microsoft’s new Surface Laptop Studio 2 is equipped with the latest 13th Gen Intel Core processors, which are part of the Intel Evo platform. It offers a variety of NVIDIA GPU options, including the RTX 4050, RTX 4060, and RTX 200, giving users a wide range of powerful graphics options to choose from.

Also, Apple doesn’t lack infrastructure to run generative AI capabilities on devices. Its M2 chip has a dedicated Neural Engine with 16 cores, which is specifically designed for AI and machine learning tasks.

The M2 also has a powerful GPU, which can be used to accelerate generative AI tasks such as image generation and text translation. Additionally, Apple came up with the A17 chip in iPhone 15 Pro, which is also capable of running AI capabilities.

Apple often promotes its products based on their commitment to “privacy.” It wouldn’t be surprising if one of the key benefits of Apple’s AI is that it works directly on devices, keeping users’ data safe and private.

Moreover, according to recent reports, Apple is expanding its budget for creating conversational AI to millions of dollars a day to develop new features for Siri where customers can use just voice commands to automate simple tasks. Apple soon needs to make a move before it’s too late!

The post Apple Should be Scared of Windows Copilot appeared first on Analytics India Magazine.

Meta Looks to Attract a Younger Audience with Fresh AI Chatbot Characters

Meta is preparing to launch artificial intelligence chatbots, each with unique personalities, on its social media platforms as early as this week. This move is aimed at appealing to a younger user demographic, as reported by WSJ.

These generative AI bots are currently undergoing internal testing by employees. The company plans to unveil the first of these AI agents at the upcoming Meta Connect conference, commencing this Wednesday.

These bots aim to enhance user engagement and may also possess productivity-oriented abilities, such as assisting with coding and various tasks. Meta is in the process of crafting multiple AI personality chatbots and has been exploring a product that would enable celebrities and content creators to utilise their customised AI chatbots for engaging with their fans and followers.

One of the upcoming bots is named “Bob the robot,” who describes himself as a master of sass with a “superior intellect, clever humor, and sharp sarcasm,” as per documents from the company seen by The Wall Street Journal.

Meta is taking a page out of other social media companies’ playbooks by introducing chatbots powered by generative AI technology to attract a younger user demographic. In February, Snap rolled out My AI, a chatbot utilising OpenAI’s GPT technology, to Snapchat users.

Meanwhile, the Silicon Valley startup Character.AI allows individuals to create and engage with chatbots that simulate specific characters or famous personalities like Elon Musk and Vladimir Putin.

The post Meta Looks to Attract a Younger Audience with Fresh AI Chatbot Characters appeared first on Analytics India Magazine.

AI Chatbots Grapple with Linguistic Understanding

The advent of artificial intelligence (AI) chatbots has reshaped conversational experiences, bringing forth advancements that seem to parallel human understanding and usage of language. These chatbots, fueled by substantial language models, are becoming adept at navigating the complexities of human interaction.

However, a recent study has brought to light the persistent vulnerability of these models in distinguishing natural language from nonsense. The investigation conducted by Columbia University researchers presents intriguing insights into the potential improvements in chatbot performance and human language processing.

The Inquiry into Language Models

The team elaborated on their research involving nine different language models subjected to numerous sentence pairs. The human participants in the study were asked to discern the more ‘natural’ sentence in each pair, reflecting everyday usage. The models were then evaluated based on whether their assessments resonated with human choices.

When the models were pitted against each other, the ones based on transformer neural networks exhibited superior performance compared to the simpler recurrent neural network models and statistical models. However, even the more sophisticated models demonstrated errors, often selecting sentences perceived as nonsensical by humans.

The Struggle with Nonsensical Sentences

Dr. Nikolaus Kriegeskorte, a principal investigator at Columbia's Zuckerman Institute, emphasized the relative success of large language models in capturing crucial aspects missed by simpler models. He noted, “That even the best models we studied still can be fooled by nonsense sentences shows that their computations are missing something about the way humans process language.”

A striking example from the study highlighted models like BERT misjudging the naturalness of sentences, contrasting with models like GPT-2, which aligned with human judgments. The prevailing imperfections in these models, as Christopher Baldassano, Ph.D., an assistant professor of psychology at Columbia noted, raise concerns regarding the reliance on AI systems in decision-making processes, calling attention to their apparent “blind spots” in labeling sentences.

Implications and Future Directions

The gaps in performance and the exploration of why some models excel more than others are areas of interest for Dr. Kriegeskorte. He believes that understanding these discrepancies can significantly propel progress in language models.

The study also opens avenues for exploring whether the mechanisms in AI chatbots can spark novel scientific inquiries, aiding neuroscientists in deciphering the human brain's intricacies.

Tal Golan, Ph.D., the paper's corresponding author, expressed interest in understanding human thought processes, considering the growing capabilities of AI tools in language processing. “Comparing their language understanding to ours gives us a new approach to thinking about how we think,” he commented.

The exploration of AI chatbots' linguistic capabilities has unveiled the lingering challenges in aligning their understanding with human cognition.

The continuous efforts to delve into these differences and the ensuing revelations are poised to not only enhance the efficacy of AI chatbots but also to unravel the myriad layers of human cognitive processes.

The juxtaposition of AI-driven language understanding and human cognition lays the foundation for multifaceted explorations, potentially reshaping perceptions and advancing knowledge in the interconnected realms of AI and neuroscience.

AI in Programming is to Collaborate, Not Eliminate

Copilot, Code Whisperer, Codesense and similar tools that help complete, debug, test, tune, and review code will take the load off developers, according to AI proponents. But Doomer had a completely wild vision of AI replacing human programmers and changing software development as we know it.

Matt Welsh, former Harvard professor and current founder of fixie.ai declared earlier this year that AI is the end of programming, most of his peers were sceptical about the arguments he posited.

“I don’t believe we’re even close to that point, or necessarily heading in the right direction,” writes Brian Hayes, a senior writer at the American Scientist, in response to this, adding that this dismissal was based on relatively simple computational tasks for which solutions are well known and widely published.

While the potential of AI is unquestionable, a deeper look into its current capabilities suggests that a complete or even a partial AI takeover in programming is unlikely. The consensus is that developers who adopt AI into their workflow have a better chance at surviving in the field long term and are in favour of the ones who don’t.

AI Brings Programming at Developers’s Doorstep

AI excels at generating boilerplate code and code that is repetitive in nature, such as iterating through a list of items or serialising/deserializing JSON data. Developers already use Copilot, DeepCode to do what they did with StackOverflow—copy-paste code. AI can do this copy-paste job very well because it has been trained on vast amounts of data from the internet, effectively “memorising” many code patterns.

The AI-based platforms for coders help them write documentation for code and add comments. It can analyse the code and generate documentation for each method, along with example code on how to use it. Similar to documentation, AI can assist with writing test cases for code. If code testing requires generating test data, AI can deduce the format of the data and generate it accordingly.

When working with an unfamiliar codebase, this feature is incredibly handy because AI’s ability to help explain code line by line is phenomenal. AI models are adept at understanding data. If you provide a dataset, AI can analyse its structure and, based on the columns, understand the kind of data it represents.

Developers can ask AI various questions about the data and request different analyses. AI can even generate code for you to run and visualise the data. If you provide AI with your database schema, it can help you generate SQL queries for various tasks, such as data analysis or report generation.

Various studies evaluating LLMs’ proficiency in generating code underscore the need for human intervention and understanding in the programming process. AI-generated solutions, while promising, are inconsistent and often require human fine-tuning.

AI to Boost Developer Economy

All the jobs done by AI definitely cast a lot of fear. But, dispelling the fears, Thomas Dohmke, the CEO of GitHub recently said, “The demand for software developers will continue to outweigh the supply.” Even if Emad Mostaque said that developers jobs will be dead in five years.

AI models work by processing a task, such as rewriting a piece of code, and producing new code as output. In the process, three components are involved: instruction in natural language, the accompanying piece of code you want it to rewrite, and the model’s output. These three elements form the model’s context window, which allows a limited number of tokens (a token is equivalent to one word, but sometimes one word might result in multiple tokens). This means that these models can process a limited amount of information.

AI is undoubtedly capable of handling some low-level tasks, and it will continue to improve over time. However, real-world software engineering is much more complex than these tasks. Engineers deal with various challenges on a day-to-day basis. They have to understand the organisation and abstraction in complex codebases, while also knowing what feature to prioritise over the others.

For this they’re required to know what the company and stakeholders need which an AI can’t do. Collaborating with others to understand business requirements and designing scalable solutions with maintainability and extensibility in mind.

Coders are not always redoing what’s been done but often need to innovate and come up with novel solutions to unseen problems, which requires experience and a deep understanding of data structures and algorithms, and ability to extrapolate that knowledge to solve unseen problems. These cannot be left to AI.

AI killing programming jobs is an unfortunate self-fulling prophecy.
Too many people have listened to the hype and have now changed careers because AI will soon take over.
Those would-be jobs are dead. Everyone else will be just fine.

— Santiago (@svpino) July 3, 2023

The current landscape suggests a collaborative approach where AI serves as a powerful tool augmenting human programmers rather than a complete replacement.

The post AI in Programming is to Collaborate, Not Eliminate appeared first on Analytics India Magazine.

Everything Microsoft unveiled at its Surface and AI event this week

Microsoft Surface Laptop Go 3 colors

Microsoft's private launch event in NYC happened earlier this week and ZDNET was on the show floor to cover every major news drop, from the latest Surface products to AI updates to new features coming to Windows 11.

Also: I went hands-on with Microsoft's new AI features, and these 5 are the most useful

This year's fall event saw Microsoft clearly positioning itself as the AI leader that it is, with a barrage of generative AI upgrades to Bing Chat, Windows Copilot, and more. Two new Surface models were introduced as well, which would further ingrain the company's AI efforts to the masses. Here's the full recap of what was announced on Thursday.

What's new with software and AI?

What's new with hardware?

More Microsoft

Everything Amazon announced this week: Alexa 2.0, Echo Show 8, Fire TV, more

Amazon event stage 2023

Amazon is constantly looking for new ways to innovate through hardware and software, from Echo devices to new Alexa capabilities. This week, the company held its annual Devices and Services event at its new headquarters in Arlington, Virginia to unveil new updates for Alexa, a new Echo Show, Fire tablets, and a slew of Fire TV updates.

Also: Amazon is refreshing its Fire TV products with generative AI features. Here's what's new

Last year, we saw the launch of the Kindle Scribe, a new generation of Echo Dot and Fire TV Cube, the addition of spatial audio to the Echo Studio, a Fire TV Pro Remote, and the eero built-in capability added to some Echo devices. This year, Amazon is launching new Fire TV Sticks, a new Soundbar, and Alexa is seeing the biggest makeover of the voice assistant's virtual life.

Amazon

Why The Infamous 6-Month AI Pause Letter Wasn’t a Failure

Not a week has gone by without an AI industry insider trumpeting the existential risks of AI since late 2022 – the release of ChatGPT. In March 2023, thousands of business and AI leaders signed an open letter calling for a six-month pause on the training of AI systems more powerful than OpenAI’s GPT-4. The signatories warned that the technology could “pose profound risks to society and humanity.” The call wasn’t adopted, but the letter’s impact is evident.

One of the signatories, Olle Haggstrom, doesn’t think of the letter as a failure because “what we did was something very important, namely, we put the safety issue and the risk issue on the public agenda,” he told AIM. “The fact that you and I are having this conversation, I think it is a success,” he added.

Haggstrom has been talking about these issues for more than a decade. The issues of AI breakthroughs were at least decades away so researchers could talk about them very abstractly. But these last couple of years have seen such an incredible acceleration in AI capabilities, that the situation has become very urgent, he said, pointing towards the dire need to focus on ethical and responsible AI.

The signatories did not expect an immediate six-month pause since it was not a realistic prospect. “It’s also not sufficient. But this is just something that we put on the table for concreteness, to get the discussion going,” clarified Haggstrom.

Why The Pause Failed

The director of the Center for AI Safety, Dan Hendrycks, whose work – X-Risk Analysis for AI Research — was cited in the open letter, pointed out the reasons why the letter could not stop AI advancements.

“It’s important to address that they [the tech companies] are caught in a situation where, if they were to pause, then their competitors would end up going ahead. Less ethically minded ones would end up doing better or getting a competitive advantage. There is the prioritisation of profit over safety from many of these companies. If they did decide to just stop with it all, I’m not sure the impact would be that positive because many others would just keep doing the same thing”, he told AIM.

The researcher who made it to the TIME AI 100 list, suggested we need some coordination mechanism or external actor to tell the companies that they need to all stop, instead of waiting for them to volunteer themselves to stop.

He pointed out that Elon Musk initially founded OpenAI, to prioritise safety, because Larry Page’s Google wasn’t. Then it became a capped-profit company and kept racing. Anthropic which was initially people at OpenAI that didn’t like what they saw. They thought OpenAI was not taking safety seriously enough and formed their own thing. Two years later, they do the same thing as OpenAI.

“This shows that good intentions and people taking a risk seriously won’t be enough to counteract these extreme pressures on race,” he said. “The lesson here is that we can’t get them to voluntarily pause. Maybe we should build a pause button like there’s a nuclear launch button if things start looking much more dangerous. We should buy ourselves that ability or option and not just depend on the goodwill of these different companies,” Hendrycks concluded.

No Clear Solution

The open letter warned of an “out-of-control race” to develop machines that no one could “understand, predict, or reliably control”. It also urged governments to intervene in developing AI systems more powerful than GPT-4. It raised the question: Should we develop nonhuman minds that might eventually outsmart and replace mankind?

OpenAI recently announced the super alignment project. The idea boils down to, ‘we observe that advanced AI is dangerous, so we build an advanced AI to fix this problem’. Haggstrom believes it may work, but it’s a dangerous leap out in the dark.

He suggests increasing the momentum of this emerging movement. “We’ve seen that humans are not able to eradicate bias and other unwanted behaviours in these language models. So reinforcement learning with human feedback works with current models, but not with future models. For the kind we are worried about, that approach is a dead end,” the professor of mathematical statistics at Chalmers University of Technology explained.

“We can have a data set consisting of the nicest, most politically correct things that you can imagine and this is still going to be dangerous because we have no control over what goes on inside these AI models. When they are released out in the wild, they will inevitably encounter new situations which are outside the distribution of the training data. It’s not just that I don’t know, not even the developers themselves are anywhere near understanding and being in control of this,” said Haggstrom concerningly.

“Tomorrow’s AI poses risks today,” he further stated, recalling a piece in Nature. “It is an unfortunate part of current AI discourse, that people contrast near-term AI risk with long term risks. Now that we understand that the maximally dangerous breakthrough, may not be decades away, on the one hand, there are people worrying about AI bias down to earth and there are those of us who worry about the very existence of humanity. These two groups need to get together and unite against these leading AI developers who are rushing forward almost blindly with no control of their models, because neither of these groups of AI ethicists are getting what they want,” Haggstrom concluded.

The post Why The Infamous 6-Month AI Pause Letter Wasn’t a Failure appeared first on Analytics India Magazine.

Introduction to Deep Learning Libraries: PyTorch and Lightning AI

Introduction to Deep Learning Libraries: PyTorch and Lightning AI
Photo by Google DeepMind

Deep learning is a branch of the machine learning model based on neural networks. In the other machine model, the data processing to find the meaningful features is often done manually or relying on domain expertise; however, deep learning can mimic the human brain to discover the essential features, increasing the model performance.

There are many applications for deep learning models, including facial recognition, fraud detection, speech-to-text, text generation, and many more. Deep learning has become a standard approach in many advanced machine learning applications, and we have nothing to lose by learning about them.

To develop this deep learning model, there are various library frameworks we can rely upon rather than working from scratch. In this article, we will discuss two different libraries we can use to develop deep learning models: PyTorch and Lighting AI. Let’s get into it.

PyTorch

PyTorch is an open-source library framework to train deep-learning neural networks. PyTorch was developed by the Meta group in 2016 and has grown in popularity. The rise of popularity was thanks to the PyTorch feature that combines the GPU backend library from Torch with Python language. This combination makes the package easy to follow by the user but still powerful in developing the deep learning model.

There are a few standout PyTorch features that are enabled by the libraries, including a nice front-end, distributed training, and a fast and flexible experimentation process. Because there are many PyTorch users, the community development and investment were also massive. That is why learning PyTorch would be beneficial in the long run.

PyTorch building block is a tensor, a multi-dimensional array used to encode all the input, output, and model parameters. You can imagine a tensor like the NumPy array but with the capability to run on GPU.

Let’s try out the PyTorch library. It’s recommended to perform the tutorial in the cloud, such as Google Colab if you don’t have access to a GPU system (although it could still work with a CPU). But, If you want to start in the local, we need to install the library via this page. Select the appropriate system and specification you have.

For example, the code below is for pip installation if you have a CUDA-Capable system.

pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

After the installation finishes, let’s try some PyTorch capabilities to develop the deep learning model. We will do a simple image classification model with PyTorch in this tutorial based on their web tutorial. We would walk on the code and have an explanation of what happened within the code.

First, we would download the dataset with PyTorch. For this example, we would use the MNIST dataset, which is the number handwritten classification dataset.

from torchvision import datasets    train = datasets.MNIST(      root="image_data",      train=True,      download=True  )    test = datasets.MNIST(      root="image_data",      train=False,      download=True,  )

We download both the MNIST train and test datasets to our root folder. Let’s see what our dataset looks like.

import matplotlib.pyplot as plt     for i, (img, label) in enumerate(list(train)[:10]):      plt.subplot(2, 5, i+1)      plt.imshow(img, cmap="gray")      plt.title(f'Label: {label}')      plt.axis('off')     plt.show()

Introduction to Deep Learning Libraries: PyTorch and Lightning AI

Every image is a single-digit number between zero and nine, meaning we have ten labels. Next, let’s develop an image classifier based on this dataset.

We need to transform the image dataset into a tensor to develop a deep learning model with PyTorch. As our image is a PIL object, we can use the PyTorch ToTensor function to perform the transformation. Additionally, we can automatically transform the image with the datasets function.

from torchvision.transforms import ToTensor  train = datasets.MNIST(      root="data",      train=True,      download=True,      transform=ToTensor()  )    test = datasets.MNIST(      root="data",      train=False,      download=True,      transform=ToTensor()  )

By passing the transformation function to the transform parameter, we can control what the data would be like. Next, we would wrap the data into the DataLoader object so the PyTorch model could access our image data.

from torch.utils.data import DataLoader  size = 64    train_dl = DataLoader(train, batch_size=size)  test_dl = DataLoader(test, batch_size=size)    for X, y in test_dl:      print(f"Shape of X [N, C, H, W]: {X.shape}")      print(f"Shape of y: {y.shape} {y.dtype}")      break
Shape of X [N, C, H, W]: torch.Size([64, 1, 28, 28])  Shape of y: torch.Size([64]) torch.int64  

In the code above, we create a DataLoader object for the train and test data. Each data batch iteration would return 64 features and labels in the object above. Additionally, the shape of our image is 28 * 28 (height * width).

Next, we would develop the Neural Network model object.

from torch import nn    #Change to 'cuda' if you have access to GPU  device = 'cpu'    class NNModel(nn.Module):      def __init__(self):          super().__init__()          self.flatten = nn.Flatten()          self.lr_stack = nn.Sequential(              nn.Linear(28*28, 128),              nn.ReLU(),              nn.Linear(128, 128),              nn.ReLU(),              nn.Linear(128, 10)          )        def forward(self, x):          x = self.flatten(x)          logits = self.lr_stack(x)          return logits    model = NNModel().to(device)  print(model)
NNModel(    (flatten): Flatten(start_dim=1, end_dim=-1)    (lr_stack): Sequential(      (0): Linear(in_features=784, out_features=128, bias=True)      (1): ReLU()      (2): Linear(in_features=128, out_features=128, bias=True)      (3): ReLU()      (4): Linear(in_features=128, out_features=10, bias=True)    )  )  

In the object above, we create a Neural Model with few layer structure. To develop the Neural Model object, we use the subclassing method with the nn.module function and create the neural network layers within the__init__.

We initially convert the 2D image data into pixel values inside the layer with the flatten function. Then, we use the sequential function to wrap our layer into a sequence of layers. Inside the sequential function, we have our model layer:

nn.Linear(28*28, 128),  nn.ReLU(),  nn.Linear(128, 128),  nn.ReLU(),  nn.Linear(128, 10)

By sequence, what happens above is:

  1. First, the data input which is 28*28 features is transformed using a linear function in the linear layer and having 128 features as the output.
  2. ReLU is a non-linear activation function that is present between the model input and output to introduce non-linearity.
  3. 128 features input to the linear layer and have 128 features output
  4. Another ReLU activation function
  5. 128 features as the input in the linear layer and 10 features as the output (our dataset label only has 10 labels).

Lastly, the forward function is present for the actual input process for the model. Next, the model would need a loss function and optimization function.

from torch.optim import SGD    loss_fn = nn.CrossEntropyLoss()  optimizer = SGD(model.parameters(), lr=1e-3)

For the next code, we just prepare the training and test preparation before we run the modeling activity.

import torch  def train(dataloader, model, loss_fn, optimizer):      size = len(dataloader.dataset)      model.train()      for batch, (X, y) in enumerate(dataloader):          X, y = X.to(device), y.to(device)          pred = model(X)          loss = loss_fn(pred, y)            loss.backward()          optimizer.step()          optimizer.zero_grad()            if batch % 100 == 0:              loss, current = loss.item(), (batch + 1) * len(X)              print(f"loss: {loss:>2f}  [{current:>5d}/{size:>5d}]")    def test(dataloader, model, loss_fn):      size = len(dataloader.dataset)      num_batches = len(dataloader)      model.eval()      test_loss, correct = 0, 0      with torch.no_grad():          for X, y in dataloader:              X, y = X.to(device), y.to(device)              pred = model(X)              test_loss += loss_fn(pred, y).item()              correct += (pred.argmax(1) == y).type(torch.float).sum().item()      test_loss /= num_batches      correct /= size      print(f"Test Error: n Accuracy: {(100*correct):>0.1f}%, Avg loss: {test_loss:>2f} n")

Now we are ready to run our model training. We would decide how many epochs (iterations) we want to perform with our model. For this example, let’s say we want it to run for five times.

epoch = 5  for i in range(epoch):      print(f"Epoch {i+1}n-------------------------------")      train(train_dl, model, loss_fn, optimizer)      test(test_dl, model, loss_fn)  print("Done!")

Introduction to Deep Learning Libraries: PyTorch and Lightning AI

The model now has finished their training and able to be used for any image prediction activity. The result could vary, so expect different results from the above image.

It’s just a few things that PyTorch can do, but you can see that building a model with PyTorch is easy. If you are interested in the pre-trained model, PyTorch has a hub you can access.

Lighting AI

Lighting AI is a company that provides various products to minimize the time to train the PyTorch deep learning model and simplify it. One of their open-source product is PyTorch Lighting, which is a library that offers a framework to train and deploy the PyTorch model.

Lighting offers a few features, including code flexibility, no boilerplate, minimal API, and improved team collaboration. Lighting also offers features such as multi-GPU utilization and swift, low-precision training. This made Lighting a good alternative to develop our PyTorch model.

Let’s try out the model development with Lighting. To start, we need to install the package.

pip install lightning

With the Lighting installed, we would also install another Lighting AI product called TorchMetrics to simplify the metric selection.

pip install torchmetrics

With all the libraries installed, we would try to develop the same model from our previous example using a Lighting wrapper. Below is the whole code for developing the model.

import torch  import torchmetrics  import pytorch_lightning as pl  from torch import nn  from torch.optim import SGD    # Change to 'cuda' if you have access to GPU  device = 'cpu'    class NNModel(pl.LightningModule):      def __init__(self):          super().__init__()          self.flatten = nn.Flatten()          self.lr_stack = nn.Sequential(              nn.Linear(28 * 28, 128),              nn.ReLU(),              nn.Linear(128, 128),              nn.ReLU(),              nn.Linear(128, 10)          )          self.train_acc = torchmetrics.Accuracy(task="multiclass", num_classes=10)          self.valid_acc = torchmetrics.Accuracy(task="multiclass", num_classes=10)        def forward(self, x):          x = self.flatten(x)          logits = self.lr_stack(x)          return logits        def training_step(self, batch, batch_idx):          x, y = batch          x, y = x.to(device), y.to(device)          pred = self(x)          loss = nn.CrossEntropyLoss()(pred, y)          self.log('train_loss', loss)                   # Compute training accuracy          acc = self.train_acc(pred.softmax(dim=-1), y)          self.log('train_acc', acc, on_step=True, on_epoch=True, prog_bar=True)          return loss        def configure_optimizers(self):          return SGD(self.parameters(), lr=1e-3)        def test_step(self, batch, batch_idx):          x, y = batch          x, y = x.to(device), y.to(device)          pred = self(x)          loss = nn.CrossEntropyLoss()(pred, y)          self.log('test_loss', loss)                   # Compute test accuracy          acc = self.valid_acc(pred.softmax(dim=-1), y)          self.log('test_acc', acc, on_step=True, on_epoch=True, prog_bar=True)          return loss

Let’s break down what happen in the code above. The difference with the PyTorch model we developed previously is that the NNModel class now uses subclassing from the LightingModule. Additionally, we assign the accuracy metrics to assess using the TorchMetrics. Then, we added the training and testing step within the class and set up the optimization function.

With all the models set, we would run the model training using the transformed DataLoader object to train our model.

# Create a PyTorch Lightning trainer  trainer = pl.Trainer(max_epochs=5)    # Create the model  model = NNModel()    # Fit the model  trainer.fit(model, train_dl)    # Test the model  trainer.test(model, test_dl)    print("Training Finish")

Introduction to Deep Learning Libraries: PyTorch and Lightning AI

With the Lighting library, we can easily tweak the structure you need. For further reading, you could read their documentation.

Conclusion

PyTorch is a library for developing deep learning models, and it provides an easy framework for us to access many advanced APIs. Lighting AI also supports the library, which provides a framework to simplify the model development and enhance the development flexibility. This article introduced us to both the library's features and simple code implementation.
Cornellius Yudha Wijaya is a data science assistant manager and data writer. While working full-time at Allianz Indonesia, he loves to share Python and Data tips via social media and writing media.

More On This Topic

  • Advanced PyTorch Lightning with TorchMetrics and Lightning Flash
  • Introduction to PyTorch Lightning
  • Multilingual CLIP with Huggingface + PyTorch Lightning
  • Getting Started with PyTorch Lightning
  • Getting Started with PyTorch Lightning
  • AutoML: An Introduction Using Auto-Sklearn and Auto-PyTorch