<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Hardware Lottery on Digi Hunch</title><link>https://www.digihunch.com/tags/hardware-lottery/</link><description>Recent content in Hardware Lottery on Digi Hunch</description><generator>Hugo -- gohugo.io</generator><language>en-US</language><lastBuildDate>Mon, 14 Jul 2025 23:59:59 -0700</lastBuildDate><atom:link href="https://www.digihunch.com/tags/hardware-lottery/index.xml" rel="self" type="application/rss+xml"/><item><title>Deep Learning 101 - 1 of 2</title><link>https://www.digihunch.com/2025/07/deep-learning-101-1-of-2/</link><pubDate>Mon, 14 Jul 2025 14:52:34 -0700</pubDate><guid>https://www.digihunch.com/2025/07/deep-learning-101-1-of-2/</guid><description>&lt;img src="https://www.digihunch.com/images/posts/deep-learning-101-1-of-2/ai-learning.webp" alt="Featured image of post Deep Learning 101 - 1 of 2" /&gt;&lt;h2 id="ai-in-general"&gt;AI in general&#10;&lt;/h2&gt;&lt;p&gt;Artificial Intelligence (AI) is a catch-all term for any program that uses information to make decisions or predictions autonomously without active human involvement. For example, an expert system makes decisions based on a series of pre-programmed if-then-else statements. Such a system may feature complex, intricate, rule-based decision trees, but its rules must be &lt;u&gt;programmed explicitly&lt;/u&gt;.&lt;/p&gt;&#10;&lt;p&gt;Unlike expert systems, a machine learning model operates on logics that aren’t explicitly programmed. Instead, they are learned through data input. As the tasks become more complex, rule-based models become increasingly brittle. Explicitly defining every pattern and variable a model must consider becomes impossible. As a result, ML systems have emerged as the dominant mode of AI because implicit learning patterns from data itself is inherently more flexible, scalable and accessible.&lt;/p&gt;&#10;&lt;h2 id="classic-machine-learning"&gt;Classic Machine Learning&#10;&lt;/h2&gt;&lt;p&gt;As a subset of AI, machine learning focuses on algorithms that can &amp;ldquo;learn&amp;rdquo; the patterns of training data, and subsequently make accurate inference based on new data input. This &lt;u&gt;pattern recognition&lt;/u&gt; ability enables machine learning models to make decisions or predictions &lt;u&gt;without&lt;/u&gt; explicitly programmed instructions. The central premise is that if you optimize a model’s performance on a dataset of tasks that adequately resemble the real-world problems, the model can make accurate prediction on the new data. Over the past few decades, machine learning systems have emerged as the dominant mode of AI over the rules-based mode.&lt;/p&gt;&#10;&lt;p&gt;However, it’s essential to note that fitting a model to its training data is merely a means to an end. The ultimate goal of machine learning is generalization: the translation of performance on training data to new, unseen data. A myopic focus on training unto itself risks &lt;u&gt;overfitting&lt;/u&gt;, a phenomenon in which a model’s knowledge is so thoroughly tailored to patterns in its training data that it can’t generalize, yielding a model that excels in training but fails in real-world scenarios.&lt;/p&gt;&#10;&lt;p&gt;Training a useful machine learning model therefore entails not only selecting and configuring an appropriate type of ML algorithm, but also the proper curation of training data and thoughtful validation of post-training performance.&lt;/p&gt;&#10;&lt;p&gt;The term algorithm is a generic term for a step-by-step process, usually described in mathematical language or pseudocode, to perform some function or purpose. A machine learning algorithm is a defined set of steps used to train a machine learning model so it can make useful predictions in its real-world use case. It comprises not only the way the model maps an input data point to its corresponding output, but also the process of optimizing the model’s prediction to “fit” a training dataset of relevant examples. It’s an algorithm that enables a machine to learn from data. &lt;u&gt;The terms training and learning are both metaphoric&lt;/u&gt;. They can be understood as an iterative process of adjusting the model’s parameters in a way that yields more useful outputs. The outcome of applying a machine learning algorithm to a dataset is a trained model.&lt;/p&gt;&#10;&lt;p&gt;ML works through &lt;u&gt;mathematical logic&lt;/u&gt; (instead of pre-programmed logic). The relevant characteristics (aka features) of each data point must therefore be expressed numerically, so that the data itself can be fed into a mathematical algorithm that will learn to map a given input to the desired output. Data points in ML are usually represented in vector form, in which each element (or dimension) of a data point’s vector embedding corresponds to its numerical value for a specific feature. The process of choosing which aspects of data to use in an ML algorithm is called &lt;strong style="color: red;"&gt;feature selection&lt;/strong&gt;. &lt;strong style="color: red;"&gt;Feature extraction&lt;/strong&gt; techniques refine the data down to only its most relevant, meaningful dimensions. Both are subsets of &lt;strong style="color: red;"&gt;feature engineering&lt;/strong&gt;, the broader discipline of preprocessing raw data for use in machine learning.&lt;/p&gt;&#10;&lt;p&gt;Some common libraries for classic machine learning include &lt;code&gt;scikit-learn&lt;/code&gt;, and &lt;code&gt;XGBoost&lt;/code&gt; in Python.&lt;/p&gt;&#10;&lt;img src="https://www.digihunch.com/images/posts/deep-learning-101-1-of-2/ai-machine-deep-learning.webp" alt="Diagram showing the relationship between artificial intelligence, machine learning, and deep learning" style="display: block; margin-left: auto; margin-right: auto;" /&gt;&#10;&lt;h2 id="learning-paradigms"&gt;Learning Paradigms&#10;&lt;/h2&gt;&lt;p&gt;All ML methods can be categorized as one of the few distinct learning paradigms:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;Supervised learning&lt;/code&gt;: trains models to predict the correct output for a given input. To be measured and optimized for accuracy, a model’s outputs must be compared to a &lt;u&gt;ground truth&lt;/u&gt;. In conventional supervised learning, that ground truth is provided by labelled data. The goal of supervised learning is to adjust the model’s parameters until its outputs consistently match the ground truth provided by those labels. Examples include regression, classification, Naive Bayes classifiers, neural networks, and random forest;&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;Unsupervised learning&lt;/code&gt;: trains models to discern intrinsic patterns, dependencies and correlations in data. Unsupervised learning tasks don’t involve any external ground truth against which its outputs should be compared. They don’t require conventional loss functions either. Examples include, clustering (k-means, hierarchical, probabilistic), association, dimensionality reduction, etc;&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;Reinforcement learning&lt;/code&gt; (RL, from human feedback) trains a model to evaluate its environment and take an action that will garner the greatest reward. Reinforcement learning models are trained holistically through trial and error. They’re used prominently in robotics, video games, reasoning models, teaching robots how to replicate human tasks, etc. In RL literature, an AI system is often referred to as an “agent”.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;Self-supervised learning&lt;/code&gt;: enables models to train themselves on unlabeled data, useful in computer vision and NLP;&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;Semi-supervised learning&lt;/code&gt;: a combination between supervised and unsupervised learning.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;In supervised learning we use a &lt;strong style="color: red;"&gt;loss function&lt;/strong&gt; that measures the &lt;strong style="color: red;"&gt;divergence&lt;/strong&gt; (the &amp;ldquo;loss&amp;rdquo;) between the model’s output and the ground truth across a batch of training inputs. The objective of supervised learning is defined mathematically as &lt;u&gt;&lt;em&gt;minimizing the output of a loss function&lt;/em&gt;&lt;/u&gt;. Once loss has been computed, various optimization algorithms, most of which involve calculating the &lt;strong style="color: red;"&gt;derivatives&lt;/strong&gt; (导数) of the loss function, are used to identify parameter adjustments that will reduce loss.&lt;/p&gt;&#10;&lt;h2 id="loss-function"&gt;Loss Function&#10;&lt;/h2&gt;&lt;p&gt;In ML, a &lt;code&gt;loss function&lt;/code&gt; measures model performance by calculating the deviation of a model’s predictions from the correct, &amp;ldquo;ground truth&amp;rdquo; predictions. However, in addition to evaluation, loss functions also serve as input to an algorithm that optimizes the model’s parameters to minimize loss.&lt;/p&gt;&#10;&lt;p&gt;In data science, loss function is a type of objective function. &lt;code&gt;Objective function&lt;/code&gt; refers to &lt;u&gt;any function whose minimization or maximization represents the objective of model training&lt;/u&gt;. In ML, the term loss function is often used synonymously with &lt;u&gt;cost function&lt;/u&gt; or &lt;u&gt;error function&lt;/u&gt; because the training objective for an ML model is to minimize it. In other words, &lt;strong&gt;training is optimizing a model by adjusting model parameters to minimize the output of some loss function.&lt;/strong&gt;&lt;/p&gt;&#10;&lt;p&gt;In simple terms, a loss function tracks the degree of error in a model’s outputs. It does so by quantifying the difference (or the &amp;ldquo;loss&amp;rdquo;) between a predicted value for a given input and the actual value (ground truth). If a model’s predictions are accurate, the loss is small. Therefore, loss function is specific to supervised learning, including self-supervised learning, where the original sample itself serves as ground truth.&lt;/p&gt;&#10;&lt;p&gt;The fundamental goal of machine learning is to train models to output good predictions. Loss functions enable us to define and pursue that goal mathematically. During training, models &amp;ldquo;learn&amp;rdquo; to output better predictions by adjusting parameters in a way that reduces loss. A machine learning model has been sufficiently trained when loss has been minimized below some predetermined threshold.&lt;/p&gt;&#10;&lt;p&gt;Machine learning models learn to make accurate predictions through adjustments to certain model parameters. For example, a single linear regression algorithm models data with the function &lt;code&gt;y= w*x+b&lt;/code&gt; where &lt;code&gt;y&lt;/code&gt; is the model output, &lt;code&gt;x&lt;/code&gt; is the input, &lt;code&gt;w&lt;/code&gt; is a weight and &lt;code&gt;b&lt;/code&gt; is a bias. The model learns by updating the weight and bias terms until the loss function has been sufficiently minimized.&lt;/p&gt;&#10;&lt;p&gt;Using the gradient of the loss function, optimization algorithms determine which direction to &amp;ldquo;step&amp;rdquo; model parameters in order to move down the gradient and thereby reduce loss.&lt;/p&gt;&#10;&lt;h2 id="deep-learning"&gt;Deep Learning&#10;&lt;/h2&gt;&lt;p&gt;Now, to our topic, deep learning is the subset of machine learning driven by large (or rather, deep) artificial neural networks. In classic machine learning, we express a model as a mathematical equation. For training, we choose a model family, and we find optimal parameters within that family. The model family is always explicit and structured (e.g. linear regression, logistic regression, SVM, decision trees). In deep learning however, &lt;u&gt;neural network serves as the model&lt;/u&gt;. Neural networks are just very large, compositional equations.&lt;/p&gt;&#10;&lt;p&gt;Mathematically, it has been proven that a feedforward neural network with at least one hidden layer and a suitable non-linear activation function can approximate &lt;u&gt;any&lt;/u&gt; continuous function. While a neural network is very powerful and versatile, it comes at the cost of &lt;u&gt;interpretability&lt;/u&gt;. There’s little intuitive explanation beyond a raw mathematical one. For that reason, deep learning models are often referred to as &amp;ldquo;black boxes&amp;rdquo; especially when compared to models in classic machine learning, informed by manual feature engineering.&lt;/p&gt;&#10;&lt;p&gt;Another notable distinction of deep learning is that it typically operates on very large amount raw data and automates much of the feature engineering (or at least the feature extraction). This makes deep learning more scalable, albeit less interpretable, than traditional machine learning.&lt;/p&gt;&#10;&lt;p&gt;Even though some classic ML algorithms are also universal approximators in some cases (e.g. Kernel SVMs, kNN, decision trees), They don&amp;rsquo;t scale as well. They rely more on human-designed features. Hence, the real revolution of deep learning isn’t just universal approximation. It also includes:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;representation learning&lt;/li&gt;&#10;&lt;li&gt;scalability with data and compute&lt;/li&gt;&#10;&lt;li&gt;compositional structure (depth)&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;However, just because it is theoretically possible for a neural network to reproduce any function doesn’t mean that this is practically achievable through existing training methods. For many years, adequate performance remained out of reach even for conventional (”vanilla”) deep neural networks. Over time, modifications to the standard neural network architecture have unlocked new capabilities for DL models: CNN, RNN, Transformer, and Mamba models.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;&lt;code&gt;Convolutional neural networks (CNNs)&lt;/code&gt;&lt;/strong&gt; add convolutional layers to neural networks and are primarily used in computer vision.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;&lt;code&gt;Recurrent neural networks (RNNs)&lt;/code&gt;&lt;/strong&gt; are neural networks with current loops that provide an equivalent of &amp;ldquo;memory&amp;rdquo;, enabling them to process sequential data. RNNs intake an ordered sequence of input vectors and process them in time steps. After each time step, the resulting network state (hidden state) is provided back to the loop, along with the next input vector. The hidden state allows RNNs to understand context and order. RNNs had several pain points including vanishing or exploding gradients, making it impractical for many NLP tasks as the length of input sentences they could process is greatly limited. The limitations are somewhat mitigated by an improved RNN architecture called &lt;code&gt;LSTMs&lt;/code&gt; (Long Short Term Memory networks), which adds gating mechanisms to preserve &amp;ldquo;long term&amp;rdquo; memory. Before attention was introduced, the Seq2Seq model was the state-of-the-art model for machine translation. Seq2Seq uses two LSTMs in an encoder-decoder architecture.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong style="color: red;"&gt;Transformer models&lt;/strong&gt; (introduced in the paper &lt;code&gt;Attention is All You need&lt;/code&gt;) are also ostensibly designed for sequential data. The unique strength of transformer models comes from their innovative &lt;strong style="color: red;"&gt;attention mechanism&lt;/strong&gt;, which enables the model to selectively focus on the parts of the input data most relevant at a specific moment in a sequence. By replacing recurrence with self-attention, the &lt;strong style="color: red;"&gt;transformer architecture&lt;/strong&gt; addresses those pain points in RNN. It is the turning point in deep learning and enabled LLMs and other pillars of generative AI in 2017.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;Mamba models&lt;/strong&gt; (introduced in 2023) are relatively new neural network architectures. They also provide a means of selectively prioritizing the most relevant information at a given moment. Mamba has recently emerged as a rival to the transformer architecture, particularly for LLMs.&lt;/p&gt;&#10;&lt;p&gt;Transformers are unusually &lt;strong&gt;well-matched to GPU hardware&lt;/strong&gt;, so they won the &amp;ldquo;hardware lottery&amp;rdquo; and displaced older RNN-based models that didn’t fit GPUs as well (as per Sara Hookers’ 2020 essay &lt;em&gt;the Hardware Lottery&lt;/em&gt;). It creates huge demand for GPUs.&lt;/p&gt;&#10;&lt;p&gt;Looking back through the history, although neural networks were introduced early, it wasn’t until the early 2010s that they became dominant in most subfields of AI, enabled in part by advancements in GPUs, owing to the very large amount of data and computational resources required. In the late 2010s, the transformer architecture further tightened the marriage between GPU and deep learning.&lt;/p&gt;&#10;&lt;p&gt;In terms of programming, common frameworks in Deep Learning include &lt;code&gt;PyTorch&lt;/code&gt;, &lt;code&gt;TensorFlow&lt;/code&gt;. For distributed training, common frameworks are &lt;code&gt;Pythorch DDP&lt;/code&gt; and &lt;code&gt;Horovod&lt;/code&gt;.&lt;/p&gt;&#10;</description></item></channel></rss>