ٹیکنیکل گائیڈ
توانائی پر مبنی ماڈلز
An energy-based model (EBM) is a machine learning model that assigns a single number, called energy, to every possible configuration of its variables, with low energy meaning compatible or likely and high energy meaning unlikely.
اس گائیڈ کو سنیں۔اے آئی نے بیان کیا۔ · ~9 min
اس صفحہ پر10 منٹ کا مطالعہ
جائزہ
Because the energies never have to be normalized into probabilities that sum to one, EBMs are very flexible, which is why they serve as a common framework for classifiers, Hopfield networks, Boltzmann machines and score-based generative models.
اہم نکات
- An energy-based model assigns one scalar energy to each configuration of variables, with lower energy meaning a better or more likely fit.
- Energies become probabilities by exponentiating minus the energy and dividing by a normalizing constant Z that is usually impossible to compute exactly.
- Training must lower energy on real data and raise it elsewhere, using MCMC sampling, score matching or noise contrastive estimation.
- Hopfield networks from 1982 and Boltzmann machines from 1985 are early energy-based models, recognized by the 2024 Nobel Prize in Physics.
- Any classifier's logits can be read as negative energies, which is the basis of the 2019 Joint Energy-based Model.
گہرا غوطہ
An energy-based model, or EBM, is a way of describing what a model knows using a single scalar score. For any setting of the variables the model cares about, for example an image and a label, or a sentence and its translation, the model outputs a number called the energy. Low energy means the combination fits well together; high energy means it does not. The word comes from physics, where systems tend to settle into low-energy states. Yann LeCun and colleagues' 2006 "A Tutorial on Energy-Based Learning" put it simply: inference means fixing the observed variables and searching for values of the remaining variables that make the energy as small as possible, and learning means shaping the energy function so that correct configurations get lower energy than incorrect ones.
A concrete example makes this clearer. Suppose X is the pixels of a photo and Y is one of five labels: human, animal, airplane, car or truck. An EBM computes E(Y, X) for each of the five labels and predicts the label with the lowest energy. A standard neural network classifier already does something very close to this: its output scores, called logits, can be read as negative energies. What makes the energy view useful is that it does not require those scores to be turned into probabilities. A probabilistic model must divide by a normalizing constant, the sum or integral of the unnormalized scores over every possible configuration, so that probabilities add up to one. For images or sentences, that sum covers an astronomically large space and usually cannot be computed. The LeCun tutorial argues that because EBMs have no requirement for proper normalization, this problem is avoided and model designers gain flexibility in architectures and training criteria.
When a probability is needed, an energy can be converted into one using the Gibbs or Boltzmann distribution: the probability of a configuration is proportional to the exponential of minus its energy, divided by the normalizing constant, often written Z. Lower energy therefore means exponentially higher probability. This link is exact, so every probabilistic model with a positive density can be written as an EBM, and every EBM defines a probability distribution whenever Z is finite. The catch is that Z is still there; EBMs move the difficulty from defining the model to training and sampling it.
Training has to do two things at once: push energy down on real data and push it up on everything else. If a method only pushes energy down on the training examples, the model can cheat by giving every input low energy, a failure often called collapse. Song and Kingma's 2021 tutorial "How to Train Your Energy-Based Models" groups the main solutions into three families. Maximum likelihood with Markov chain Monte Carlo (MCMC) sampling draws "negative" samples from the current model and raises their energy. Score matching avoids sampling by fitting the gradient of the log density with respect to the data, which does not depend on Z. Noise contrastive estimation trains the model to tell real data apart from samples of a known noise distribution. The tutorial shows that these three approaches are theoretically connected.
The history runs through some of the best-known work in the field. The Nobel Committee's popular explanation of the 2024 Physics prize describes how John Hopfield's 1982 associative memory network was defined by an energy borrowed from models of magnetic spins: stored patterns are low-energy states, and the network recovers a pattern by updating its units so the energy falls. Geoffrey Hinton built on this with the Boltzmann machine, published in 1985, which uses tools from statistical physics to learn a probability distribution over patterns and can generate new examples. The two shared the 2024 Nobel Prize in Physics for these foundations. In 2006 LeCun's group published its tutorial, recasting conditional random fields, max-margin Markov networks and graph transformer networks as EBMs. In 2019 Du and Mordatch showed that deep convolutional EBMs trained with MCMC could generate CIFAR-10 and ImageNet images approaching the quality of generative adversarial networks of that time, and Grathwohl and colleagues showed that a standard classifier could be reinterpreted and trained as an EBM. The same year Song and Ermon's score-based model, which learns energy gradients rather than energies, helped set up the diffusion models that now dominate image generation.
Compared with other generative approaches, EBMs make the fewest structural assumptions. Autoregressive models such as GPT-style language models factor the probability into a product of next-token probabilities, which makes exact likelihood easy but fixes an order. Normalizing flows require invertible architectures so the density can be computed exactly. Variational autoencoders train an approximate lower bound. Generative adversarial networks generate samples quickly but do not provide a density at all. An EBM can use any neural network that outputs one number, can combine several energies by adding them, which Du and Mordatch used for compositional generation, and gives a score that can flag unusual inputs. Diffusion and score-based models keep much of this flexibility while sidestepping the hardest part of EBM training by learning gradients at many noise levels.
The weaknesses are real. Sampling from an EBM usually requires many iterative MCMC steps, often Langevin dynamics, which repeatedly moves a sample a small step down the energy gradient and adds noise. That makes both training and generation slow, and short chains can leave the model poorly trained in regions the sampler never visits. Training can be unstable, and because Z is unknown, the exact likelihood of a test example usually cannot be reported, which makes comparison with other models harder. Results are sensitive to step sizes, noise levels and regularization.
In practice, building a small EBM requires no special hardware beyond what a classifier of the same size would need, but training costs multiply with the number of sampling steps per update. For a learner, the most accessible routes are reading a classifier's logits as energies, which costs nothing extra, or training a score-based model, which turns the energy idea into a stable recipe with standard deep learning tools.
04کام کی مثال
Reading a three-class classifier as an energy-based model
Take a classifier that outputs logits of 2.0 for cat, 0.5 for dog and -1.0 for car on one image.
Define each label's energy as the negative logit: E(cat) = -2.0, E(dog) = -0.5, E(car) = 1.0.
Predict by energy minimization: cat has the lowest energy, so it is the predicted label, matching the classifier.
Compute probabilities with the Gibbs distribution: exp(2.0) = 7.39, exp(0.5) = 1.65, exp(-1.0) = 0.37, and Z = 9.41.
Divide to get p(cat) = 0.79, p(dog) = 0.18 and p(car) = 0.04, which is exactly the softmax of the logits.
Compute the input's own energy as -log Z = -log 9.41 = -2.24, a score that should be higher for unusual inputs.
جو یہ دکھاتا ہے۔
A label prediction, a probability for each label and a single energy for the input itself. Check that the three probabilities sum to about 1 and match a softmax computed by any library; then compare the input energy across normal and unusual images to see whether it separates them.
حقیقی دنیا کا نفاذ
A Hopfield network, introduced by John Hopfield in 1982, stores images as low-energy states and recovers a stored image from a distorted or partial copy by updating units until the network's energy stops falling.
Grathwohl and colleagues' 2019 Joint Energy-based Model reinterprets an ordinary image classifier's output scores as energies, which the authors report improves calibration and out-of-distribution detection while also letting the classifier generate images.
Du and Mordatch's 2019 EBM work generated CIFAR-10 and ImageNet images by Markov chain sampling from a learned energy function and used the same model to fill in missing image regions and plan robot hand trajectories.
Score-based generative models, such as Song and Ermon's NeurIPS 2019 method, learn the gradient of the log density, which is the negative gradient of an energy, and reached an Inception Score of 8.87 on CIFAR-10.
Structured prediction systems such as conditional random fields, used for tasks like sequence labeling in speech and handwriting recognition, can be written as EBMs, as LeCun and colleagues' 2006 tutorial shows.
توانائی پر مبنی ماڈلز کا مستقبل
Research on EBMs now runs along three lines. The first is cheaper training and sampling. Song and Kingma's 2021 tutorial closed with a survey of alternative methods that were still under active research, and the high cost of MCMC sampling remains the main reason EBMs are less common than diffusion or autoregressive models for large-scale generation. The second is the overlap with diffusion and score-based models. Since Song and Ermon's 2019 NeurIPS paper showed that learning energy gradients at several noise levels gives strong image samples, much of the practical progress on energy-like models has happened under the diffusion label. Open questions include when an explicit energy, rather than only its gradient, is worth the extra cost, for example for composing several models by adding their energies or for scoring how unusual an input is. The third is using energy as a scoring function inside larger systems, for out-of-distribution detection, calibration and planning, directions already explored by Grathwohl and colleagues and by Du and Mordatch in 2019. The 2024 Nobel Prize in Physics for Hopfield networks and Boltzmann machines has also renewed attention to the physics roots of these ideas. None of this makes EBMs a replacement for current large models, but the energy view remains a common language for comparing them.
اسے عملی جامہ پہنانا
یہ کیوں اہمیت رکھتا ہے۔
- لاگت اور بجٹ. فن تعمیر کے فیصلے سالوں تک کارکردگی اور آپریٹنگ لاگت کو آگے بڑھاتے ہیں۔
- واضح فیصلے. تکنیکی تعلیم ٹیموں کو صحیح اسٹیک منتخب کرنے میں مدد کرتی ہے، نہ صرف جدید ترین۔
- کوالٹی کنٹرول. انجینئرنگ کے بہتر انتخاب پیداوار میں قابل اعتماد واقعات کو کم کرتے ہیں۔
پر نگاہ رکھیں
- ایک بینچ مارک کو بہتر بنانا نظام کی وسیع تر کمزوریوں کو چھپا سکتا ہے۔
- بنیادی ڈھانچے اور دیکھ بھال کے اخراجات کو اکثر کم سمجھا جاتا ہے۔
- سیکورٹی اور مشاہداتی فرق بڑھ سکتا ہے کیونکہ نظام زیادہ پیچیدہ ہو جاتا ہے۔
اگلے اقدامات
- نفاذ سے پہلے تاخیر، معیار اور لاگت کے اہداف کی وضاحت کریں۔
- حقیقت پسندانہ بوجھ اور ڈیٹا کی شرائط کے تحت بینچ مارک۔
- غلطیوں، بڑھے ہوئے، اور صارف کے اثرات کے لیے آلے کی نگرانی۔
- اسکیلنگ سے پہلے رول بیک اور واقعہ کے ردعمل کے راستے تیار کریں۔
ذرائع اور مزید پڑھنا
- LeCun et al., in Predicting Structured Data, MIT Press, 2006A Tutorial on Energy-Based Learning
- arXiv (Song and Kingma, 2021)How to Train Your Energy-Based Models
- arXiv (Du and Mordatch, 2019)Implicit Generation and Generalization in Energy-Based Models
- arXiv (Grathwohl et al., 2019)Your Classifier is Secretly an Energy Based Model and You Should Treat it Like One
- NeurIPS 2019 (arXiv)Generative Modeling by Estimating Gradients of the Data Distribution
- The Nobel PrizeThe Nobel Prize in Physics 2024: Popular information
دریافت کرتے رہیں
مفت نیوز لیٹر
روزانہ AI بریفنگ حاصل کریں
ہر ہفتے کے دن صبح تین تصدیق شدہ AI کہانیاں، سادہ انگریزی میں لکھی گئیں۔ ہمیشہ کے لیے مفت، کوئی اشتہار نہیں۔
ہر ہفتے کے دن ایک ای میل۔ ایک کلک میں ان سبسکرائب کریں۔ ہم کبھی بھی آپ کا پتہ فروخت یا شیئر نہیں کرتے۔
اپنے آپ کو جانچیں۔
Take the Energy-Based Models quiz
ہر جواب پر فوری فیڈبیک، اور کورس پاس کرنے کے بعد قابلِ تصدیق ID کے ساتھ شیئر کرنے کے قابل سرٹیفکیٹ۔
مفت AI تعلیم کی حمایت کریں۔ AI Understanding ایک 501(c)(3) غیر منافع بخش ادارہ ہے — کوئی اشتہار نہیں، کوئی پے وال نہیں، کبھی نہیں۔ عطیہ کریں۔
اکثر پوچھے گئے سوالات
What is Energy-Based Models?
An energy-based model (EBM) is a machine learning model that assigns a single number, called energy, to every possible configuration of its variables, with low energy meaning compatible or likely and high energy meaning unlikely. Because the energies never have to be normalized into probabilities that sum to one, EBMs are very flexible, which is why they serve as a common framework for classifiers, Hopfield networks, Boltzmann machines and score-based generative models.
توانائی پر مبنی ماڈل میں، توانائی کا ڈیٹا پوائنٹ کے امکان سے کیا تعلق ہے؟
بولٹزمین ڈسٹری بیوشن کے ذریعے، p(x) exp(-E(x)) کے متناسب ہے، اس لیے قابل فہم ڈیٹا کو کم توانائی اور زیادہ امکان تفویض کیا جاتا ہے۔
توانائی پر مبنی ماڈلز کی تربیت کو کیا مشکل بناتا ہے؟
کمپیوٹنگ Z کے لیے پوری ان پٹ اسپیس پر exp(-E(x)) کا خلاصہ یا انضمام درکار ہوتا ہے، جو کہ عموماً ناقابل عمل ہوتا ہے، تربیت کے اندازے کے طریقوں کو مجبور کرتا ہے۔
نمونے لینے کا کون سا طریقہ عام طور پر EBM سے نمونے لینے کے لیے استعمال ہوتا ہے؟
لینگوین ڈائنامکس بار بار نمونوں کو توانائی کے میلان کے ساتھ نیچے کی طرف لے جاتی ہے جبکہ شور کو شامل کرتے ہوئے، کم توانائی والے خطوں کی طرف موڑتا ہے۔
سکور میچنگ جیسے طریقے پارٹیشن فنکشن Z کو کمپیوٹنگ سے کیوں بچ سکتے ہیں؟
چونکہ Z کا انحصار x پر نہیں ہے، اس لیے x کے حوالے سے لاگ p(x) میں فرق کرنا اسے منسوخ کر دیتا ہے، صرف توانائی کا میلان رہ جاتا ہے، جو قابل عمل ہے۔
ان میں سے کون سا کلاسک توانائی پر مبنی ماڈل ہے؟
ہاپ فیلڈ نیٹ ورک ایک ابتدائی توانائی پر مبنی ماڈل ہیں جو پیٹرن کو کم توانائی والی ریاستوں کے طور پر ذخیرہ کرتے ہیں اور توانائی کو کم سے کم کرکے انہیں یاد کرتے ہیں۔
سیکھتے رہیں
متعلقہ گائیڈز
اس موضوع کے لیے مزید گائیڈز چنے گئے ہیں۔