text
stringlengths
81
47k
source
stringlengths
59
147
Question: <p>I started modeling a linear regression problem using dense layers (layers.dense), which works fine. I am really excited, and now I am trying to model a time series linear regression problem using CNN, but from my research in this link <a href="https://machinelearningmastery.com/keras-functional-api-deep-le...
https://ai.stackexchange.com/questions/13651/what-are-the-possible-neural-network-architecture-for-linear-regression-or-time
Question: <p><strong>How do you decide that you have tested enough hyper-parameter combinations for a specific neural network architecture to discard it and move on to a new model?</strong></p> <p>Do you have a structured (generic) approach? In practice, what gives you the necessary performance (e.g. &gt;= 80% accuracy...
https://ai.stackexchange.com/questions/31954/how-do-you-decide-that-you-have-tested-enough-hyper-parameter-combinations-for-a
Question: <p>I ended up working with a neural network <span class="math-container">$N(\cdot)$</span> characterized by the following structure:<span class="math-container">$$N(x)=V[\text{ReLU}(Ax+b)+Cx+d],$$</span> with input <span class="math-container">$x \in \mathbb{R}^n$</span> and parameters <span class="math-conta...
https://ai.stackexchange.com/questions/41340/a-neural-network-with-peculiar-architecture
Question: <p>Traditionally, when working with tabular data, one can be sure(or at least know) that a model works because the included features could explain a target variable, say &quot;<em>Price of a ticket</em>&quot; good. More features can be then be engineered to explain the target variable even better.</p> <p>I ha...
https://ai.stackexchange.com/questions/22590/how-can-one-be-sure-that-a-particular-neural-network-architecture-would-work
Question: <p>As a follow-up on <a href="https://ai.stackexchange.com/questions/39386/open-source-vocal-cloning-speech-to-speech-neural-style-transfer">Open-source vocal cloning (speech-to-speech neural style transfer)</a>, I want to create a voice clone. Unfortunately, the answers in the thread above do not apply to my...
https://ai.stackexchange.com/questions/42989/neural-network-architecture-or-code-for-style-transfer-with-aligned-data
Question: <p>I would like to generate sequences of tuples using a neural network algorithm such that the model trains on a dataset of sequences of tuples and generates synthetic sequences of tuples. Each tuple <code>t_i</code> in a sequence is made of two words and has the following format <code>t_i=(a_i,d_i)</code> wh...
https://ai.stackexchange.com/questions/48485/best-neural-network-algorithms-architectures-for-generating-synthetic-sequences
Question: <p>I have a dataset consisting of a set of samples. Each sample consists of two distinct desctized signals S1(t), S2(t). Both signals are synchronous; however, they show different aspects of a phenomena.</p> <p>I want to train a Convolutional Neural Network, but I don't know which architecture is appropriate ...
https://ai.stackexchange.com/questions/25349/appropriate-convolutional-neural-network-architecture-when-the-input-consists-of
Question: <p>Assume that I want to solve an issue with a neural network that either I can't fit to existing architectures (perceptron, Konohen, etc) or I'm simply not aware of the existence of those or I'm unable to understand their mechanics and I rely on my own instead.</p> <p>How can I automate the choice of the arc...
https://ai.stackexchange.com/questions/1391/how-can-i-automate-the-choice-of-the-architecture-of-a-neural-network-for-an-arb
Question: <p>I want to teach a neural network to distinguish between different types of defects. For that, I generated images of fake-defects. The images of the fake-defect types are attached.</p> <p><a href="https://i.sstatic.net/I0GO0.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/I0GO0.jpg" alt="bord...
https://ai.stackexchange.com/questions/22649/which-neural-network-should-i-use-to-distinguish-between-different-types-of-defe
Question: <p>Why do we use Convolutional Neural Network (CNN) for image data and not the Feedforward Neural Network (FNN)? Draw and explain the architecture of Convolutional Network</p> Answer: <p>I highly recommend you read the seminal work on convolutional neural networks (CNNs):</p> <p>Lecun, Y., &amp; Bengio, Y. (...
https://ai.stackexchange.com/questions/43145/why-we-use-convolutional-neural-network-for-image-data-and-not-the-feedforward-n
Question: <p>I've been doing some class assignments recently on building various neural networks. For convolutional networks, there are several well-known architectures such as LeNet, VGG etc. Such "classic" models are frequently referenced as starting points when building new CNNs. </p> <p>Are there similar examples ...
https://ai.stackexchange.com/questions/14280/what-are-some-examples-of-lstm-architectures
Question: <p>I have a CNN architecture for CIFAR-10 dataset which is as follows:</p> <blockquote> <p>Convolutions: 64, 64, pool</p> <p>Fully Connected Layers: 256, 256, 10</p> <p>Batch size: 60</p> <p>Optimizer: Adam(2e-4)</p> <p>Loss: Categori...
https://ai.stackexchange.com/questions/18073/is-this-neural-network-architecture-appropriate-for-cifar-10
Question: <p>Consider a feedforward neural network. Suppose you have a layer of inputs, which is feedforward to a hidden layer, and feedforward both the input and hidden layers to an output layer. Is there a name for this architecture? A layer feeds forward around the layer after it?</p> Answer: <p>This could be call...
https://ai.stackexchange.com/questions/17822/what-is-the-name-of-this-neural-network-architecture-with-layers-that-are-also-c
Question: <p>I am training a transformer based neural network and the validation loss is not decreasing, but the training loss does decrease. I am wondering if it's possible to debug or change the architecture such that this is reversed, or if I definitely need to debug my dataset.</p> Answer:
https://ai.stackexchange.com/questions/45555/is-there-any-purpose-of-altering-neural-network-architecture-if-validation-loss
Question: <p>This post continues the topic in the following post: <a href="https://ai.stackexchange.com/q/17553/2444">Is it possible to train a neural network with 3 inputs and 12 outputs?</a>.</p> <p>I conducted several experiments in MATLAB and selected those neural networks that best approximate the data.</p> <p...
https://ai.stackexchange.com/questions/17571/how-do-i-determine-the-best-neural-network-architecture-for-a-problem-with-3-inp
Question: <p>I am working on a prediction problem where each outcome vector in my training data <span class="math-container">$y_i$</span> was generated to satisfy a set of linear constraints <span class="math-container">$A_i y_i = b_i$</span>. I know each <span class="math-container">$A_i$</span> and <span class="math-...
https://ai.stackexchange.com/questions/46756/is-there-a-neural-network-architecture-that-enforces-context-specific-constraint
Question: <p>I've been experimenting with different neural network architectures and am curious about the impact of input ranges on their performance. While normalizing inputs to ranges such as [0,1] or [-1,1] is a common practice, I wonder if there's a theoretically preferable input range that neural networks tend to ...
https://ai.stackexchange.com/questions/46150/is-there-a-theoretically-optimal-input-range-for-neural-networks
Question: <p>so I'm working on a Project where I want to predict the Vehicle Position from the Vehicle Data like speed, acceleration etc.. now the data that I have comes also with a timestamp for each sample ( I mean that I have also a timestamp feature).</p> <p>at first I thought that I should get rid of that timesta...
https://ai.stackexchange.com/questions/15816/how-to-choose-the-suitable-neural-network-architecture-for-regression-tasks
Question: <p>Convolution Neural Network (CNNs) operate over strict grid-like structures (<span class="math-container">$M \times N \times C$</span> images), whereas Graph Neural Networks (GNNs) can operate over all-flexible graphs, with an undefined number of neighbors and edges.</p> <p>On the face of it, GNNs appear to...
https://ai.stackexchange.com/questions/24891/how-can-we-derive-a-convolution-neural-network-from-a-more-generic-graph-neural
Question: <p>I am asking this question on deep neural network architectures only. If you want to restrict the domain of tasks then you can choose computer vision for this question.</p> <p>Suppose there is an architecture that performs well on a task. Is it possible can edit or append the first or last few layers and th...
https://ai.stackexchange.com/questions/34019/is-it-possible-that-a-deep-neural-network-with-some-variations-can-be-used-for
Question: <p>I'm currently trying to predict 1 output value with 52 input values. The problem is that I only have around 100 rows of data that I can use. </p> <p>Will I get more accurate results when I use a small architecture than when I use multiple layers with a higher amount of neurons? </p> <p>Right now, I use 1...
https://ai.stackexchange.com/questions/18439/is-a-basic-neural-network-architecture-better-with-small-datasets
Question: <p>I have been coming across visualizations showing that the neural nets tend to perform better as compared to the traditional machine learning algorithms (Linear regression, Log regression, etc.)</p> <p>Assuming that we have sufficient data to train deep/neural nets, can we ignore the traditional machine le...
https://ai.stackexchange.com/questions/18085/is-traditional-machine-learning-obsolete-given-that-neural-networks-typically-ou
Question: <p>Trying to understand the VGG architecture and I have these following questions.</p> <ol> <li>I understand the general understanding of increasing filter size is because we are using max pooling and so its image size gets reduced. So in order to keep information gain, we increase filter size. But the last ...
https://ai.stackexchange.com/questions/4711/trying-to-understand-vgg-convolution-neural-networks-architecture
Question: <p>I am using <a href="https://github.com/pytorch/examples/blob/master/reinforcement_learning/actor_critic.py" rel="nofollow noreferrer">Open AI's</a> code to do a RL task on an environment that I built myself.</p> <p>I tried some network architectures, and they all converge, faster or slower on CartPole.</p...
https://ai.stackexchange.com/questions/10210/how-to-identify-too-small-network-in-reinforcement-learning
Question: <p>I had a task to implement a neural network that would carry out multiclass classification of traffic by several parameters. On the advice of colleagues, I chose the &quot;Multilayer Perceptron&quot; architecture. One of these days I will have a defense of my work, but I absolutely do not understand how to ...
https://ai.stackexchange.com/questions/35873/how-to-justify-the-chosen-neural-architecture
Question: <p>Does anyone have any pointers to resources about the properties of randomly initialized neural networks (with no training)? I'm guessing this might depend on the network architecture and initialization scheme, but I'm most interested in properties that seem to be mostly true across architectures and initia...
https://ai.stackexchange.com/questions/37128/distributions-over-outputs-for-randomly-initialized-neural-networks
Question: <p>Below is the loss of the same training run at different scales illustrating the plateau phenomenon. <img src="https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7759d9f-88f2-4a96-a38a...
https://ai.stackexchange.com/questions/37716/alternatives-to-brute-forcing-neural-network-plateau
Question: <p><a href="https://arxiv.org/abs/1810.04805" rel="nofollow noreferrer">BERT</a> encodes a piece of text such that each token (usually words) in the input text map to a vector in the encoding of the text. However, this makes the length of the encoding vary as a function of the input length of the text, which ...
https://ai.stackexchange.com/questions/23611/are-there-transformer-based-architectures-that-can-produce-fixed-length-vector-e
Question: <p>I am working on neural networks for oceanographic data and face challenges in dealing with masked values, which I set to NaN.. I can train a neural network model with 1D vertical profiles (e.g. temperature and salinity at different depths in the ocean) and 2D ocean surface data (e.g. sea surface temperatur...
https://ai.stackexchange.com/questions/47006/how-to-handle-masked-values-in-neural-networks-for-geospatial-data
Question: <p>I’ve been reading about neural network architectures. In certain cases, people say that the sigmoid "more accurately reflects real-life" and, in other cases, functions like hard limits reflect "the brain neural networks more accurately". </p> <p>What activation functions are better for what problems?</p>...
https://ai.stackexchange.com/questions/17526/what-activation-functions-are-better-for-what-problems
Question: <p>We have convolutional neural networks and recurrent neural networks for analyzing, respectively, images and sequential data.</p> <p>Now, suppose I want to approximate the unknown function <span class="math-container">$f(x,y) = \sin(2\pi x)\sin(2\pi y)$</span>, with domain <span class="math-container">$\Ome...
https://ai.stackexchange.com/questions/9319/which-neural-network-should-i-use-to-approximate-a-specific-but-unknown-function
Question: <p>I'm looking for a neural network architecture that excels in counting objects. For example, CNN that can output the number of balls (or any other object) in a given image.</p> <p>I already found articles about crowd counting. I'm looking for articles about different types of objects.</p> Answer: <p>If you...
https://ai.stackexchange.com/questions/11139/which-neural-network-can-count-the-number-of-objects-in-an-image
Question: <p>I work with neural networks for real-time image processing on embedded softwares and I tested different architectures (Googlenet, Mobilenet, Resnet, custom networks...) and different hardware solutions (boards, processors, AI accelerators...). I noticed that the performance of the system, in terms of infer...
https://ai.stackexchange.com/questions/10418/what-are-the-aspects-that-most-impact-on-the-inference-time-for-neural-networks
Question: <p>I'm studying recurrent neural networks. Reading <a href="https://stanford.edu/%7Eshervine/teaching/cs-230/cheatsheet-recurrent-neural-networks" rel="nofollow noreferrer">this page</a> where it lists different types of recurrent network architectures, I think think of applications involving one-to-many (spe...
https://ai.stackexchange.com/questions/35155/applications-of-one-to-one-recurrent-networks
Question: <p>I have become more familiar with libraries such as tensorflow for a while now, and have become interested in utilizing neural networks for solving specific problems. The big question I have is, what are some principles that you have to take into account for designing your neural networks architecture?</p> ...
https://ai.stackexchange.com/questions/36326/principles-of-designing-a-neural-network
Question: <p>I understand that to solve multilabel classification problems, we can use the softmax activation function in the output layer of the neural network. The softmax function outputs probabilities of each label, and the label with highest probability is then predicted as the target label. However, I just saw in...
https://ai.stackexchange.com/questions/41461/how-can-a-regression-based-neural-network-learn-class-thresholds
Question: <p>everyone. I am working on a nested neural network architecture. For the sake of better understanding my question, simply assume the loss is</p> <p><span class="math-container">$L = G(k’) - H(k'')$</span></p> <p>where <span class="math-container">$G$</span> and <span class="math-container">$H$</span> are tw...
https://ai.stackexchange.com/questions/42777/what-is-the-potential-issue-of-nested-neural-networks
Question: <p>Just came across <a href="https://www.gwern.net/newsletter/2020/05#gpt-3" rel="nofollow noreferrer">this article on GPT-3</a>, and that lead me to the question:</p> <p>In order to make a certain kind of neural network architecture smarter all one needs to do is to make it bigger?</p> <p>Also, if that is tr...
https://ai.stackexchange.com/questions/22469/is-the-size-of-a-neural-network-directly-linked-with-an-increase-in-its-intelige
Question: <blockquote> <p><a href="https://medium.com/saarthi-ai/transformers-attention-based-seq2seq-machine-translation-a28940aaa4fe" rel="noreferrer">Attention</a> idea is one of the most influential ideas in deep learning. The main idea behind attention technique is that it allows the decoder to "look back” at th...
https://ai.stackexchange.com/questions/21389/what-is-the-intuition-behind-the-attention-mechanism
Question: <p>I am trying to understand why attention models are different than just using neural networks. Essentially the optimization of weights or using gates for protecting and controlling cell state (in recurrent networks), should eventually lead to the network focusing on certain parts of the input/source. So wha...
https://ai.stackexchange.com/questions/12313/a-mathematical-explanation-of-attention-mechanism
Question: <p>Recurrent Neural Networks (RNN) With Attention Mechanism is generally used for Machine Translation and Natural Language Processing. In Python, implementation of RNN With Attention Mechanism is abundant in Machine Translation (For Eg. <a href="https://talbaumel.github.io/blog/attention/" rel="nofollow noref...
https://ai.stackexchange.com/questions/10010/how-to-use-rnn-with-attention-mechanism-on-non-textual-data
Question: <p>[LONG POST!!] I am working on a DNN model that works as an improviser to generate music sequences. The idea of generating music is based on taking a sequence of music nodes (their index representation) and generating sequences that are distinctive with more context and coherent structure as well as capturi...
https://ai.stackexchange.com/questions/28113/how-do-autoregressive-attention-mechanism-work-in-multi-headed-attention
Question: <p>I have ready many explanations of the seq2seq model. In my opinion, however, it is really like a robot that might say something correctly, but doesn't really understand it, just as is true with an LLM generally.</p> <p>In my opinion, the correct way to describe Seq2Seq and similar NLP models should start f...
https://ai.stackexchange.com/questions/45853/probability-interpretation-of-attention-mechanism-in-seq2seq
Question: <p>I am aware that the attention mechanism can be used to deal with long sequences, where problems related to gradient vanishing and, more generally, representing effectively the whole sequence arise.</p> <p>However, I was wondering if attention, applied either to seq2seq RNN/GRU/LSTM or via Transformers, can...
https://ai.stackexchange.com/questions/25253/can-the-attention-mechanism-improve-the-performance-in-the-case-of-short-sequenc
Question: <p>I am doing some research on the visual attention mechanism in remote sensing domain (where the features learnt from one layer are highlighted using the attention mask derived from another layer). From what I have observed, the attention mask is learnt in a similar fashion as any other branch in CNN. So, wh...
https://ai.stackexchange.com/questions/21211/how-is-visual-attention-mechanism-different-from-a-two-branch-convolutional-neur
Question: <p>About attention: the Query, Key and Value vectors (before the linear transformations) are just the entire sequence, that is being inputted, or just each token? Chat-GPT nor Youtube didn't give me a clear answer. But, I thought. If we feed in each sequence straight into the Attention mechanism, then the lin...
https://ai.stackexchange.com/questions/43820/does-transformers-self-attention-mechanism-process-tokens-independently-or-ent
Question: <p>In the <a href="https://arxiv.org/pdf/1706.03762.pdf" rel="nofollow noreferrer">original transformer paper</a>, the attention mechanism uses parameter matrices, but no bias terms. However, in more recent implementations I see people often using a bias term when computing &quot;key&quot;, &quot;query&quot;,...
https://ai.stackexchange.com/questions/38983/is-there-any-evidence-that-the-bias-terms-help-in-the-attention-mechanism-of-the
Question: <p>The main advantages of the self-attention mechanism are:</p> <ul> <li>Ability to capture long-range dependencies</li> <li>Ease to parallelize on GPU or TPU</li> </ul> <p>However, I wonder why the same goals cannot be achieved by <em>global depthwise convolution</em> (with the kernel size equal to the lengt...
https://ai.stackexchange.com/questions/30169/couldnt-the-self-attention-mechanism-be-replaced-with-a-global-depth-wise-convo
Question: <p>I have two questions about the structure of attention modules:</p> <p>Since I work with imagery I will be talking about using convolutions on feature maps in order to obtain attention maps.</p> <ol> <li><p>If we have a set of feature maps with dimensions [B, C, H, W] (batch, channel, height, width), why do...
https://ai.stackexchange.com/questions/29989/attention-mechanism-why-apply-multiple-different-transformations-to-obtain-quer
Question: <p>The transformer architecture contains a cross attention mechanism which is enriching the encoder with information from the decoder. The place where this takes place is visualized in the image below:</p> <p><a href="https://i.sstatic.net/L3ifH.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/L...
https://ai.stackexchange.com/questions/38340/why-do-the-values-in-the-cross-attentional-mechanism-within-a-transformer-come-f
Question: <p>Yesterday, I found <a href="https://pubmed.ncbi.nlm.nih.gov/34150797/" rel="nofollow noreferrer">this</a> fascinating paper about predicting various clinical conditions using an attention based LSTM. I don't have any practical experience with attention mechanism or transformers, which might be the reason w...
https://ai.stackexchange.com/questions/36922/using-similarity-score-within-lstm-embedding-for-attention-based-mechanism
Question: <p>Excuse me if you find this question too vague and not fitting to this forum and feel free to close it. The overall goal of my question is to get a better intuition of the attention concept and mechanism.</p> <p>There is a high-level analogy between attention mechanisms (to be specific: in the transformer) ...
https://ai.stackexchange.com/questions/40425/how-are-the-intuitions-and-mathematics-of-attention-mechanisms-related-to-those
Question: <p>I’m curious about the mathematical reasoning behind the use of the softmax function as the activation function in self-attention mechanisms within neural networks. Specifically, I’m interested in understanding if there is a theoretical basis that necessitates the use of softmax over other activation functi...
https://ai.stackexchange.com/questions/43048/is-softmax-necessary-as-the-activation-function-for-self-attention-mechanisms
Question: <p>Watching <a href="https://youtu.be/kCc8FmEb1nY?t=4767" rel="noreferrer">this video</a> implementing attention in a transformer. He set query, key, and value biases to <code>False</code> and said &quot;Typically, people don't use biases for these&quot;.</p> <p>Even in <a href="https://pytorch.org/docs/stabl...
https://ai.stackexchange.com/questions/40252/why-are-biases-typically-not-used-in-attention-mechanism
Question: <p>In the <a href="https://arxiv.org/pdf/1706.03762.pdf" rel="nofollow noreferrer">Attention is all you need</a> paper, on the 4th page, we have equation 1, which describes the self-attention mechanism of the transformer architecture</p> <p><span class="math-container">$$ \text { Attention }(Q, K, V)=\operato...
https://ai.stackexchange.com/questions/25217/in-the-multi-head-attention-mechanism-of-the-transformer-why-do-we-need-both-w
Question: <p>As this <a href="https://ai.stackexchange.com/q/21237/23811">question</a> says:</p> <blockquote> <p>In scaled dot product attention, we scale our outputs by dividing the dot product by the square root of the dimensionality of the matrix:</p> <p><a href="https://i.sstatic.net/wLI4m.png" rel="nofollow norefe...
https://ai.stackexchange.com/questions/40244/in-the-attention-mechanism-why-dont-we-normalize-after-multiplying-values
Question: <p>I have a difficult time understanding the &quot;multi-head&quot; notion in the original <a href="https://papers.nips.cc/paper/2017/file/3f5ee243547dee91fbd053c1c4a845aa-Paper.pdf" rel="noreferrer">transformer paper</a>. What makes the learning in each head unique? Why doesn't the neural network learn the s...
https://ai.stackexchange.com/questions/25148/what-is-different-in-each-head-of-a-multi-head-attention-mechanism
Question: <p>I am a bit confused on what cross attention mechanisms are doing. I understand that the currently decoded output is usually the query and the conditioning/input (from an encoder) is the key and value. The query is multiplied by the key to make an attention matrix that details how much each element of the c...
https://ai.stackexchange.com/questions/45543/how-to-interpret-cross-attention
Question: <p>As far as I know, attention was first introduced in <a href="https://arxiv.org/abs/1409.0473" rel="nofollow noreferrer">Learning To Align And Translate</a>.</p> <p>There, the core mechanism which is able to disregard the sequence length, is a dynamically-built matrix, of shape output_size X input_size, in ...
https://ai.stackexchange.com/questions/40082/difference-between-dot-product-attention-and-matrix-attention
Question: <p>I've been reading about transformers &amp; have been having some difficulty understanding the concept of <em>alignment</em>.</p> <p>Based on this <a href="https://towardsdatascience.com/attn-illustrated-attention-5ec4ad276ee3#16cb" rel="nofollow noreferrer">article</a></p> <blockquote> <p>Alignment means m...
https://ai.stackexchange.com/questions/26184/what-is-the-purpose-of-alignment-in-the-self-attention-mechanism-of-transforme
Question: <p>So while predicting the next word in autoregressive models(LLM) will the attention mechanism use queries from starting word or only previous word. Like for predicting after sentence &quot;I love&quot; attention mechanism takes query value for I and love and after predicting lets say as pizza, the next word...
https://ai.stackexchange.com/questions/47124/autoregressive-modelsllm-inference-prediction
Question: <p>From what I understand, the self-attention mechanism captures the dependency of a given token on various other tokens in a sequence. Inspired by nature, where natural laws are often expressed in terms of differential equations, I wonder: Does self-attention also capture relationships analogous to the rate ...
https://ai.stackexchange.com/questions/48398/can-self-attention-capture-rate-of-change-of-token
Question: <p>I have a question about the context of CNN and LSTM. I have trained a CNN network for image classification. However, I would like to combine it with LSTM for visualizing the attention weights. So, I extracted the features from the CNN to put it into LSTM. However, I am stuck at the concept of combinating t...
https://ai.stackexchange.com/questions/13507/understanding-cnnlstm-concept-with-attention-and-need-help
Question: <p>I am wondering what is believed to be the reason for superiority of transformer?</p> <p>I see that some people believe because of the attention mechanism used, it’s able to capture much longer dependencies. However, as far as I know, you can use attention also with RNN architectures as in the famous paper...
https://ai.stackexchange.com/questions/23898/any-comparison-between-transformer-and-rnnattention-on-the-same-dataset
Question: <p>Are multi-head attention matrices weighted adjacency matrices?</p> <p>The job of the multi-head-attention mechanism in transformer models is to determine how likely a word is to appear after another word. In a sense this makes the resulting matrix a big graph with nodes and edges, where a node represents a...
https://ai.stackexchange.com/questions/32036/is-the-multi-head-attention-in-the-transformer-a-weighted-adjacency-matrix
Question: <p>I am searching for an academic (i.e. with maths formulae) textbook which covers (at least) the following:</p> <ul> <li>GAN</li> <li>LSTM and transformers (e.g. seq2seq)</li> <li>Attention mechanism</li> </ul> <p>The closest match I got is <em>Deep Learning</em> (2016, MIT Press) but it only deals with part...
https://ai.stackexchange.com/questions/25329/recent-deep-learning-textbook-i-e-covering-at-least-gans-lstm-and-transformer
Question: <p>I am reading the BERT paper <a href="https://arxiv.org/pdf/1810.04805.pdf" rel="nofollow noreferrer">BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding</a>.</p> <p>As I look at the attention mechanism, I don't understand why in the BERT encoder we have an intermediate layer b...
https://ai.stackexchange.com/questions/11235/why-does-the-bert-encoder-have-an-intermediate-layer-between-the-attention-and-n
Question: <p>My understanding is that all tokens are passed to a transformer at once, and positional encodings help it understand their order in the sequence. And cosine type of positional encoding helps capture the short-term and long-term dependencies between the tokens (this is due to different frequencies for the c...
https://ai.stackexchange.com/questions/47763/why-do-we-need-cosine-positional-encoding-in-multi-head-attention-based-transfor
Question: <p>Transformer architectures, based on the self-attention mechanism, have achieved outstanding performance in a variety of applications.</p> <p>The main advantage of this approach is that the given token can interact with any token in the input sequence and extract global information since the first layer, wh...
https://ai.stackexchange.com/questions/28599/are-there-any-advantages-of-the-local-attention-against-convolutions
Question: <p>Suppose I have included 3 examples of an idiosyncratic sentence for training by a transformer:</p> <ul> <li>Example 1: <strong>Asdfogiug likes Zsdfoiusdhf and Zsdfoiusdhf likes Asdfogiug too.</strong></li> <li>Example 2: <strong>Bsodifhas likes Zsdfoiusdhf and Zsdfoiusdhf likes Bsodifhas too.</strong></li>...
https://ai.stackexchange.com/questions/45866/can-transformer-attention-make-predictions-based-on-analogy
Question: <p>Attention-scoring mechanism seems to be a commonly-used component in various seq2seq models, and I was reading about the original "Location-based Attention" in Bahadanau well-known paper at <a href="https://arxiv.org/pdf/1506.07503.pdf" rel="nofollow noreferrer">https://arxiv.org/pdf/1506.07503.pdf</a>. (i...
https://ai.stackexchange.com/questions/21588/how-to-understand-the-matrices-used-in-the-attention-layer
Question: <p>In section 2.1 of the <a href="https://arxiv.org/pdf/1710.10903.pdf" rel="nofollow noreferrer">Graph attention network paper</a></p> <p>The graph attention layer is described as</p> <blockquote> <p>as an initial step, a shared linear transformation, parametrized by a weight matrix, W ∈ RF ′×F , is applied ...
https://ai.stackexchange.com/questions/42292/why-is-there-a-shared-matrix-w-in-graph-attention-networks-instead-of-the-query
Question: <p>When we are applying a mask onto the padded values in an input sequence, it is typically done through setting the padded values as negative infinity. For example, a tensor of values <code>[1,2,3,0,0]</code> should result in a padding mask of <code>pad_mask = [True, True, True, False, False]</code> (or the ...
https://ai.stackexchange.com/questions/41062/when-do-we-apply-a-mask-onto-our-padded-values-during-attention-mechanisms
Question: <p>I'm reading OpenAI's new paper &quot;<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>&quot; And I can't fully understand the concept of neurons here.</p> <p>Can you please explain it? ...
https://ai.stackexchange.com/questions/40385/what-is-a-neuron-in-large-language-models
Question: <p>In RNNs, to avoid &quot;forgetting&quot; information encoded by earlier encoders, we can use attention. It's basically a second neural network that tells us how much we should attend at time <em>t</em> on each of the earlier hidden states (from <em>1</em> to <em>t - 1</em>). This is described here: <a href...
https://ai.stackexchange.com/questions/43660/attention-with-recurrent-neural-networks
Question: <p>Convolutions can be expressed as a matrix-multiplication (see e.g. <a href="https://ai.stackexchange.com/q/11172/2444">this post</a>) and as an element-wise multiplication using the Fourier domain (<a href="https://en.wikipedia.org/wiki/Convolution_theorem" rel="nofollow noreferrer">https://en.wikipedia.or...
https://ai.stackexchange.com/questions/23699/is-it-possible-to-express-attention-as-a-fourier-convolution
Question: <p>In the paper <a href="https://arxiv.org/pdf/2008.02217.pdf" rel="nofollow noreferrer">Hopfield networks is all you need</a>, the authors mention that their modern Hopfield network layers are a good replacement for pooling, GRU, LSTM, and attention layers, and tend to outperform them in various tasks.</p> <...
https://ai.stackexchange.com/questions/26038/reasoning-behind-performance-improvement-with-hopfield-networks
Question: <p>There is something that i can't get it, given a prompt input to ChatGPT, this is One Hot Encoded, Embedded, Positional Encoded and so on. Anyway we have a matrix, still after attention mechanism we have a matrix, how we end with a probability vector and not with a probability matrix?</p> Answer: <p>Once ...
https://ai.stackexchange.com/questions/45890/how-chatgpt-pass-from-a-prompt-to-a-predicted-word
Question: <p>So I'm trying to write PyTorch code that performs the single-head computation, so you get some input vectors, attention mechanism/linear transformations, some output vectors.</p> <p>Then I tried to re-use the same matrices by splitting them up into submatrices and get the same output vectors by using a 2-h...
https://ai.stackexchange.com/questions/47156/are-single-head-and-multi-head-attention-equivalent-in-terms-of-input-and-output
Question: <p>I have a question about <a href="http://proceedings.mlr.press/v37/xuc15.pdf" rel="nofollow noreferrer">Show, Attend and Tell: Neural Image CaptionGeneration with Visual Attention</a> paper by Xu. The basic mechanism of stochastic hard attention is that each pixel of the input image has a corresponding para...
https://ai.stackexchange.com/questions/25828/how-are-the-parameters-alpha-i-of-hard-attention-trained
Question: <p>There are many articles comparing RNNs/LSTMs and the Attention mechanism. One of the disadvantages of RNNs that is often mentioned is that while Attention can be computed in parallel, RNNs are highly sequential. That is, the computation of the next tokens depends on the result of previous tokens, thus, RNN...
https://ai.stackexchange.com/questions/27171/do-rnns-lstms-really-need-to-be-sequential
Question: <p>In the paper <a href="https://openreview.net/pdf?id=B1DmUzWAW" rel="nofollow noreferrer">A Simple Neural Attentive Meta-Learner</a>, the authors mentioned right before Section 3.1:</p> <blockquote> <p>we preserve the internal state of a SNAIL across episode boundaries, which allows it to have memory tha...
https://ai.stackexchange.com/questions/11557/what-is-the-internal-state-of-a-simple-neural-attentive-meta-learnersnail
Question: <p>I was hoping someone could explain to me why in the transformer model from the &quot;Attention is all you need&quot; paper there is no activation applied after both the multihead attention layer and to the residual connections. It seems to me that there are multiple linear layers in a row, and I have alwa...
https://ai.stackexchange.com/questions/30341/why-does-a-transformer-not-use-an-activation-function-following-the-multi-head-a
Question: <p>I want to understand the transformer architecture, so I start with self attention and I understand their mechanism, but when I pass to the multi-head attention I find some difficulties like how calculate Q , K and V for each head. I find many way to calculate Q , K and V but I don't know which way is corr...
https://ai.stackexchange.com/questions/45329/how-the-q-k-v-be-calculated-in-multi-head-attention
Question: <p>During trying to understand transformers by reading <a href="https://arxiv.org/abs/1706.03762" rel="nofollow noreferrer">Attention is all you need</a>, I noticed the authors constantly refer to &quot;self attention&quot; without explaining it.</p> <p>The original attention mechanism is introduced in <a hre...
https://ai.stackexchange.com/questions/39891/understanding-self-attention-how-come-there-is-no-connection-between-different
Question: <p>Considering the architecture of encoder and decoder in transformer as shown below: <a href="https://i.sstatic.net/4pAzL.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/4pAzL.png" alt="enter image description here" /></a></p> <ul> <li><strong>Does each input token after self attention mechani...
https://ai.stackexchange.com/questions/40173/does-number-of-fully-connected-neural-networks-changes-in-transformer-architecht
Question: <p><a href="https://arxiv.org/pdf/1709.01507.pdf" rel="nofollow noreferrer">Squezee-and-excite networks</a> introduced SE blocks, while <a href="https://arxiv.org/pdf/1801.04381.pdf" rel="nofollow noreferrer">MobileNet v2</a> introduced linear bottlenecks.</p> <p>What is the effective difference between thes...
https://ai.stackexchange.com/questions/14009/what-is-the-difference-between-squeeze-and-excite-and-bottleneck-modules-from-mo
Question: <p>I am learning Computational Neuroscience. If I do reasoning in my mind, especially Classifying an object and Deducing to figure out its qualities, I have to memorize the category and the category's definition, qualities in the past.</p> <p>So what are the Essence and foundations of Memory in ANNs and the B...
https://ai.stackexchange.com/questions/42478/what-is-the-essence-of-memory-of-anns-and-brain
Question: <p>I'm trying to understand how transformer models, such as BERT or GPT, handle negation in sentiment analysis. Specifically, I'm curious about how these models manage to correctly interpret sentences where negation changes the sentiment, such as &quot;The movie is not good.&quot;</p> <p>A simple model using ...
https://ai.stackexchange.com/questions/46067/how-do-transformer-models-handle-negation-in-sentiment-analysis
Question: <p>In Transformer models, token embeddings are combined with positional encodings through element-wise addition to incorporate positional information. However, this raises a concern about the potential for different tokens in different positions to end up with identical embeddings.</p> <p>For example, conside...
https://ai.stackexchange.com/questions/46205/how-do-transformer-models-ensure-unique-token-representations-when-combining-emb
Question: <p>Regarding the use of pre-processing techniques before using Transformers models, I read <a href="https://stackoverflow.com/a/63986348/13745968">this post</a> that apparently says that these measures are not so necessary nor interfere so much in the final result.</p> <p>The arguments raised seemed to me qui...
https://ai.stackexchange.com/questions/27009/why-not-using-pre-processing-before-using-transformer-models
Question: <p>I've watched the outstanding Andrej Karpathy's <a href="https://www.youtube.com/watch?v=VMj-3S1tku0&amp;list=PLAqhIrjkxbuWI23v9cThsA9GvCAUhRvKZ&amp;index=1&amp;t=0s" rel="nofollow noreferrer">From Zero to Hero course</a>. In the last lecture, he introduces Transformer decoder architecture, which is able to...
https://ai.stackexchange.com/questions/40686/are-transformer-models-better-than-comparable-complexity-mlp-based-models
Question: <p>In <a href="https://proceedings.neurips.cc/paper/2017/file/3f5ee243547dee91fbd053c1c4a845aa-Paper.pdf" rel="nofollow noreferrer">Attention Is All You Need</a> paper:</p> <blockquote> <p>That is, the output of each sub-layer is <span class="math-container">$LayerNorm(x+Sublayer(x))$</span>, where <span clas...
https://ai.stackexchange.com/questions/16835/where-should-we-place-layer-normalization-in-a-transformer-model
Question: <p>In the transformer model, to incorporate positional information of texts, the researchers have added a positional encoding to the model. <em>How does positional encoding work? How does the positional encoding system learn the positions when varying lengths and types of text are passed at different time int...
https://ai.stackexchange.com/questions/18437/how-does-positional-encoding-work-in-the-transformer-model
Question: <p>I am trying to make a model that uses a <em>Transformer</em> to see the relationship between several data vectors, but the order of the data is not relevant in this case, so I am not using the <em>Positional Encoding</em>.</p> <p>Since the performance of models using Transformers is quite improved with the...
https://ai.stackexchange.com/questions/32396/is-positional-encoding-always-needed-for-using-transformer-models-correctly
Question: <p>I understand that all inputs in a batch need to be of the same size. However, it seems BERT/Transformers models can accept batches with different sizes as input.</p> <p>How is that possible? I thought we needed to pad all examples in a batch to <code>model.max_input_size</code>, however, it seems HuggingFa...
https://ai.stackexchange.com/questions/41858/how-can-bert-transformer-models-accept-input-batches-of-different-sizes
Question: <p>I'm currently studying the Transformer model (<strong>Attention is all you need</strong>) and after reading it I still have some questions for which I get conflicting answers if I google them:</p> <ul> <li>What exactly are the dimensions of the input to the encoder of a transformer, from what I've seen you...
https://ai.stackexchange.com/questions/34760/dimensions-of-a-transformer-model-and-purpose-of-masking
Question: <p>I am not technically familiar with AI or neural networks beyond a tech news reading level of knowledge, so I apologise if this is a dumb question.</p> <p>I was recently reading <a href="https://arstechnica.com/gadgets/2023/01/the-generative-ai-revolution-has-begun-how-did-we-get-here/3/" rel="nofollow nore...
https://ai.stackexchange.com/questions/38973/following-instructions-as-an-emergent-behaviour-in-transformer-models-isnt
Question: <p>So I was experimenting with the Llama and Mistral models, and using &quot;talk like a viking&quot; in the system prompt caused the model to resemble a viking or similar. How they know that? This was on a instruct version of these models. Here is a example output from Hugging Face spaces, when I asked about...
https://ai.stackexchange.com/questions/47813/how-transformer-models-can-imitate-characters
Question: <p>I have some questions about using (encoder / decoder / encoder-decoder) transformer models, included (language) transformer or Vision transformer.</p> <p>The overall form of a transformer consists of an encoder and a decoder. Depending on the model, you may use only the encoder, only the decoder, or both. ...
https://ai.stackexchange.com/questions/41505/which-situation-will-helpful-using-encoder-or-decoder-or-both-in-transformer-mod