category stringclasses 107
values | title stringlengths 15 179 | question_link stringlengths 59 147 | question_body stringlengths 53 33.8k | answer_html stringlengths 0 28.8k | __index_level_0__ int64 0 1.58k |
|---|---|---|---|---|---|
gradient descent | In general - is Stochastic Gradient Descent a "superior" algorithm compared to Gradient Descent? | https://ai.stackexchange.com/questions/34532/in-general-is-stochastic-gradient-descent-a-superior-algorithm-compared-to-g | <p>On a very informal level, if we were to compare the (classical) <strong>Gradient Descent Algorithm to the Stochastic Gradient Descent Algorithm</strong>, the first thing that comes to mind is:</p>
<ul>
<li>Gradient Descent can be considered as a slower algorithm than Stochastic Gradient Descent, since it requires pe... | <p>Stochastic Gradient Descent empirically has shown to lead better results than classic Gradient Descent since its formulation, and today we're getting close to understand that it's not just luck, but the results of better mathematical qualities as well. SO the answer to your question is no, the theoretical results al... | 312 |
gradient descent | What do you mean by "updating based on a training example/batch" in Gradient Descent? | https://ai.stackexchange.com/questions/43688/what-do-you-mean-by-updating-based-on-a-training-example-batch-in-gradient-des | <p>My understanding is this: When doing Stochastic Gradient Descent over a neural network, in every epoch, we run <span class="math-container">$n$</span> iterations (where the dataset has <span class="math-container">$n$</span> training examples) and in every iteration, we take a random sample and update the parameters... | <p>In batch gradient descent computing the loss function every time serves several purposes. While the value of the loss itself may not directly affect the backpropagation process, as you said monitoring the loss over time is essential to ensure that the optimization process is converging. Also many optimization algori... | 313 |
gradient descent | Oscillating around the saddle point in gradient descent? | https://ai.stackexchange.com/questions/18410/oscillating-around-the-saddle-point-in-gradient-descent | <p>I was reading a blog post that talked about the problem of the saddle point in training. </p>
<blockquote>
<p>In the post, it says if the loss function is flatter in the direction of x (local minima here) compared to y at the saddle point, gradient descent will oscillate to and from the y direction. This gives an... | <p>It's important to note that in a pragmatic instance of ML on a "real dataset", you likely wouldn't have a "strict" saddle point with precisely zero gradient. Your error surface won't be "smooth", so even though you would have something that resembles a saddle point, what you would obtain would in fact be a small reg... | 314 |
gradient descent | Different methods of calculating gradients of cost function(loss function) | https://ai.stackexchange.com/questions/19895/different-methods-of-calculating-gradients-of-cost-functionloss-function | <p>We require to find the gradient of loss function(cost function) w.r.t to the weights to use optimization methods such as SGD or gradient descent. So far, I have come across two ways to compute the gradient:</p>
<ol>
<li>BackPropagation</li>
<li>Calculating gradient of loss function by calculus</li>
</ol>
<p>I foun... | <p>I'm pretty sure they're the same thing. Both backpropagation and gradient descent's essential ideas are to calculate the partial derivative of the cost with respect to each weight, and subtract the partial derivative times the learning rate.</p>
| 315 |
gradient descent | Why is loss displayed as a parabola in mean squared error with gradient descent? | https://ai.stackexchange.com/questions/27390/why-is-loss-displayed-as-a-parabola-in-mean-squared-error-with-gradient-descent | <p>I'm looking at the loss function: mean squared error with gradient descent in machine learning. I'm building a single-neuron network (perceptron) that outputs a linear number. For example:</p>
<p>Input * Weight + Bias > linear activation > output.</p>
<p>Let's say the output is 40 while I expect the number 20.... | <p>Mean Square Error (MSE) is a quadratic function and the further you go away from your optimum the bigger (quadratic) the MSE gets. Take <span class="math-container">$o_{expected}=20$</span> and <span class="math-container">$o_{net}=40$</span> as example. Your MSE is then 400, because
<span class="math-container">$MS... | 316 |
gradient descent | Do gradient-based algorithms deal with the flat regions with desired points? | https://ai.stackexchange.com/questions/30300/do-gradient-based-algorithms-deal-with-the-flat-regions-with-desired-points | <p>I am studying a chapter named <a href="https://www.deeplearningbook.org/contents/numerical.html" rel="nofollow noreferrer">Numerical Computation</a> of a deep learning book. Afaik, it does not deal with flat regions with desired points.</p>
<p>For example, let us consider a function whose local/global minimum or max... | <blockquote>
<p>Can gradient-based algorithms work on those curves with their local/global minima, or do maxima lie on flat regions?</p>
</blockquote>
<p>Yes, with some minor caveats.</p>
<p>All the points on the flat region are equivalent (and in your example, are all valid global minimum points). Gradients outside of... | 317 |
gradient descent | Unclear fact about difference between Gradient Descent to Stochastic Gradient Decent in wikipedia | https://ai.stackexchange.com/questions/34440/unclear-fact-about-difference-between-gradient-descent-to-stochastic-gradient-de | <p>From wikipedia page it mentioned:</p>
<blockquote>
<p>To economize on the computational cost at every iteration, stochastic
gradient descent samples a subset of summand functions at every step.
This is very effective in the case of large-scale machine learning
problems</p>
</blockquote>
<p>And later on it demonstrat... | <p>That paragraph is incomplete and unclear indeed.
Let's crack the difference with a concrete example: logistic regression.</p>
<p>The objective we want to minimize is:</p>
<p><span class="math-container">$J_{train}(\theta)=\frac{1}{2m}\sum_{i=1}^{m}(h_{\theta}(x^{i})-y^{i})^{2}$</span></p>
<p>Notice how this loss for... | 318 |
gradient descent | Does Musk know what gradient descent is? | https://ai.stackexchange.com/questions/3187/does-musk-know-what-gradient-descent-is | <p>From <a href="https://futurism.com/elon-musk-an-ai-attack-on-the-internet-is-only-a-matter-of-time/" rel="nofollow noreferrer">Futurism.com</a>:</p>
<blockquote>
<p>Musk indicates that internet infrastructure is "particularly susceptible" to a method called gradient descent algorithm, a mathematical problem-solvi... | <p>I think Musk was using the terminology correctly though perhaps with hyperbole. </p>
<p>I believe this was tweeted in the context of the botnet attacks on name-resolution services that broke Netflix and a large number of other internet services for a time. He was expressing the idea that you could train a botnet-b... | 319 |
gradient descent | Are gradients of weights in RNNs dependent on the gradient of every neuron in that layer? | https://ai.stackexchange.com/questions/3761/are-gradients-of-weights-in-rnns-dependent-on-the-gradient-of-every-neuron-in-th | <p>I am writing my own recurrent neural network in Java to understand the inner workings better. While working through the math, I found that in timesteps later than 2 the gradient of weight w of neuron n depends on the gradients of all neurons at all timesteps before. A handwritten example is given, I tried to write a... | 320 | |
gradient descent | What can be deduced about the "algorithm" of backpropagation/gradient descent? | https://ai.stackexchange.com/questions/6395/what-can-be-deduced-about-the-algorithm-of-backpropagation-gradient-descent | <p>On this video</p>
<p><a href="https://www.youtube.com/watch?v=YUVLgccVi54" rel="nofollow noreferrer">Link to video</a></p>
<p>a neurologist starts by saying that we do not know how neurons calculate gradients for backpropagation.</p>
<p>At minute 30:39 hes showing faster convergence for "our algorithm", which see... | <p>There are 3 separate issues that are often confounded in Deep Learning and Neuroscience:</p>
<ol>
<li>Deep Learning is inspired by the way the biological brain works.</li>
<li>Deep Learning is how the biological brain works.</li>
<li>Deep Learning can model how the biological brain works.</li>
</ol>
<p>Number 1 is... | 321 |
gradient descent | SARSA won't work for linear function approximator for MountainCar-v0 in OpenAI environment. What are the possible causes? | https://ai.stackexchange.com/questions/9590/sarsa-wont-work-for-linear-function-approximator-for-mountaincar-v0-in-openai-e | <p>I am learning Reinforcement Learning from the lectures from David Silver. I finished lecture 6 and went on to try SARSA with linear function approximator for MountainCar-v0 environment from OpenAI.</p>
<p>A brief explanation of the MountainCar-v0 environment. The state is denoted by two features, position, and velo... | <p>On doing some research on why this problem might be occurring, I delved into some statistics of the environment. Interestingly, after a small number of episodes (~20), the agent always chooses to take only one action (this has been mentioned in the question too). Also, the Q values of the state-action pairs do not c... | 322 |
gradient descent | Neural networks when gradient descent is not possible | https://ai.stackexchange.com/questions/12938/neural-networks-when-gradient-descent-is-not-possible | <p>I am looking for an example in which it is simply impossible to use some sort of gradient descent to train a neural network. Is this available? </p>
<p>I have read quite some papers about gradient-free optimization tools, but they always use it on a network for which you can also use gradient descent. I want to hav... | 323 | |
gradient descent | At which point, does the momentum based GD helps really in this figure? | https://ai.stackexchange.com/questions/35648/at-which-point-does-the-momentum-based-gd-helps-really-in-this-figure | <p>Classical gradient descent algorithms sometimes overshoot and escape minima as they depend on the gradient only. You can see such a problem during the update from point 6.</p>
<p><a href="https://i.sstatic.net/XJu8M.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/XJu8M.jpg" alt="enter image descriptio... | <p>What your professor most probably means is that since momentum adds your previous gradient to the current (as in a moving average). The speed built up till point 7 (moving in to the right) will added to the gradient from 7 to 8 that is going to the left, causing them to cancel each other out (what might cause the up... | 324 |
gradient descent | Loss keep increasing when using full-batch gradient descent | https://ai.stackexchange.com/questions/48379/loss-keep-increasing-when-using-full-batch-gradient-descent | <p>I am learning linear regression model based on this <a href="https://github.com/d2l-ai/d2l-zh/blob/master/chapter_linear-networks/linear-regression-scratch_origin.md?plain=1#L380" rel="nofollow noreferrer">tutorial</a>. Following the example provided in the tutorial, it works fine with mini-batch stochastic gradient... | <p>After post the question to chatgpt, it told me that I have to zoom the gradient:</p>
<p>By modify from</p>
<pre><code>sgd([w, b], lr, 1) # No batch used here
</code></pre>
<p>To</p>
<pre><code>sgd([w, b], lr, 1en(features)) # No batch used here
</code></pre>
<p>It works now.</p>
| 325 |
gradient descent | Why doesn't deep learning use modular arithmetic like cryptography, even though both deal with non-linear functions? | https://ai.stackexchange.com/questions/48193/why-doesnt-deep-learning-use-modular-arithmetic-like-cryptography-even-though | <p>So, deep learning models are great at learning complex, non-linear patterns and seem to handle noise just fine. But under the hood, they rely on IEEE754 floating-point numbers, which can lose precision (e.g., rounding errors). Meanwhile, cryptography, like elliptic curve crypto, also deals with theoretically smooth,... | <p>Cryptography benefits from the exactness of finite fields for reasons of security and exactness in discrete math, DL depends on the continuous adjustments that floating-point arithmetic facilitates. For features that are inherently continuous like temperature, encoding them into a cyclic space would only make sense ... | 326 |
gradient descent | Does it make sense for a computational graph to have entirely non-differentiable functions? | https://ai.stackexchange.com/questions/48014/does-it-make-sense-for-a-computational-graph-to-have-entirely-non-differentiable | <p>Does it make sense for a <a href="https://ai.stackexchange.com/q/47986/48038">computational graph</a> to have entirely non-differentiable functions?</p>
<p>For example, <a href="https://pytorch.org/docs/stable/notes/autograd.html#gradients-for-non-differentiable-functions" rel="nofollow noreferrer">PyTorch can handl... | <p>Entirely non-differentiable functions make sense since one might intentionally include them in parts of a model where gradient updates are either not required or not meaningful, such as the <span class="math-container">$\text{argmax}$</span> operator or even a simple routing or logging function of incoming data. For... | 327 |
gradient descent | What is the gradient of a non-linear SVM with respect to the input? | https://ai.stackexchange.com/questions/20169/what-is-the-gradient-of-a-non-linear-svm-with-respect-to-the-input | <p>The objective function of an SVM is the following:</p>
<p><span class="math-container">$$J(\mathbf{w}, b)=C \sum_{i=1}^{m} \max \left(0,1-y^{(i)}\left(\mathbf{w}^{t} \cdot \mathbf{x}^{(i)}+b\right)\right)+\frac{1}{2} \mathbf{w}^{t} \cdot \mathbf{w}$$</span>
where</p>
<ul>
<li><span class="math-container">$\mathbf{w}... | 328 | |
gradient descent | Can a neural network learn to avoid wrong decisions using backpropagation? | https://ai.stackexchange.com/questions/3854/can-a-neural-network-learn-to-avoid-wrong-decisions-using-backpropagation | <p>I studied the articles on <a href="http://neuralnetworksanddeeplearning.com/" rel="noreferrer">Neural Networks and Deep Learning</a> from Michael Nielsen and developed a simple neural network based on his examples. I understand how backpropagation works and I already taught my neural network to not only play TicTacT... | <p>What you are describing is conceptually close to adversarial training. you should read more on adversarial examples and generative adversarial networks for more information.</p>
<p>The idea is that there is a discriminator network, whose job is to correctly discriminate between positive and negative examples. We al... | 329 |
gradient descent | How can we calculate the gradient of the Boltzmann policy over reward function? | https://ai.stackexchange.com/questions/7147/how-can-we-calculate-the-gradient-of-the-boltzmann-policy-over-reward-function | <p>I'm struggling with an inverse reinforcement learning problem which seems to appear quite often around the literature, yet I can't find any resources explaining it.</p>
<p>The problem is that of calculating the gradient of a Boltzmann policy distribution over the reward weights <span class="math-container">$\theta$... | <p>The main point here is that you can write <span class="math-container">$Q(s, a|\theta) = R = \theta^\top \phi(s, a)$</span>. For more details on this, you can read up on Policy Gradients (Chapter 13) from the 2nd edition of the Sutton and Barto book (in fact the expression you're looking for is equation 13.9)</p>
<... | 330 |
gradient descent | Are on-line backpropagation iterations perpendicular to the constraint? | https://ai.stackexchange.com/questions/11407/are-on-line-backpropagation-iterations-perpendicular-to-the-constraint | <p><a href="https://page.mi.fu-berlin.de/rojas/neural/chapter/K8.pdf#page=9" rel="nofollow noreferrer">Raul Rojas' Neural Networks A Systematic Introduction, section 8.1.2</a> relates off-line backpropagation and on-line backpropagation with Gauss-Jacobi and Gauss-Seidel methods for finding the intersection of two line... | <p>Answer by <a href="https://math.stackexchange.com/users/248286/theo-bendit">Theo Bandit</a> <a href="https://math.stackexchange.com/questions/3160982/how-is-x-1-x-2-normal-to-x-1w-1-x-2w-2-y/3160988#3160988">at maths stackexchange</a></p>
<blockquote>
<p>If you choose two points <span class="math-container">$(w_1... | 331 |
gradient descent | In NN, as iterations of Gradient descent increases, the accuracy of Test/CV set decreases. how can i resolve this? | https://ai.stackexchange.com/questions/13109/in-nn-as-iterations-of-gradient-descent-increases-the-accuracy-of-test-cv-set | <p>As mentioned in the title I'm using 300 Dataset example with 500 feature as an input.</p>
<p>As I'm training the dataset, I found something peculiar. Please look at the data shown below.</p>
<blockquote>
<p><strong>Iteration 5000 | Cost: 2.084241e-01</strong></p>
<p>Training Set Accuracy: 100.000000</p>
... | <p>Training scores improving (loss decreasing and accuracy increasing) whilst the opposite happens with cross validation and test data is a sign of <a href="https://en.wikipedia.org/wiki/Overfitting" rel="nofollow noreferrer">overfitting to the training data</a>. Your neural network is getting worse at generalising and... | 332 |
gradient descent | How to calculate multiobjective optimization cost for ordinary problems? | https://ai.stackexchange.com/questions/15685/how-to-calculate-multiobjective-optimization-cost-for-ordinary-problems | <p><strong>What I did:</strong><br>
Created a population of 2D legged robots in a simulated environment. Found the best motor rotation values to make the robots move rightward, using an objective function with Differential Evolution (could use PSO or GA too), that returned the distance moved rightward. Gradient descent... | <p>I eventually used the keep-efficient function from <a href="https://stackoverflow.com/a/32793059/453673">this answer</a> to calculate the Pareto front and used the k-means function to calculate the centroid of the front. This gave me the approximate knee-point of the front, which is usually the optimal solution. One... | 333 |
gradient descent | Why gradients are so small in deep learning? | https://ai.stackexchange.com/questions/18325/why-gradients-are-so-small-in-deep-learning | <p>The learning rate in my model is <code>0.00001</code> and the gradients of the model is within the distribution of <code>[-0.0001, 0.0001]</code>. Is it normal?</p>
| 334 | |
gradient descent | How to prove that gradient descent doesn't necessarily find the global optimum? | https://ai.stackexchange.com/questions/18658/how-to-prove-that-gradient-descent-doesnt-necessarily-find-the-global-optimum | <p>How can I prove that gradient descent doesn't necessarily find the global optimum?</p>
<p>For example, consider the following function</p>
<p><span class="math-container">$$f(x_1, x_2, x_3, x_4) = (x_1 + 10x_2)^2 + 5x_2^3 + (x_2 + 2x_3)^4 + 3x_1x_4^2$$</span></p>
<p>Assume also that we can't find the optimal valu... | <p>Well, GD terminates once the gradients are 0, right? Now, in a non-convex function, there could be some points, which do not belong to the global minima, and yet, have 0 gradients. For example, such points can belong to saddle points and local minima.</p>
<p>Consider this picture and say you start GD at the x label... | 335 |
gradient descent | If the normal equation works, why do we need gradient descent? | https://ai.stackexchange.com/questions/22401/if-the-normal-equation-works-why-do-we-need-gradient-descent | <p>Recently, I followed the open course CS229,
<a href="http://cs229.stanford.edu/notes/cs229-notes1.pdf" rel="nofollow noreferrer">http://cs229.stanford.edu/notes/cs229-notes1.pdf</a><br />
This lecturer introduces an alternative approach to gradient descent that is called "Normal Equation" and the equation ... | <p>That <a href="https://mathworld.wolfram.com/NormalEquation.html" rel="nofollow noreferrer">normal equation</a> is sometimes called the <a href="https://mathworld.wolfram.com/Closed-FormSolution.html" rel="nofollow noreferrer">closed-form solution</a>.</p>
<p>The short answer to your question is that the closed-form ... | 336 |
gradient descent | How parameter adjustment works in Gradient Descent? | https://ai.stackexchange.com/questions/23737/how-parameter-adjustment-works-in-gradient-descent | <p>I am trying to comprehend how the Gradient Descent works.</p>
<p>I understand we have a cost function which is defined in terms of the following parameters,</p>
<p><span class="math-container">$J(𝑤_{1},𝑤_{2},.... , w_{n}, b)$</span></p>
<p>the derivative would tell us which direction to adjust the parameters.</p>
... | <p>Imagine we have the curve <span class="math-container">$f(x) = x^2$</span>, and we want to find the minimum of this function. The derivate of <span class="math-container">$f$</span> with respect to <span class="math-container">$x$</span> is <span class="math-container">$2x$</span>. Now, gradient descent works by upd... | 337 |
gradient descent | Why is the perceptron criterion function differentiable? | https://ai.stackexchange.com/questions/24261/why-is-the-perceptron-criterion-function-differentiable | <p>I'm reading chapter one of the book called <a href="https://dl.uswr.ac.ir/bitstream/Hannan/141305/2/9783319944623.pdf" rel="nofollow noreferrer">Neural Networks and Deep Learning</a> from Aggarwal.</p>
<p>In section 1.2.1.1 of the book, I'm learning about the perceptron. One thing that book says is, if we use the si... | <p><span class="math-container">$\max(-y_i(w x_i), 0)$</span> is not partial derivable respect <span class="math-container">$w$</span> if <span class="math-container">$w x_i=0$</span>.</p>
<p>Loss functions are problematic when not derivable in some point, but even more when they are flat (constant) in some interval of... | 338 |
gradient descent | How can the gradient of the weight be calculated in the viewpoint of matrix calculus? | https://ai.stackexchange.com/questions/27335/how-can-the-gradient-of-the-weight-be-calculated-in-the-viewpoint-of-matrix-calc | <p>Let <span class="math-container">$\sigma(x)$</span> be sigmoid function. Consider the case where <span class="math-container">$\text{out}=\sigma(\vec{x} \times W + \vec{b})$</span>, and we want to compute <span class="math-container">$\frac{\partial{\text{out}}}{\partial{w}
}.$</span><br />
Set the dimension as belo... | <p>I think I understand the process now. Let <span class="math-container">$x$</span> has the dimension <span class="math-container">$(n, p)$</span> and W has the dimension <span class="math-container">$(p, q)$</span>. In neural network, <span class="math-container">$n$</span> denotes the samples in the batch and <span ... | 339 |
gradient descent | Which function $(\hat{y} - y)^2$ or $(y - \hat{y})^2$ should I use to compute the gradient? | https://ai.stackexchange.com/questions/12612/which-function-haty-y2-or-y-haty2-should-i-use-to-compute-th | <p>The MSE can be defined as <span class="math-container">$(\hat{y} - y)^2$</span>, which should be equal to <span class="math-container">$(y - \hat{y})^2$</span>, but I think their derivative is different, so I am confused of what derivative will I use for computing my gradient. Can someone explain for me what term to... | <p>The derivative of <span class="math-container">$\mathcal{L_1}(y, x) = (\hat{y} - y)^2 = (f(x) - y)^2$</span> with respect to <span class="math-container">$\hat{y}$</span>, where <span class="math-container">$f$</span> is the model and <span class="math-container">$\hat{y} = f(x)$</span> is the output of the model, i... | 340 |
gradient descent | What's the rationale behind mini-batch gradient descent? | https://ai.stackexchange.com/questions/7494/whats-the-rationale-behind-mini-batch-gradient-descent | <p>I am reading a book that states</p>
<blockquote>
<p>As the mini-batch size increases, the gradient computed is closer to the 'true' gradient</p>
</blockquote>
<p>So, I assume that they are saying that mini-batch training only focuses on decreasing the cost function in a certain 'plane', sacrificing accuracy for spee... | <p>The basic idea behind mini-batch training is rooted in the exploration / exploitation tradeoff in <a href="https://en.wikipedia.org/wiki/Local_search_(optimization)" rel="nofollow noreferrer">local search and optimization algorithms</a>. </p>
<p>You can view training of an ANN as a local search through the space of... | 341 |
gradient descent | Is it possible with stochastic gradient descent for the error to increase? | https://ai.stackexchange.com/questions/13288/is-it-possible-with-stochastic-gradient-descent-for-the-error-to-increase | <p>As simple as that. Is there any scenario where the error might <em>increase</em>, if only by a tiny amount, when using SGD (no momentum)?</p>
| <p>Yes. Not only that, but error is highly noisy, prone to big spikes and sometimes quite long period of increase before decrease again or stabilize. Often it's even impossible to understand error plot without passing it through smoothing filter, so noisy it is. Specific depend on the problem of cause. It's not only fo... | 342 |
gradient descent | What is the derivative of a specific output with respect to a specific weight? | https://ai.stackexchange.com/questions/25522/what-is-the-derivative-of-a-specific-output-with-respect-to-a-specific-weight | <p>If I have a neural network, and say the 6th output node of the neural network is:</p>
<p><span class="math-container">$$x_6 = w_{16}y_1 + w_{26}y_2 + w_{36}y_3$$</span></p>
<p>What does that make the derivative of:</p>
<p><span class="math-container">$$\frac{\partial x_6}{\partial w_{26}}$$</span></p>
<p>I guess tha... | <p>Formally speaking <span class="math-container">$x_6$</span> is a function of <span class="math-container">$w_{16},\ w_{26}$</span> and <span class="math-container">$w_{36}$</span>, that is <span class="math-container">$$x_6 =f(w_{16}, w_{26}, w_{36})=w_{16}y_1 + w_{26}y_2 + w_{36}y_3.$$</span>
The derivative w.r.t. ... | 343 |
gradient descent | How can we reach global optimum? | https://ai.stackexchange.com/questions/11729/how-can-we-reach-global-optimum | <p>Gradient descent can get stuck into local optimum. Which techniques are there to reach global optimum?</p>
| <p>In Deep Learning there are several methods to improve "stuck" gradient - decrease learning rate, use cyclic learning rate - cycle it from bigger to smaller value. More radical method is completely reinitialize last or two last (before loss) layers of the network. </p>
<p>In non-Deep Learning ML out of those only de... | 344 |
gradient descent | Simple Polynomial Gradient Descent algorithm not working | https://ai.stackexchange.com/questions/34230/simple-polynomial-gradient-descent-algorithm-not-working | <p>I am trying to implement a simple 2nd order polynomial gradient descent algorithm in Java. It is not converging and becomes unstable. How do I fix it?</p>
<pre><code>public class PolyGradientDescent {
public static double getValue(double input) {
return 3 * input * input - 4 * input + 3.5;
}
public static voi... | <p>I tested your code in python and it works just fine, when I decrease the learning rate (divided by 100) by a bit more (and the epochs multiplied by 100).</p>
<p>I also changed the way the derivative was calculated to make it more mathematically correct :)</p>
<pre><code>import random
def getValue(x):
return 3 *... | 345 |
gradient descent | Why would one prefer the gradient of the sum rather than the sum of the gradients? | https://ai.stackexchange.com/questions/34910/why-would-one-prefer-the-gradient-of-the-sum-rather-than-the-sum-of-the-gradient | <p>When gradients are aggregated over mini batches, I sometimes see formulations like this, e.g., in the "Deep Learning" book by Goodfellow et al.</p>
<p><span class="math-container">$$\mathbf{g} = \frac{1}{m} \nabla_{\mathbf{w}} \left( \sum\limits_{i=1}^{m} L \left( f \left( \mathbf{x}^{(i)}, \mathbf{w} \rig... | 346 | |
gradient descent | How is direction of weight change determined by Gradient Descent algorithm | https://ai.stackexchange.com/questions/5670/how-is-direction-of-weight-change-determined-by-gradient-descent-algorithm | <p>The result of gradient descent algorithm is a vector. So how does this algorithm decide the direction for weight change? We Give hyperparameters for step size. But how is the vector direction for weight change, for the purpose of reducing the Loss function in a Linear Regression Model, determined by this algorithm?<... | <p>First thing is that what does gradient descent do? Gradient Descent is a tool of calculus which we use to determine the parameters (here weights) used in a Machine Learning algorithm or a Neural Network, by running the Gradient Descent algorithm iteratively. </p>
<p>What does the vector obtained from one iteration ... | 347 |
gradient descent | How can a neural network learn when the derivative of the activation function is 0? | https://ai.stackexchange.com/questions/10158/how-can-a-neural-network-learn-when-the-derivative-of-the-activation-function-is | <p>Imagine that I have an artificial neural network with a single hidden layer and that I am using ReLU as my activating function.
If by change I initialize my bias and my weights in such a form that:
<span class="math-container">$$
X * W + B < 0
$$</span>
for every input <strong>x</strong> in <strong>X</strong> the... | <blockquote>
<p>In a setup like the above where the derivat[iv]e is 0 is it true that an NN won´t learn anything?</p>
</blockquote>
<p>There are a couple of adjustments to gradients that <em>might</em> apply if you do this in a standard framework:</p>
<ul>
<li><p>Momentum may cause weights to continue changing if a... | 348 |
gradient descent | In gradient descent's update rule, why do we use $\sigma(z^{l-1})\frac{\delta C_0}{ \delta w^{l}}$ instead of $\frac{\delta C_0}{\delta w^{l}}$? | https://ai.stackexchange.com/questions/26920/in-gradient-descents-update-rule-why-do-we-use-sigmazl-1-frac-delta-c | <p>I am trying to code a two layered neural network simple NN as I have described here <a href="https://itisexplained.com/html/NN/ml/5_codingneuralnetwork/" rel="nofollow noreferrer">https://itisexplained.com/html/NN/ml/5_codingneuralnetwork/</a></p>
<p>I am getting stuck on the last step of updating the weights after ... | <p>Okay - the answer is here <a href="https://explained.ai/matrix-calculus/#sec6.2" rel="nofollow noreferrer">https://explained.ai/matrix-calculus/#sec6.2</a> and it is pretty involved. Basically, there is a difference when you derive the equation for one neuron and when you have to do practically for a set of neurons... | 349 |
language modeling | Any popular diffusion model for language modeling? | https://ai.stackexchange.com/questions/45902/any-popular-diffusion-model-for-language-modeling | <p>Is there a popular diffusion model-based framework for language modelling? If not, is it because of the difficulty sampling for discrete distributions?</p>
| <p>The problem with the current diffusion models, is that they are great density models, but they require to know a priori the size of the sample (ie the size of the image), which definitely is not the case for text</p>
<p>However, you might get around this by first having a model, an encoder, that encodes text to a fi... | 350 |
language modeling | Where can I find pre-trained language models in English and German? | https://ai.stackexchange.com/questions/7684/where-can-i-find-pre-trained-language-models-in-english-and-german | <p>Where can I find (more) pre-trained <a href="https://en.wikipedia.org/wiki/Language_model" rel="nofollow noreferrer">language models</a>? I am especially interested in <strong>neural network-based</strong> models for <strong>English and German</strong>.</p>
<p>I am aware only of <a href="https://github.com/tensorfl... | <p>Of course now there has been a huge development:
Huggingface published <a href="https://github.com/huggingface/pytorch-transformers" rel="nofollow noreferrer">pytorch-transformers</a>, a library for the so successful Transformer models (BERT and its variants, GPT-2, XLNet, etc.), including many pretrained (mostly En... | 351 |
language modeling | publically available language models that can be used to train arbitrary language data? | https://ai.stackexchange.com/questions/43408/publically-available-language-models-that-can-be-used-to-train-arbitrary-languag | <p>I have sentence data in a language that is not widely in use and as such popular LLMs do not support the language. I want to train some language model such that given some question, it is able to respond back in the same language, just as in ChatGPT just with a different language.</p>
<p>In such a case, what languag... | <p>One can use the <a href="https://huggingface.co/papers/2309.09400" rel="nofollow noreferrer">CulturaX</a> dataset (<a href="https://arxiv.org/pdf/2309.09400.pdf" rel="nofollow noreferrer">paper</a>) to train an LLM in another language. It contains 27 TB of texts divided into 167 languages.</p>
<p>Otherwise, one can ... | 352 |
language modeling | What does the outputlayer of BERT for masked language modelling look like? | https://ai.stackexchange.com/questions/26284/what-does-the-outputlayer-of-bert-for-masked-language-modelling-look-like | <p>In the tutorial <a href="https://www.lyrn.ai/2018/11/07/explained-bert-state-of-the-art-language-model-for-nlp/" rel="nofollow noreferrer">BERT – State of the Art Language Model for NLP</a> the masked language modeling pre-training steps are described as follows:</p>
<blockquote>
<p>In technical terms, the predictio... | 353 | |
language modeling | What is a neuron in large language models? | https://ai.stackexchange.com/questions/40385/what-is-a-neuron-in-large-language-models | <p>I'm reading OpenAI's new paper "<a href="https://openaipublic.blob.core.windows.net/neuron-explainer/paper/index.html" rel="nofollow noreferrer">Language models can explain neurons in language models</a>" And I can't fully understand the concept of neurons here.</p>
<p>Can you please explain it? Is it rela... | <p>It seems that in this paper neuron means the perceptrons in the MLP layers of the transformer.</p>
| 354 |
language modeling | Transformer Language Model generating meaningless text | https://ai.stackexchange.com/questions/23809/transformer-language-model-generating-meaningless-text | <p>I currently learning on Transformers, so check my understanding I tried implementing a small transformer-based language model and compare it to RNN based language model. Here's the code for transformer. I'm using PyTorch inbuilt layer for Transformer Encoder</p>
<pre><code>class TransformerLM_1(nn.Module):
def ... | <p>This is probably an issue of complete underfitting. How many training data do you use? What is your vocab size? What is your batch size and how many epochs did you train? Transformers always need more data than RNNs to reach good text quality.</p>
| 355 |
language modeling | Is large language model and foundation model the same thing? | https://ai.stackexchange.com/questions/36766/is-large-language-model-and-foundation-model-the-same-thing | <p>I read a lot about foundation model and large language model.</p>
<p>However, I dont find a clear definition what exactly is a foundation model. Is large language model and foundation model the same thing?</p>
| <p>At this point in time, there does not appear to be a really widely-agreed-upon definition of "Foundation models". If you want one, the best place to go would be <a href="https://arxiv.org/abs/2108.07258" rel="noreferrer">this paper from Stanford that coined the term</a>. Generally at least some of the foll... | 356 |
language modeling | Language models of virtual assistants before transformers | https://ai.stackexchange.com/questions/47883/language-models-of-virtual-assistants-before-transformers | <p>How were the language models of virtual assistants (Siri, Google Assistant, Alexa, etc.) designed and trained before transformers? What were their architectures?</p>
| <p>Before transformers for the <a href="https://en.wikipedia.org/wiki/Natural_language_understanding" rel="nofollow noreferrer">natural language understanding (NLU)</a> NLP task, there was already the encoder-decoder architecture where LSTMs and GRUs RNN models act as encoder to transform input sequence and <a href="ht... | 357 |
language modeling | Large Language Models vs Tabular Data | https://ai.stackexchange.com/questions/39652/large-language-models-vs-tabular-data | <p><strong>Problem:</strong><br />
Let's say we want to predict insurance frauds. Whenever we obtain an insurance claim, we are provided with a free-form description detailing the loss and a substantial amount of data on the claimant, presented in a tabular format.</p>
<p><strong>Questions:</strong><br />
How can we ut... | <p>In Pytorch you can build models which are in part consisting of e.g. a pretrained Bert model and then add some custom or additional layers.</p>
| 358 |
language modeling | Are embeddings in multi-lingual language models comparable across languages? | https://ai.stackexchange.com/questions/16353/are-embeddings-in-multi-lingual-language-models-comparable-across-languages | <p>Facebook has <a href="https://arxiv.org/pdf/1911.02116.pdf" rel="nofollow noreferrer">just pushed out</a> a bigger version of their multi-lingual language model XLM, called XLM-R. My question is: do these kind of multi-lingual models imply, or even ensure, that their embeddings are comparable between languages? That... | <p>Embeddings generated by transformers like Bert or XLM-R are fundamentally different from embeddings learned through language models like GloVe or Word2Vec.
The latter are static, i.e. they are just dictionaries containing a vocabulary with n-dimensional vectors associated to each word. Because of this they can be pl... | 359 |
language modeling | How can i create a new language model for language other than english? | https://ai.stackexchange.com/questions/38706/how-can-i-create-a-new-language-model-for-language-other-than-english | <p>I have large set of corpus for all literature in 'Tamil' language, i am trying to create a document retrieval engine through simple natural language.</p>
<p>Since the corpus is huge, its hard to do a supervised learning, i also checked ai4bharat.org 's initiatives to build the language models, but its still not work... | 360 | |
language modeling | LSTM language model not working | https://ai.stackexchange.com/questions/9756/lstm-language-model-not-working | <p>I am trying to use a Keras LSTM neural network for character level language modelling. As the input, I give it the last 50 characters and it has to output the next one. It has 3 layers of 400 neurons each. For the training data, I am using 'War of The Worlds' by H.G. Wells which adds up to 269639 training samples an... | <p>You can follow the below steps :</p>
<ol>
<li>LSTMs are slower in terms of convergence. They take much time to train amd thereby give better results. Try training the network for a more number of epochs like 50 or 65.</li>
<li>Use smaller batch size. Try using a RMSProp optimizer. It takes a long time to converge b... | 361 |
language modeling | How to combine language models and theorem provers? | https://ai.stackexchange.com/questions/46225/how-to-combine-language-models-and-theorem-provers | <p>Suppose that a mathematician wants to find a proof of a conjecture or understand details of some proof. Can one combine language models like ChatGpt or Copilot and theorem proving software like Coq to and iterate outputs until a proof is found?</p>
| 362 | |
language modeling | How to combine pretrained language models with additional feature set? | https://ai.stackexchange.com/questions/37026/how-to-combine-pretrained-language-models-with-additional-feature-set | <p>Are there any techniques to combine a feature set (other than the text itself) with pretrained language models.</p>
<p>Let's say I have a random NLP task that tries to predict a binary class label based on e.g. Twitter data. One could easily utilize a pretrained language model such as BERT/GPT-3 etc. to fine-tune it... | <p>Although barely related, this brings to my mind a concept I first learned in <em>conditional GANs</em> - there, if you wanted an output of some specific class, you would take your random noise input <span class="math-container">$z$</span> (that is given to your generative model <span class="math-container">$G$</span... | 363 |
language modeling | Fundamentally, what is a perfect language model? | https://ai.stackexchange.com/questions/23557/fundamentally-what-is-a-perfect-language-model | <p>Suppose that we want to generate a sentence made of words according to language <span class="math-container">$L$</span>:
<span class="math-container">$$
W_1 W_2 \ldots W_n
$$</span></p>
<p><strong>Question:</strong> What is the perfect language model?</p>
<p>I ask about <em>perfect</em> because I want to know the co... | <p>One of your hypothesis is very close to the truth, it's 1.2</p>
<p>So, a language model measures the probability of a given sentence in a language <span class="math-container">$L$</span>. The sentences can have any length and the sum of probabilities of all the sentences in the language <span class="math-container">... | 364 |
language modeling | Tips and tricks when training a very large language model? | https://ai.stackexchange.com/questions/42131/tips-and-tricks-when-training-a-very-large-language-model | <p>Have never trained a (very) large language model, so I am wondering if the process is the same as training a (regular) language model, i.e. you prepare the data, set up the architecture, hyperparameters, loss function to minimize perplexity and predicting the next word, and then do gradient descent over the giant da... | <p>So one thing that might occur:</p>
<blockquote>
<p>Note that we typically only train PMs for a single epoch, so the learning curves
themselves (Figure 7 left) indicate how performance scales with dataset size (we used a fixed learning rate).</p>
</blockquote>
<p>From:
<a href="https://arxiv.org/pdf/2204.05862.pdf" r... | 365 |
language modeling | What is the difference between a language model and a word embedding? | https://ai.stackexchange.com/questions/26739/what-is-the-difference-between-a-language-model-and-a-word-embedding | <p>I am self-studying applications of deep learning on the NLP and machine translation.</p>
<p>I am confused about the concepts of "Language Model", "Word Embedding", "BLEU Score".</p>
<p>It appears to me that a language model is a way to predict the next word given its previous word. Word... | <p><strong>Simplified:</strong> Word Embeddings does not consider context, Language Models does.</p>
<p>For e.g Word2Vec, GloVe, or fastText, there exists one fixed vector per word.</p>
<p>Think of the following two sentences:</p>
<blockquote>
<p>The fish ate the cat.</p>
</blockquote>
<p>and</p>
<blockquote>
<p>The ca... | 366 |
language modeling | What are the main differences between a language model and a machine translation model? | https://ai.stackexchange.com/questions/22086/what-are-the-main-differences-between-a-language-model-and-a-machine-translation | <p>What are the main differences between a language model and a machine translation model?</p>
| <p>The simple language model will give you the probability of a sequence of tokens(sentence) for that language. So lets say if you have trained a model for English language your model can give you the probability for any random english sentence.</p>
<p>Consider some sentence</p>
<p><span class="math-container">$X$</spa... | 367 |
language modeling | Is the problem of Language Modelling a Well-Posed Learning Problem? | https://ai.stackexchange.com/questions/40379/is-the-problem-of-language-modelling-a-well-posed-learning-problem | <p>Hadamard defines (<a href="https://en.wikipedia.org/wiki/Well-posed_problem" rel="nofollow noreferrer">Well-posed problem (Wikipedia)</a>) a well-posed problem as one for which:</p>
<ol>
<li>a solution exists,</li>
<li>the solution is unique,</li>
<li>the solution depends continuously on the data (e.g. it is stable)... | <p>Philosophically speaking,</p>
<p>I believe a perspective shift is necessary. When you say, 'A solution exists', the next statement should be, 'Well, what is the problem?'. While you are correct in pointing out instances where the model is unique and not so much so, their correct problem statement is not being talked... | 368 |
language modeling | can we apply soft actor critic to language model preference optimization? | https://ai.stackexchange.com/questions/46477/can-we-apply-soft-actor-critic-to-language-model-preference-optimization | <p>Most language model is using online PPO or offline DPO type algorithm. Can we use soft actor critic RL to do alignment work? Any publication related can be recommended?</p>
| <p>Sample efficient off-policy <a href="https://spinningup.openai.com/en/latest/algorithms/sac.html" rel="nofollow noreferrer">SAC</a> learning is originally proposed for robotics continuous action space RL use cases while its alternative version could handle discrete action spaces.</p>
<blockquote>
<p>A central featur... | 369 |
language modeling | What are the most successful applications of large language models? | https://ai.stackexchange.com/questions/47709/what-are-the-most-successful-applications-of-large-language-models | <p>Large Language Models (LLMs) are currently among the most prominent AI technologies, with some considering them as a step toward Artificial General Intelligence (AGI). My question is: Are there already successful commercial applications of LLMs, and if so, are these models particularly indispensable in the short ter... | 370 | |
language modeling | What language model can convert normal text to JSON data | https://ai.stackexchange.com/questions/43843/what-language-model-can-convert-normal-text-to-json-data | <p>I have tried training T5-small, T5-base and T5-Large on around 15K rows of data where input data was something like but I did not get desired results</p>
<pre><code>Nutrition Facts,
100g per,
Energy 646.95Kcal Carbohydrates 19.31g,
Protein 21.94g 53.55g Total Fat 6.64g Saturated Fat 14.97g Dietary Fiber,
<1.Omg ... | <p>I've tried Mistral-7B-Instruct-v0.2, and it worked out of the box for your example, as did Qwen1.5-1.5b. However, Qwen1.5-0.5b had issues, but I think with enough training, you can achieve decent results.</p>
<p>I believe the size/quality trade-off of starting from 1.5b and lowering it could deteriorate in corner ca... | 371 |
language modeling | Do all Android devices use the same foundation language model and LORA adapters? | https://ai.stackexchange.com/questions/47748/do-all-android-devices-use-the-same-foundation-language-model-and-lora-adapters | <p>I read on <a href="https://developer.android.com/ai/gemini-nano" rel="nofollow noreferrer">https://developer.android.com/ai/gemini-nano</a> about the use of local language models on Android:</p>
<blockquote>
<ul>
<li><strong>Supported Devices</strong>: AICore is currently available on Pixel 9 series devices, Google ... | <p>Frmo Google's paper <a href="https://arxiv.org/pdf/2312.11805" rel="nofollow noreferrer">Gemini: A Family of Highly Capable
Multimodal Models</a>:</p>
<blockquote>
<p>Our most efficient model, designed to run on-device. <strong>We trained two versions of Nano, with 1.8B (Nano-1) and 3.25B (Nano-2) parameters, target... | 372 |
language modeling | How word2vec de-embeds the special names in language models which output text | https://ai.stackexchange.com/questions/41823/how-word2vec-de-embeds-the-special-names-in-language-models-which-output-text | <p>I am new to nlp field. I have some questions about word2vec embeddings. as I know they have a fixed size dictionary of vocabs. so definitely there some words which is not in that predefined dictionary of vocab, for i.e. we may get an special name (like people's name) which doesn't exist in the vocab and they are cal... | <p>I'm not sure I got 100% of the question, but word2vec is rather simple to understand so I'll give my two cents and if something is missing or not clear I'll edit the answer to improve it.</p>
<p>1 For OOV vectors, as you pointed out, one option is indeed to initialise some random embeddings. The nice aspect of this ... | 373 |
language modeling | Can you make Q&A language model stay on topic? | https://ai.stackexchange.com/questions/36812/can-you-make-qa-language-model-stay-on-topic | <p>I’m thinking of fine-tuning a pre-trained language model for a Q&A task. More specifically, I’d like to fine-tune the model on a single chapter in a classic college textbook. Afterward, the reader of the chapter should be able to engage in a Q&A session with the model about the content of the chapter.</p>
<p... | <p>Perhaps you could train an auxiliary binary classifier to predict whether or not a response from the chatbot was on or off topic. You could use text from the chapters that you fine tune the Q.A. model with to generate examples of "on topic" text and then use text from other sources as "off topic"... | 374 |
language modeling | How do we know if GPT-2 is a better language model? | https://ai.stackexchange.com/questions/10869/how-do-we-know-if-gpt-2-is-a-better-language-model | <p>You may have heard of GPT2, a new language model. It has recently attracted attention from the general public as the foundation that published the paper, <a href="https://blog.openai.com/better-language-models/" rel="nofollow noreferrer">OpenAI</a>, ironically refused to share the whole model fearing dangerous impli... | <p>You have experimented with a small model (117M parameters). OpenAI has now released the medium sized model (345M parameters). Note that the full model has 1.5B parameters. Also note that GPT-2 has been trained on a tiny fraction of all available text. It's almost guaranteed that a larger model trained on more text w... | 375 |
language modeling | Why do language models place less importance on punctuation? | https://ai.stackexchange.com/questions/13600/why-do-language-models-place-less-importance-on-punctuation | <p>I have a very outdated idea about how NLP tasks are carried out by normal RNN's, LSTM's/GRU's, word2vec, etc to basically generate some hidden form of the sentence understood by the machine.</p>
<p>One of the things I have noticed is that, in general, researchers are interested in generating the context of the sente... | <p>You are right. Approaches that map words to meaning solely do fail in this regard. None the less Word2Vec and Glove have shown wonderful downstream results. This in itself may indicate that most of the time, punctuation's addition can be interpolated. But as you provided, there are cases where this just is not true!... | 376 |
language modeling | How do you build a language model to predict the contextual similarity between two documents? | https://ai.stackexchange.com/questions/16328/how-do-you-build-a-language-model-to-predict-the-contextual-similarity-between-t | <p>How do you build a language model to predict the contextual similarity between two documents?</p>
| <p>You can use an autoencoder for text. For example, you can refer to this example here: <a href="https://machinelearningmastery.com/lstm-autoencoders/" rel="nofollow noreferrer">https://machinelearningmastery.com/lstm-autoencoders/</a></p>
<p>For comparing the contextual similarity, you can compare the encoded vector... | 377 |
language modeling | Are there any good alternatives to an LSTM language model for text generation? | https://ai.stackexchange.com/questions/25270/are-there-any-good-alternatives-to-an-lstm-language-model-for-text-generation | <p>I have a trained LSTM language model and want to use it to generate text. The standard approach for this seems to be:</p>
<ol>
<li>Apply softmax function</li>
<li>Take a weighted random choice to determine the next word</li>
</ol>
<p>This is working reasonably well for me, but it would be nice to play around with ot... | <p>The current state of the art in natural language generation are all auto-regressive transformer models. Transformers no longer use recurrent neural networks such as LSTM, because the recurrences makes long dependencies messy to calculate. Instead, Transformers only keep the attention layers, and apply attention on a... | 378 |
language modeling | What is the lowest possible loss for a language model? | https://ai.stackexchange.com/questions/42495/what-is-the-lowest-possible-loss-for-a-language-model | <p>Example: Suppose a character-level language model (three input letters to predict the next one), trained on a dataset which contains three instances of the sequence <code>aei</code>, with two occurrences preceding <code>o</code> and one preceding <code>u</code>, i.e., the dataset is:</p>
<div class="s-table-containe... | <p>Yes.. consider that neural networks are <em>function</em> approximators, and:</p>
<blockquote>
<p>In mathematics, a function from a set X to a set Y assigns to each element of X exactly one element of Y</p>
</blockquote>
<p>So, given the same X, you can only hope to have a specific Y, and if your dataset is ambiguou... | 379 |
language modeling | How is the word embedding represented in the paper "Recurrent neural network based language model"? | https://ai.stackexchange.com/questions/5285/how-is-the-word-embedding-represented-in-the-paper-recurrent-neural-network-bas | <p>I'm reading <em>"<a href="http://www.fit.vutbr.cz/research/groups/speech/publi/2010/mikolov_interspeech2010_IS100722.pdf" rel="nofollow noreferrer">Recurrent neural network based language model</a>"</em> of Mikolov et al. (2010). Although the article is straight forward, I'm not sure how word embedding <span class="... | <p>Input vector contains two concatenated parts. The low part represents the current word:</p>
<blockquote>
<p>word in time t encoded using 1-of-N coding [...] - size of vector x is
equal to size of vocabulary V (this can be in practice 30 000-200 000) plus [...]</p>
</blockquote>
<p>where, as you said, 1-of-N me... | 380 |
language modeling | What background should I have before starting to fine tune a Large Language Model? | https://ai.stackexchange.com/questions/39078/what-background-should-i-have-before-starting-to-fine-tune-a-large-language-mode | <p>I want to know what things I should be learning before trying to fine-tune or for that matter working with a large language model.</p>
<p>In my case, I am trying to fine-tune bloom (<a href="https://huggingface.co/blog/bloom" rel="nofollow noreferrer">https://huggingface.co/blog/bloom</a>).</p>
<p>But considering my... | <p>There are considerable free and excellent resources out there (in the wild).</p>
<p>You can check The Stanford Natural Language Processing Group teaching <a href="https://nlp.stanford.edu/teaching/" rel="nofollow noreferrer">page</a>; you can easily follow their YouTube courses on NLP (natural language processing) a... | 381 |
language modeling | What are the leading methods to estimate Epistemic Uncertainty in Large Language Models? | https://ai.stackexchange.com/questions/48038/what-are-the-leading-methods-to-estimate-epistemic-uncertainty-in-large-language | <p>Epistemic uncertainty is uncertainty that arises from a lack of knowledge, for instance in machine learning epistemic uncertainty can be caused by a lack of training data. Estimating epistemic uncertainty is important for useful AI systems, since it allows the AI to "know that it doesn't know", therefore a... | <p>In traditional Monte Carlo dropout approach, by enabling dropout at <em>inference</em> time and performing multiple stochastic forward passes, you can sample different outputs from the same input. The variability across these samples can serve as a proxy for epistemic uncertainty.</p>
<p>In LLMs recent work on chain... | 382 |
language modeling | Why do current language models no longer generate to long or short texts? | https://ai.stackexchange.com/questions/42140/why-do-current-language-models-no-longer-generate-to-long-or-short-texts | <p>One of the biggest strengths of ChatGPT is that it generates fitting text with respect to the input query. It usually stays on topic, anwers the question completely and especially does not start talking gibberish or repeating itself.</p>
<p>This behaviour is different when comparing this to older LLMs. For example: ... | <p><strong>TLDR: if you're using a model without instruction-tuning, you'll likely need to do some additional work during inference to make sure that your outputs are coherent <em>regardless of how old your model is</em>. But even on GPT-2 you can get decent generations with the right technique.</strong></p>
<p>You're ... | 383 |
language modeling | Are there any other language models besides GPT-3 that can be used to create chatbots with a specific identity and environment? | https://ai.stackexchange.com/questions/34040/are-there-any-other-language-models-besides-gpt-3-that-can-be-used-to-create-cha | <p>I've recently been looking into language models but ran into a small question out of curiosity. For some language models like GPT-3, it is possible to generate dialogue, with the model basing its answers on the initial input (which can be anything). This makes it possible to make a "bot" which a user can c... | <p>You may want to look at Chirpy Cardinal from Stanford. It doesn't provide mannerisms out of the box but the response generators can be configured to give each instance its own character.</p>
<p><a href="https://stanfordnlp.github.io/chirpycardinal/" rel="nofollow noreferrer">https://stanfordnlp.github.io/chirpycardi... | 384 |
language modeling | Can a prompt injection attack exist without predefined system instructions in a language model? | https://ai.stackexchange.com/questions/48597/can-a-prompt-injection-attack-exist-without-predefined-system-instructions-in-a | <p>Prompt injection attacks are typically described as adversarial inputs crafted to override or manipulate a language model’s behavior by exploiting its prompt - following nature. In many examples, these attacks rely on the presence of predefined system instructions (e.g., "You are a helpful assistant. Do not ans... | 385 | |
language modeling | Which framework should I use for training transformer language models with reinforcement learning? | https://ai.stackexchange.com/questions/48596/which-framework-should-i-use-for-training-transformer-language-models-with-reinf | <p>Which framework should I use for training transformer language models with reinforcement learning (e.g., GRPO)? Any recommendation?</p>
<div class="s-table-container"><table class="s-table">
<thead>
<tr>
<th style="text-align: left;">Feature</th>
<th style="text-align: left;"><a href="https://github.com/huggingface/... | 386 | |
language modeling | Should I use the same learning rate when I compare the performance for different language models? | https://ai.stackexchange.com/questions/47254/should-i-use-the-same-learning-rate-when-i-compare-the-performance-for-different | <p>If I'm using the same datasets and using different language models, such as BERT, DistilBERT, Electra, etc., and my goal to compare the performance, such as the accuracy, macro f score, etc. should I used the same learning rate and number of epochs to make comparison fair, or is it allowed to have different learnin... | <p>Since learning rate is a hyperparameter, using different learning rates or epochs for each model is not only allowed but generally encouraged as long as the hyperparameter tuning process such as grid search is consistent across all models. Different models have unique architectures, parameter counts, and training dy... | 387 |
language modeling | Can the output of a language model be identical to it's training data if finetuned with reference documents also present on the training data? | https://ai.stackexchange.com/questions/48410/can-the-output-of-a-language-model-be-identical-to-its-training-data-if-finetun | <p>E.g. Finetuning a language model using text from Wikipedia articles (without modifications) when the language model has Wikipedia data in its training dataset will cause the model to reproduce the articles' texts verbatim in its output? Assuming the model is small (less than 3 billion parameters) and has very few tr... | <p>LLMs are more likely to memorize frequently seen sequences if the same sequence appears multiple times during pre-training and fine-tuning in repeated epochs. If the fine-tuning dataset is very small, the model might memorize specific phrases, but full articles are unlikely, since in practice a whole article is usua... | 388 |
language modeling | Language Model from missing data | https://ai.stackexchange.com/questions/13518/language-model-from-missing-data | <p>I want to learn how a set of operations (my vocabulary) are composed in a dataset of algorithms (corpus). </p>
<p>The algorithms are a sequence of higher level operations which have varying low-level implementations. I am able to map raw code to my vocabulary, but not all of it.</p>
<p>e.g. I observe a lossy descr... | 389 | |
language modeling | Normalizing the embedding space of an encoder language model with respect to categorical data | https://ai.stackexchange.com/questions/46252/normalizing-the-embedding-space-of-an-encoder-language-model-with-respect-to-cat | <p>Suppose we have a tree/hierarchy of categories (e.g. categories of products in an e-commerce website), each node being assigned a title. Assume that the title of each node is semantically accurate, meaning it's consistent with the category (the titles of the children nodes) it represents. Now, take an encoder langua... | 390 | |
language modeling | What's the most efficient way of performing batched training of Causal Language Models? | https://ai.stackexchange.com/questions/39817/whats-the-most-efficient-way-of-performing-batched-training-of-causal-language | <p>I have seen a number of ways to train (yes, train, not fine-tune) these models efficiently with batches. I will illustrate these techniques with the following example dataset and context window:</p>
<pre><code>Context window:
-----------------
Data samples:
1. ###
2. ################
3. ####
4. ##############
5. ... | 391 | |
language modeling | How do language models know what they don't know - and report it? | https://ai.stackexchange.com/questions/40874/how-do-language-models-know-what-they-dont-know-and-report-it | <p>Again and again I ask myself what goes on in a pre-trained transformer-based language model (like ChatGPT9) when it comes to "know" that it cannot give an appropriate answer and either</p>
<ul>
<li><p>states it ("I have not enough information to answer this question.")</p>
</li>
<li><p>asks for m... | <p>The data it is trained on includes variants of "I don't know". For instance, if you ask me what is the meaning of life and I reply I don't know, then that is the information schema the AI absorbs. It knows what it does not know, in the same way that it knows what it knows.</p>
<p>Here is another way to loo... | 392 |
language modeling | Efficient Matching of Sample Requests to Sample Offers Using Large Language Models | https://ai.stackexchange.com/questions/46052/efficient-matching-of-sample-requests-to-sample-offers-using-large-language-mode | <p>I want to discuss an interesting matching problem. We aim to match sample requests with corresponding sample offers. Here are some examples:</p>
<p>Sample Requests:</p>
<p>Need help installing Linux on my old laptop.
Looking for a tutor in specialist mathematics.
Need a second person to help assemble an Ikea bed.
Sa... | 393 | |
language modeling | How can I improve this toy Graph Neural Network Generative Language model | https://ai.stackexchange.com/questions/41921/how-can-i-improve-this-toy-graph-neural-network-generative-language-model | <h3>Background</h3>
<p>I'm an undergraduate student with research interests in a field of physics that has significant overlap with graph theory, and a functioning knowledge of how simple neural nets work and how to build them with TensorFlow and Keras. As many people are, I'm fascinated by the recent advancements in t... | <p>First of all, I would like to encourage you to keep trying new things, it sounds super fun! There are a few things I would like you to clarify about Graph Neural Networks (GNNs) and Graph Convolutional Neural Networks (GCNs), and then I will answer your questions as best I can. Also, as a sidenote, there are too man... | 394 |
language modeling | How can (pretrained) language models actively seek additional training data - possibly reference request? | https://ai.stackexchange.com/questions/37827/how-can-pretrained-language-models-actively-seek-additional-training-data-po | <p>I am reading the paper "Large Language Models Can Self-Improve" <a href="https://arxiv.org/abs/2210.11610" rel="nofollow noreferrer">https://arxiv.org/abs/2210.11610</a> in which the authors consider that LLM can generate Chain-of-Thoughts sequences and even novel questions and their respective CoT respons... | 395 | |
language modeling | How can a language model keep track of the provenance of the main knowledge/sources used to generate a given output? | https://ai.stackexchange.com/questions/38372/how-can-a-language-model-keep-track-of-the-provenance-of-the-main-knowledge-sour | <p>One of the main criticisms against the use of ChatGPT on Stack Exchange is that it doesn't attribute the main knowledge/sources used to generate a given output. How can a language model keep track of the provenance of the main knowledge/sources used to generate a given output?</p>
| <p>Reddit user <a href="https://www.reddit.com/user/skyebreak" rel="noreferrer">skyebreak</a> <a href="https://redd.it/znl8f8" rel="noreferrer">pointed</a> me to a relevant paper on that topic:</p>
<p>Gao, Luyu, Zhuyun Dai, Panupong Pasupat, Anthony Chen, Arun Tejasvi Chaganty, Yicheng Fan, Vincent Y. Zhao et al. "... | 396 |
language modeling | Can in principle GPT language models learn physics? | https://ai.stackexchange.com/questions/23418/can-in-principle-gpt-language-models-learn-physics | <p>Does anyone know of research involving the GPT models to learn not only regular texts, but also learn from physics books with the equations written in latex format?</p>
<p>My intuition is that the model might learn the rules relating equations and deductions, as they can learn statistically what correlates with what... | 397 | |
language modeling | Data extraction from diagrams using Vision Language Model | https://ai.stackexchange.com/questions/47707/data-extraction-from-diagrams-using-vision-language-model | <p>looking for some ideas to accurately extract data flows from system context diagram. I've tried a number of models and prompt engineering techniques, but i'm still getting missing flows, and hallucination from the model on non-existing flows, incorrect data flow.</p>
<p><strong>what i've tried:</strong></p>
<ol>
<li... | 398 | |
language modeling | How to train a language model to write poem? | https://ai.stackexchange.com/questions/41936/how-to-train-a-language-model-to-write-poem | <p>I am using some of the LLM applications, and all of them are better at provide formal, steady conversations, rather than writing texts with styles. So I wonder whether it is possible to train a LLM better at writing poem, or other stylish texts in general.</p>
<p>Is this resulted from the dataset or the model struct... | <h3>General advice</h3>
<p>LLMs are usually trained with big datasets, which probably include poems, so I wouldn't be surprised if they can come up with poem-like texts. Now, if you want to fine-tune some LLM to specialise in poem writing, then yes you could start by training it with a dataset with only poems. ML is (s... | 399 |
transfer learning | Transfer Learning of Numerical Data | https://ai.stackexchange.com/questions/24136/transfer-learning-of-numerical-data | <p>It seems like transfer learning is only applicable to neural networks. Is this a correct assumption?</p>
<p>While I was looking for examples of Transfer Learning, most seemed to be based on image data, audio data, or text data. I was not able to find an example of training a neural network on numerical data.</p>
<p>... | <blockquote>
<p>It seems like transfer learning is only applicable to neural networks. Is this a correct assumption?</p>
</blockquote>
<p>No. <a href="https://en.wikipedia.org/wiki/Transfer_learning" rel="nofollow noreferrer">Wiki</a> page give you pointers of several examples in other methodologies.</p>
<blockquote>
<... | 400 |
transfer learning | What is layer freezing in transfer learning? | https://ai.stackexchange.com/questions/22963/what-is-layer-freezing-in-transfer-learning | <p>Transfer learning consists of taking features learned on one problem and leveraging them on a new, similar problem.</p>
<p>In the Transfer Learning, we take layers from a previously trained model and freeze them.</p>
<p><strong>Why is this layer freezing required and what are the effects of layer freezing?</strong><... | <p><strong>Why is this layer freezing required?</strong></p>
<p>It's not.</p>
<p><strong>What are the effects of layer freezing?</strong>
The consequences are:</p>
<p>(1) Should be <em>faster</em> to train (the gradient will have far less components)</p>
<p>(2) Should require <em>less</em> data to train on</p>
<p>If yo... | 401 |
transfer learning | What is the relation between self-taught learning and transfer learning? | https://ai.stackexchange.com/questions/27136/what-is-the-relation-between-self-taught-learning-and-transfer-learning | <p>I am new to transfer learning and I start by reading <a href="https://ieeexplore.ieee.org/document/5288526" rel="nofollow noreferrer">A Survey on Transfer Learning</a>, and it stated the following:</p>
<blockquote>
<p>according to different situations of labeled and unlabeled data in the source domain, we can
furthe... | <p>After a lot of searches, I think self-taught learning is a Transfer learning category, I think when Self-taught learning paper published (2007), there isn't any good survey on transfer learning, and as seen by high citation of the paper of Pan, his paper (which published in 2009) describes transfer learning in a cle... | 402 |
transfer learning | How is few-shot learning different from transfer learning? | https://ai.stackexchange.com/questions/25615/how-is-few-shot-learning-different-from-transfer-learning | <p>To my understanding, transfer learning helps to incorporate data from other related datasets and achieve the task with less labelled data (maybe in 100s of images per category).</p>
<p>Few-shot learning seems to do the same, with maybe 5-20 images per category. Is that the only difference?</p>
<p>In both cases, we i... | <p>They use the same techniques, but study different problems.</p>
<p>Transfer learning always does not imply that the novel classes have very-few samples (as few as 1 per class). Few-shot learning does.</p>
<p>The goal of transfer learning is to obtain <strong>transferrable features</strong> that can be used for a wid... | 403 |
transfer learning | What are the differences between transfer learning and meta learning? | https://ai.stackexchange.com/questions/18232/what-are-the-differences-between-transfer-learning-and-meta-learning | <p>What are the differences between meta-learning and transfer learning?</p>
<p>I have read 2 articles on <a href="https://qr.ae/Tdowsi" rel="noreferrer">Quora</a> and <a href="https://towardsdatascience.com/icml-2018-advances-in-transfer-multitask-and-semi-supervised-learning-2a15ef7208ec" rel="noreferrer">TowardData... | <p>First of all, I would like to say that it is possible that these terms are used inconsistently, given that at least transfer learning, AFAIK, is a relatively new expression, so, the general trick is to take terminology, notation and definitions with a grain of salt. However, in this case, although it may sound confu... | 404 |
transfer learning | Embedding Quality of Transfer Learning model vs Contrastive learning model | https://ai.stackexchange.com/questions/35738/embedding-quality-of-transfer-learning-model-vs-contrastive-learning-model | <p>I am working on Contrastive learning which is a technique to learn features based on the concept of learning from comparing two or more instances.</p>
<p>The downstream task is a classification problem.</p>
<p><strong>Transfer Learning</strong>
Due to limited data, I tried to use Transfer learning model trained on &... | <p>what are the dimensions of the embeddings? The first thing that comes to mind is that you probably should be wary of using euclidean distance in high dimensions (Distribution of Distances between Elements in a Compact Set), as done when computing the Silhouette Coefficient.</p>
<p>However, that's probably not an iss... | 405 |
transfer learning | Can we apply transfer learning between any two different CNN architectures? | https://ai.stackexchange.com/questions/23672/can-we-apply-transfer-learning-between-any-two-different-cnn-architectures | <p>There are many types of CNN architectures: LeNet, AlexNet, VGG, GoogLeNet, ResNet, etc. Can we apply transfer learning between any two different CNN architectures? For instance, can we apply transfer learning from AlexNet to GoogLeNet, etc.? Or even just from a "conventional" CNN to one of these other arch... | <p>No, transfer learning cannot be applied "between" different architectures, as transfer learning is the practice of taking a neural network that has already been trained on one task and retraining it on another task with the same input modality, which means that only the weights (and other trainable paramet... | 406 |
transfer learning | What are the real-life applications of transfer learning? | https://ai.stackexchange.com/questions/15731/what-are-the-real-life-applications-of-transfer-learning | <p>What are the real-life applications of transfer learning in machine learning? I am particularly interested in industrial applications of the concept.</p>
| <p>One application I know of being used in industry is of image classification, by only training the last layer of one of the inception models released by Google, with the desired number of classes. I can't provide specific details. </p>
<p>Transfer learning is useful when:</p>
<ol>
<li><p>You do not have the resour... | 407 |
transfer learning | Validation accuracy very low with transfer learning | https://ai.stackexchange.com/questions/28156/validation-accuracy-very-low-with-transfer-learning | <p>I am using MobileNetV3 from TF keras for doing transfer learning; I removed the last layer, added two dense layers, and trained for 20 epochs.</p>
<ol>
<li><p>How many dense layers should I add after the MobileNet and How dense should they be?</p>
</li>
<li><p>How many epochs should I train for?</p>
</li>
<li><p>Val... | <p>these two steps solved my problem</p>
<ol>
<li>I found that I forget to freeze the per-trained model by setting trainable = False</li>
<li>It seams that I failed to load the weights when I get the model from keras.application even that the <a href="https://keras.io/api/applications/" rel="nofollow noreferrer">docume... | 408 |
transfer learning | How could Bayesian neural networks be used for transfer learning? | https://ai.stackexchange.com/questions/28549/how-could-bayesian-neural-networks-be-used-for-transfer-learning | <p>In transfer learning, we use big data from similar tasks to learn the parameters of a neural network, and then fine-tune the neural network on our own task that has little data available for it. Here, we can think of the transfer learning step as learning a (proper) prior, and then fine-tuning as learning the poster... | <p>Well, I would say, that purpose of Bayesian inference is not transfer learning, but uncertainty estimation.</p>
<p>In case you have good feature extractor in the beginning, you can adjust small number of parameters, like few last layers to achieve good quality in few epochs.</p>
<p>However, this is about adjusting t... | 409 |
transfer learning | Would this count as a Transfer Learning approach? | https://ai.stackexchange.com/questions/28247/would-this-count-as-a-transfer-learning-approach | <p>I have two datasets, Dataset 1(D1) and Dataset 2(D2). D1 has around 22000 samples, and D2 has around 8000 samples. What I am doing is that I train a Deep Neural Network model with around three layers on the dataset D1, which has an accuracy of around 84% (test accuracy = 82%).</p>
<p>Now, when I use that model to ma... | <blockquote>
<p>This tells me that because the initial model was performing so poorly without any fine-tuning, most of the learning that led to the 90% accuracy was only because of the additional layers, not the layers that were transferred from the model trained on the D1 dataset. Is this a correct inference?</p>
</bl... | 410 |
transfer learning | What is the difference between learning without forgetting and transfer learning? | https://ai.stackexchange.com/questions/13644/what-is-the-difference-between-learning-without-forgetting-and-transfer-learning | <p>I would like to incrementally train my model with my current dataset and <a href="https://github.com/tensorflow/models/issues/7200#issuecomment-510850230" rel="nofollow noreferrer">I asked this question on Github</a>, which is what I'm using SSD MobileNet v1.</p>
<p>Someone there told me about <a href="https://arxiv... | <p>Learning without Forgetting (LwF) is an incremental learning (sometimes also called continual or lifelong learning) technique for neural networks, which is a machine learning technique that attempts to avoid <a href="https://ai.stackexchange.com/a/13293/2444">catastrophic forgetting</a>. There are several incrementa... | 411 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.