text:
What purpose would be served by developing AI's that experience human-like emotions?
In a recent Wall Street Journal article, Yann LeCunn makes the following statement:

The next step in achieving human-level ai is creating intelligent—but not autonomous—machines. The AI system in your car will get you safely home, but won’t choose another destination once you’ve gone inside. From there, we’ll add basic drives, along with emotions and moral values. If we create machines that learn as well as our brains do, it’s easy to imagine them inheriting human-like qualities—and flaws.

Personally, I have generally taken the position that talking about emotions for artificial intelligences is silly, because there would be no reason to create AI's that experience emotions.  Obviously Yann disagrees.  So the question is:  what end would be served by doing this?  Does an AI need emotions to serve as a useful tool?

There's also an alternate possibility: we won't necessarily want to develop AIs that experience human-like emotions (because then they'd be unpredictable, we'd have to give them rights, blah blah blah), but that more advanced AI techniques (such as deep learning) will inadvertently develop AIs that experience human-like emotions. It's not that we want them, it's that they might come anyway. Do Artificial Reinforcement-Learning Agents Matter Morally? discusses this possibility.

The answer to this question, unlike many on this board, I think is definitive. No. We don't need AI's to have emotion to be useful, as we can see by the numerous amount of AI's we already have that are useful.
But to further address the question, we can't really give AI's emotions. I think the closest we can get would be 'Can we make this AI act in a way a human would if that human was insert emotion?'. I guess in a sense, that is having emotion, but that's a whole other discussion.
And to what end? The only immediate reason coming to mind would be to create more lifelike companions or interactions, for the purposes of video games or other entertainment. A fair goal, but far from necessary. Even considering an AI-imbued greeting robot in the lobby of some building, we'd probably only ever want it to act cordial.
Yann says that super-advanced AI would lead to more human-like qualities and flaws. I think it's more like it would 'give our AI's more human-like qualities or in other words flaws'. People have a tendency to act irrationally when sad or angry, and for the most part we only want rational AI. To err is human, as they say.
The purpose of AI's and learning algorithms is to create systems that act or 'think' like humans, but better. Systems that can adapt or evolve, while messing up as little as possible. Emotive AI has uses, but it's certainly not a prerequisite for a useful system.

I think the fundamental question is: Why even attempt to build an AI? If that objective is clear, it will provide clarity to whether or not having emotional quotient in AI make sense. Some attempts like "Paro" that were developed for therapeutic reasons requires they exhibit some human like emotions. Again, note that "displaying" emotions and "feeling" emotions are two completely different things.
You can program a thing like paro to modulate the voice tones or facial twitches to express sympathy, affection, companionship, or whatever - but while doing so, a paro does NOT empathize with its owner - it is simply faking it by performing the physical manifestations of an emotion. It never "feels" anything remotely closer to what that emotion evokes in human brain.
So this distinction is really important. For you to feel something, there needs to be an independent autonomous subject that has the capacity to feel. Feeling cannot be imposed by an external human agent.
So going back to the question of what purpose it solves - answer really is - It depends. And the most I think we will achieve ever with silicone based AIs will remain the domain of just physical representations of emotions.

I tend to agree. And maybe my thinking is just too limited, but most of the applications of AI that I think about, would not benefit from the AI having emotions.  Well, at least I think so, sitting here now.  Maybe I'll look back one day and realize I was wrong.

Requiring that AI must/should have emotions is a misplaced expectation. AI basically is a set of tools, and its application therefore must also be decided based on the needs. Some use cases may require emotional aspect, some may not. Who knows!

I think emotions are not necessary for an AI agent to be useful.  But I also think they could make the agent MUCH more pleasant to work with.  If the bot you're talking with can read your emotions and respond constructively, the experience of interacting with it will be tremendously more pleasant, perhaps spectacularly so.
Imagine contacting a human call center representative today with a complaint about your bill or a product.  You anticipate conflict.  You may have even decided NOT to call because you know this experience is going to be painful, either combative or frustrating, as someone misunderstands what you say or responds hostilely or stupidly.
Now imagine calling the kindest smartest most focused customer support person you've ever met -- Commander Data -- whose only reason for existing is to make this phone call as pleasant and productive for you as possible.  A big improvement over most call reps, yes?  Imagine then if call rep Data could also anticipate your mood and respond appropriately to your complaints to defuse your emotional state... you'd want to marry this guy.  You'd call up call rep Data any time you were feeling blue or bored or you wanted to share some happy news.  This guy would become your best friend overnight -- literally love at first call.
I'm convinced this scenario is valid. I've noticed in myself a surprising amount of attraction for characters like Data or Sonny from "I Robot".  The voice is very soothing and puts me instantly at ease.  If the bot were also very smart, patient, knowledgable, and understanding...  I really think such a bot, embued with a healthy dose of emotional intelligence, could be enormously pleasant to interact with.  Much more rewarding than any person I know.  And I think that's true of not just me.
So yes, I think there's great value in tuning a robot's personality using emotions and emotional awareness.

Emotion in an AI is useful, but not necessary depending on your objective (in most cases, it's not).
In particular, emotion recognition/analysis is very well advanced, and it's used in a wide range of applications very successfully, from robot teacher for autistic children (see developmental robotics) to gambling (poker) to personal agents and politics sentiment/lies analysis.
Emotional cognition, the experience of emotions for a robot, is much less developed, but there are very interesting researchs (see Affect Heuristic, Lovotics's Probabilistic Love Assembly, and others...). Indeed, I can't see why we couldn't model emotions such as love as they are just signals that can already be cut in humans brains (see Brian D. Earp paper). It's difficult, but not impossible, and actually there are several robots reproducing partial emotional cognition.
I am of the opinion that the claim "robots can just simulate but not feel" is just a matter of semantics, not of objective capacity: for example, does a submarine swim like fish swim? However, planes fly, but not at all like birds do. In the end, does the technical mean really matters when in the end we get the same behavior? Can we really say that a robot like Chappie, if it ever gets made, does not feel anything just like a simple thermostat?
However, what would be the use of emotional cognition for an AI? This question is still in great debates, but I will dare offer my own insights:

Emotions in humans (and animals!) are known to affect memories. They are now well known in neuroscience as additional modalities, or meta-data if you prefer, of long term memories: they allow to modulate how the memory is stored, how it is associated/related with other memories, and how it will be retrieved.
As such, we can hypothesize that the main role of emotions is to add additional meta-information to memories to help in heuristic inference/retrieval. Indeed, our memories are huge, there are a lot of information we store over our lifetime, so emotions can maybe be used as "labels" to help retrieve faster the relevant memories.
Similar "labels" can be more easily associated together (memories of scary events together, memories of happy events together, etc.). As such, they can help survival by quickly reacting and applying known strategies (fleeing!) from scary strategies, or to take the most out of benefitting situations (happy events, eat the most you can, will help survive later on!). And actually, neuroscience studies discovered that there are specific pathways for fear-inducing sensory stimuli, so that they reach actuators faster (make you flee) than by passing through the usual whole somato-sensory circuit as every other stimuli. This kind of associative reasoning could also lead to solutions and conclusions that could not be reached otherwise.
By feeling empathy, this could ease robots/humans interaction (eg, drones helping victims of catastrophic events).
A virtual model of an AI with emotions could be useful for neuroscience and medical research in emotional disorders as computational models to understand and/or infer the underlying parameters (this is often done for example with Alzheimer and other neurodegenerative diseases, but I'm not sure if it was ever done for emotional disorders as they are quite new in the DSM).

So yes, "cold" AI is already useful, but emotional AI could surely be applied to new areas that could not be explored by using cold AI alone. It will also surely help in understanding our own brain, as emotions are an integral part.

I think that depends on the application of the AI. Obviously if I develop an AI that's purpose is plainly to do specific task under the supervision of humans, there is no need for emotions. But if the AI's purpose is to do task autonomously, then emotions or empathy can be useful. For example, think about an AI that is working in the medical domain. Here it may be advantageous for an AI to have some kind of empathy, just to make the patients more comfortable. Or as another example, think about a robot that serves as a nanny. Again it is obvious that emotions and empathy would be advantageous and desirable. Even for an assisting AI program (catchword smart home) emotions and empathy can be desirable to make people more comfortable. It would be much nicer to be welcomed by an empathic home assistant than by one with no empathic responses at all, wouldn't it?
On the other hand, if the AI is just working on an assembly line, there is obviously no need for emotions and empathy (on the contrary in that case it may be unprofitable).

Strong AIs
For a strong AI, the short answer is to call for help, when they might not even know what the supposed help could be.
It depends on what the AI would do. If it is supposed to solve a single easy task perfectly and professionally, sure emotions would not be very useful. But if it is supposed to learn random new things, there would be a point that it encounters something it cannot handle.
In Lee Sedol vs AlphaGo match 4, some pro who has said computer doesn't have emotions previously, commented that maybe AlphaGo has emotions too, and stronger than human. In this case, we know that AlphaGo's crazy behavior isn't caused by some deliberately added things called "emotions", but a flaw in the algorithm. But it behaves exactly like it has panicked.
If this happens a lot for an AI. There might be advantages if it could know this itself and think twice if it happens. If AlphaGo could detect the problem and change its strategy, it might play better, or worse. It's not unlikely to play worse if it didn't do any computations for other approaches at all. In case it would play worse, we might say it suffers from having "emotions", and this might be the reason some people think having emotions could be a flaw of human beings. But that wouldn't be the true cause of the problem. The true cause is it just doesn't know any approaches to guarantee winning, and the change in strategy is only a try to fix the problem. Commentators thinks there are better ways (which also don't guarantee winning but had more chance), but its algorithm isn't capable to find out in this situation. Even for human, the solution to anything related to emotion is unlikely to remove emotions, but some training to make sure you understand the situation enough to act calmly.
Then someone has to argue about whether this is a kind of emotion or not. We usually don't say small insects have human-like emotions, because we don't understand them and are unwilling to help them. But it's easy to know some of them could panic in desperate situations, just like AlphaGo did. I'd say these reactions are based on the same logic, and they are at least the reason why human-like emotions could be potentially useful. They are just not expressed in human-understandable ways, as they didn't intend to call a human for help.
If they tries to understand their own behavior, or call someone else for help, it might be good to be exactly human-like. Some pets can sense human emotions and express human-understandable emotion to some degree. The purpose is to interact with humans. They evolved to have this ability because they needed it at some point. It's likely a full strong AI would need it too. Also note that, the opposite of having full emotions might be becoming crazy.
It is probably a quick way to lose any trust if someone just implement emotions imitating humans with little understanding right away in the first generations, though.
Weak AIs
But is there any purposes for them to have emotions before someone wanted a strong AI? I'd say no, there isn't any inherent reasons that they must have emotions. But inevitably someone will want to implement imitated emotions anyway. Whether "we" need them to have emotions is just nonsense.
The fact is even some programs without any intelligence contained some "emotional" elements in their user interfaces. They may look unprofessional, but not every task needs professionality so they could be perfectly acceptable. They are just like the emotions in musics and arts. Someone will design their weak AI in this way too. But they are not really the AIs' emotions, but their creators'. If you feel better or worse because of their emotions, you won't treat individul AIs so differently, but this model or brand as a whole.
Alternatively someone could plant some personallities like in a role-playing game there. Again, there isn't a reason they must have that, but inevitably someone will do it, because they obviously had some market when a role-playing game does.
In either cases, the emotions don't really originate from the AI itself. And it would be easy to implement, because a human won't expect them to be exactly like a human, but tries to understand what they intended to mean. It could be much easier to accept these emotions realizing this.
Aspects of emotions
Sorry about posting some original research here. I made a list of emotions in 2012 and from which I see 4 aspects of emotions. If they are all implemented, I'd say they are exactly the same emotions as of humans. They don't seem real if only some of them are implemented, but that doesn't mean they are completely wrong.

The reason, or the original logical problem that the AI cannot solve. AlphaGo already had the reason, but nothing else. If I have to make an accurate definition, I'd say it's the state that multiple equally important heuristics disagreeing with each other.

The context, or which part of the current approach is considered not working well and should probably be replaced. This distinguishes sadness-related, worry-related and passionate-related.
The current state, or whether it feels leading, or whether its belief or the fact is supposed to turn bad first (or was bad all along) if things go wrong. This distinguishes sadness-related, love-related and proud-related.

The plan or request. I suppose some domesticated pets already had this. And I suppose these had some fixed patterns which is not too difficult to have. Even arts can contain them easily. Unlike the reasons, these are not likely inherent in any algorithms, and multiple of them can appear together.

Who supposedly had the responsibility if nothing is changed by the emotion. This distinguishes curiosity, rage and sadness.
What is the supposed plan if nothing is changed by the emotion. This distinguishes disappointment, sadness and surprise.

The source. Without context, even a human cannot reliably tell someone is crying for being moved or thankful, or smiling for some kind of embarrassment. In most other cases there aren't even words describing them. It doesn't make that much difference if an AI doesn't distinguish or show this specially. It's likely they would learn these automatically (and inaccurately as a human) at the point they could learn to understand human languages.
The measurements, such as how urgent or important the problem is, or even how likely the emotions are true. I'd say it cannot be implemented in the AI. Humans don't need to respect them even if they are exactly like humans. But humans will learn how to understand an AI if that really matters, even if they are not like humans at all. In fact, I feel that some of the extremely weak emotions (such as thinking something is too stupid and boring that you don't know how to comment) exist almost exclusively in emoticons, where someone intend to show you exactly this emotion, and hardly noticeable in real life or any complex scenerios. I supposed this could also be the case in the beginning for AIs. In the worst case, they are firstly conventionally known as "emotions" since emoticons works in these cases, so it's easier to group them together, but very few people seriously think they are, just like the example I gave.

So when strong AIs become possible, none of these would be unreachable, though there might be a lot of work to make the connections. So I'd say if there would be the need for strong AIs, they absolutely would have emotions.

By emotions he doesn't mean to add all sorts of emotions into an AI. He only meant the ones that will be helpful for taking vital decisions. Consider this incident for a second:
Suppose an AI self drive car is driving through the highway. The person sitting inside is the CEO of a company and he is running very behind on schedule. If he didn't get on time there will be loss of millions of dollars. The AI in the car has been told to drive as fast as possible and reach the destination. And now a rabbit (or some other animal) comes into the way. Now if the car puts emergency brakes then the passengers will get seriously hurt and plus there will be loss of millions as CEO won't be able to get to the meeting.
Now what will the AI do?
Since for an AI, their decisions are only based on their utility function. Hitting the rabbit and keep going will logically show a better option. But, should the AI take that decision.
There are many questions like these where an AI might stuck into a situation where moral based decisions will play a vital role.
The above scenario is just for an example point of view.

Human emotions are intricately connected to human values and to our ability to cooperate and form societies.
Just to give an easy example:
You meet a stranger who needs help, you feel empathy.
This compels you to help him at a cost to yourself.
Let's assume the next time you meet him, you need something. Let's also assume he doesn't help you, you'll feel anger.
This emotion compels you to punish him, at further cost for yourself.
He on the other hand, if he doesn't help you, feels shame.
This compels him to actually help you, avoiding your anger and making your initial investment worthwhile. You both benefit.
So these three emotions keep up a circle of reciprocal help. Empathy to get started, anger to punish defectors and shame to avoid the anger. This also leads to a concept of justice.
Given that value alignment is one of the big problems in AGI, human-like emotions strike me as good approach towards AIs that actually share our values and integrate themselves seamlessly into our society.

ok points, but if you will go father you will see that emotions are just shortcuts for logical explanation why they are or are not useful. Rules could be derived from emotions and our biology. And those rules are kept in compressed and non obvious form  as emotions and biology. For us it is necessity, but not for ai, although as for us it might work as optimization for AI if cost of such implementation in digital form will be lower then rules based implementation. Problem with rules is only one, we ourselves do not know them fully, but AI task is more narrow then our, might not need much rules

Theory of mind
If we want a strong general AI to function well in an environment that consists of humans, then it would be very useful for it to have a good theory of mind that matches how humans actually behave. That theory of mind needs to include human-like emotions, or it will not match the reality of this environment.
For us, an often used shortcut is explicitly thinking "what would I have done in this situation?" "what event could have motivated me to do what they just did?" "how would I feel if this had happened to me?". We'd want an AI to be capable of such reasoning, it is practical and useful, it allows better predictions of future and more effective actions.
Even while it would be better for it the AI to not be actually driven by those exact emotions (perhaps something in that direction would be useful but quite likely not exactly the same), all it changes that instead of thinking "what I would feel" it should be able to hypothesize what a generic human would feel. That requires implementing a subsystem that is capable of accurately modeling human emotions.

Careful! There are actually two parts to your question. Don't conflate meanings in your questions, otherwise you won't really know which part you are answering.

Should we let AGI experience emotion per "the qualitative experience"? (In the sense that you feel "your heart is on fire" when you fall in love)

There doesn't seem to be a clear purpose as to why we'd want that. Hypothetically we could just have something that is functionally indistinguishable from emotions, but doesn't have any qualitative experience with respect to the AGI. But we are not in a scientific position where we can even begin to answer any questions about the origins of qualitative experience, so I won't bother going deeper into this question.

Should we let AGI have emotions per its functional equivalence from an external observer?

IMHO yes. Though one could imagine a badass AI with no emotions doing anything you'd want it to, we do wish that AI can integrate with human values and emotions, which is the problem of alignment. It would thus seem natural to assume that any well-aligined AGI will have something akin to emotions if it has integrated well with humans.
BUT, without a clear theory of mind, it doesn't even begin to make sense to ask: "should our AGI have emotions?" Perhaps there is something critical about our emotions that makes us productive cognitive agents that any AGI would require as well.
Indeed, emotions are often an overlooked aspect of cognition. People somehow think that emotionless Spock-like characters are the pinnacle of human intelligence. But emotions are actually a crucial aspect in decision making, see this article for an example of the problems with "intelligence without emotions".
The follow-up question would be "what sorts of emotions would the AGI develop?", but again we are not in a position to answer that (yet).

What purpose would be served by developing AI's that experience
  human-like emotions?

Any complex problem involving human emotions, where the solution to the problem requires an ability to sympathize with the emotional states of human beings, will be most efficiently served by an agent that can sympathize with human emotions.
Politics. Government. Policy and planning. Unless the thing has intimate knowledge of the human experience, it won't be able to provide definitive answers to all problems we encounter in our human experience.

Politics and government point you made was an excellent example. My perspective however is that AI only needs to be able to understand emotion and not necessarily experience it.

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
When we create artificial life and artificial intelligence will we require it to obey human laws?
Assuming mankind will eventually create artificial humans, but in doing so have we put equal effort into how humans will relate to an artificial human, and what can we expect in return? This is happening in real-time as we place AI trucks and cars on the road. Do people have the right to question, maybe in court, if an AI machine breaks a law?

Like the Second Law in [tag:asimovs-laws]?

A problem here is we have already deployed AI killing machines in the form of autonomous drones.

Well, we don't have Asimov's Laws yet. :) See this question.

For those times when AI does interact with humans, I believe that AI would be held at LEAST to the same standards humans are. The problem comes in when we ask "who is really to blame". If a self-driving car cuts you off in traffic and causes you to wreck, you can't take the AI in the car to court. Do you take the company? The programmer? The owner of the car? Some entity will likely be held responsible, the question is just which one.
As for future human-like AI, I believe my answer still remains true. Having a human level AI changes the meaning of the word "entity". If a human-like AI breaks a law, it may be because it was programmed to do so. I don't think our current legal system is ready for such cases, but it have to evolve in the future.

As per the current legal system, if the AI agent were to be given a human citizenship, then yes, it would have to obey all laws as per the legislature of the country which provided the citizenship. If not then the entity who holds responsibility over its control and creation would be trialled (see also this scenario).
Having stated the above, it really is not as simple as it sounds. as @Tyler pointed out, the entity in here is not of a single person. If the AI agent were to take part in a malevolent act, then a more thorough investigation must be taken place than that for a human. If humanoid robots of free will were to roam our civilization, then our legal system ought to be expanded to cope up with possible real life anomalies that could occur.

source: Stack Exchange

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
If mankind can create artificial life in a machine, when would we define it's death?
Can one actually kill a machine? Not only do we have problems in defining life, we also have problems in defining death. Will this also be true in artificial life and artificial intelligence?

Very relevant question. I'm not voting to close this question as a duplicate yet, though, because that one asks about a specific paper's definition of death.

Yeah, I agree that this one serves as a general question, whereas the other is just about that paper.

I didn't notice this question before, but posted an answer for somewhat the same question here. Kindly refer.

Death as we know it for natural life is terminal. That is once dead, natural life cannot come back (at least in the current understanding and with current technologies---some people believe otherwise).
Death for AI is trickier. There may be only one scenario: Global destruction: Extreme scenario where everything supporting the existence of an AI disappears. This is equivalent to death in natural life, and low probability. It means all AIs die at once (as well as us).
We also do not know the degree and form of embodiment necessary for AGIs. We can assume now that hardware is replaceable indefinitely, thus "limiting" death to the above extreme scenario. But AGIs "body" may not be indefinitely replaceable. Then a definition closer to natural life death may be necessary.

We see arguments for two other scenarios, that I refute below:
"Static Death": An AI is still "defined" or "saved" somewhere (whatever it means actually), but it is not authorized or able to use resources. Assuming an AI is made of hardware and software, it is like a program stored on a disk, but without permission to run.
"Dynamic Death": Under the same characterization of AI as hardware and software, dynamic death is the invalidation of progress akin to strong liveness properties, where an AI is trapped in an infinite loop (or a void loop), in a form of "active death", as what happens to Sisyphus in Greek mythology. This is different from static death, as the AI still uses dynamic resources, although it cannot make progress. Continuing under the same assumptions, such AI could be "loaded" in main memory, or locked waiting for inputs or outputs to complete.
Note that in these two scenarios, rebirth is possible, and they also subsume that there is an entity that can decide conditions for rebirth, or preventing it completely. Would this entity be an "admin", a god, other AIs, or a human is another question, really.
The terms "death" and "rebirth" here could just be changed for "imprisoning", where the dynamic version would be like our human prisons, and the static version would be like SciFi cryogeny. This is a bit of a stretch, but we can see an equivalence, and no good reason to qualify these two scenarios as deaths.
In conclusion, death for AI seems to be an exceptional, singular scenario, so AI cannot die in practice, except if we are wrong on how we think we can make AGIs. AI can however be imprisoned forever.

Note: The terminology above is completely made-up for the post. I do not have citations to back some claims, but it is based on readings and personal work (including in software verification).

If AI arises from a replicable manufacturing process (e.g. as with modern computers), then it will presumably be possible to take a snapshot of the state of an AI and replicate it without error on some other mechanism.
For such a construct, 'death' doesn't mean the same as it currently does for us fleshy organics: multiple clones of an AI could presumably be instantiated at any time.
Hence, the analog of death that is needed is something closer to 'thermodynamic heat death', in which the AI does no further 'useful work'.
Using the standard percept/action characterization of AIs, then (as indicated in a comment below the question) this AI SE question gives such a definition of death for an AI: i.e. when it enters into a state from which it receives no further percepts and takes no actions.
EDIT: Note that this conception of death is a more terminal notion for an AI than 'not currently running'. In principle, one could say that a program is 'alive' even though only one instruction was executed every 10,000 years. For a fascinating discussion on this, see Hofstadter's "A Conversation with Einstein's Brain".

Is it then dead, or just asleep, or in a coma?

Given that re-instantiating a clone of the AI state will not restore it to operation, the authors of the paper presumably decided that 'death' was the appropriate analogy. Others might disagree. Note also the use of the term 'deadlock' in concurrent systems, where processes are still running, but can do no more useful work.

"Death" exists as a single concept because the underlying reality that it's describing is closely clumped together, and our definition has changed with our ability to change that reality.
It seems more reasonable that the various sorts of things that could be considered 'death' will be split apart, and a different word will be used to refer to a system with no copies currently running, vs. a system that has no stored version but could be recreated (because the code and random seed to generate it are still around), vs. a system that has been totally lost. (And I'm probably missing some possibilities!)

I don't think the term "death" will mean anything to an AI.  The reason I say that is this:  with an AI, running (presumably) on digital hardware, we can simply snapshot it's state from memory at any time. And then at any arbitrary time in the future we can recreate it as it was with perfect fidelity.
So even if you terminate a program intending it to be "dead", you never know if someone will come along later and bring it up again.  And perhaps more to the point, you might not know if another copy exists elsewhere.
I hate to use sci-fi references, but this one is apt: remember how in The Matrix trilogy programs would seek exile in The Matrix to avoid deletion?  Maybe the same thing will happen with our AI's... they will copy themselves to other places and try to hide, to avoid being deleted.  So if the program is clever enough, it might be able to evade any attempt to terminate it anyway.

The other answers seem to deal with "final death"...that is, a "terminal end" state where an AI cannot recover from. In other words, the AI is unable to function any further.
But that's not how I'd define death. I'd define death as a process being terminated. It doesn't matter if someone restarts the same process, because the existing process is already dead. The AI may have just made a new copy of itself, but it's just a copy, not the original. Death is just death.
We can call this type of "death" a "temporary death"...where the physical body dies but there is some "psychological continuity" (such as the source code that is used to run a program) that continues between the different bodies.
This type of "temporary death" has been explored in science fiction. PARANOIA and Eclipse Phase features humans who can quite frequently die, only to later be restored through a "memory backup". The humans may be functionally immortal...but the original is still dead, no matter what fates the other copies encounter. CGP Grey also made a video about Star Trek teleporters, which works by killing you and then spawning another copy of yourself in another area. Actually, fantasy settings also explores the idea of "temporary death" as well, where people can die only to later get revived by a magical spell.
My recommendation is to play through the philosophical game Staying Alive, which teaches three different philosophical approaches to life (and when that life terminates):

There are basically three kinds of things that could be required for the continued existence of your self. One is bodily continuity, which may actually require only that parts of the body stay in existence (i.e., the brain). Another is psychological continuity, which requires the continuance of your consciousness - by which is meant your thoughts, ideas, memories, plans, beliefs, and so on. The third possibility is the continued existence of some kind of immaterial part of you, which might be called the soul*. Of course, it may be the case that a combination of one or more types of these continuity is required for you to survive.

The other answers assumes that life is based on "psychological continuity", and looks at what might disrupt this "continuity". I assume that life is based on "bodily continuity", which is much easier to disrupt - just kill the process...it doesn't matter if a new process respawns...because the original process is still dead. By playing through "Staying Alive", you will be able to work out your own personal definition of life and death. Once you have your own personal definition, then simply apply it to this specific case, either siding with "psychological continuity" (the other answers) or "bodily continuity" (my own opinion).
*If you assume that life requires a soul, well, it is not clear that AI would have souls. If they don't (and this seems the most reasonable assumption here), then they obviously wouldn't be alive (and you cannot die if you are not alive). If they do have souls though, then the other answers which assume "psychological continuity" may still be applicable, as it seems that the existence of a "soul" is dependent on "psychological continuity".

Nice answer! We should also consider the possibility that psychological continuity is irreducibly contingent on the bodily function. Something like a form follows function argument.

"I assume that life is based on "bodily continuity"". The whole point of the other answers is that for computer programs, where a running program is identically it's state snapshot, this notion is perhaps not so psychologically compelling.  In addition, if one needs to kill an AI, it's certainly not a very practical notion of when it is dead.

The distinction between algorithms/robots and humans is that, when the human organism stops functioning, the human is considered dead.
By contrast, an algorithm still exists, even when not running.  (I was going to use "even when not being executed", but avoided this for semantic reasons;)  The algorithm can remain in this "stasis state" so long as there is a storage medium for the information.

Killing an algorithm is easy--delete and empty the trash bin.

Essentially, to kill an algorithm, you need to erase the code that comprises it.

There is no reason to treat hard AI different then humans.
Some people telling that you can make a snapshot of AI but there is no reason to not make a human snapshot also. We dont have technology for that but there is no any magical barrier that would make it impossible (save all biological data and then print your copy somewhere else. Why not?).
Its to early to talk about this as we do not understand our existence (Death term for biological creatures evolving all the time).
I bet that in the future we will merge with AI and the only question will be what death means for any intelligent existence.

I don't really see how this answers the question, though...

Although 'downloading consciousness' is a recurring theme in science fiction and transhumanism, there is currently no compelling evidence to suggest that a state snapshot of an actual human brain is possible. If the small-scale state of the brain is an ingredient in consciousness, then the 'Uncertainty Principle' is likely to be a (possibly terminal) obstacle. In contrast, a state snapshot of a computer program is trivially easy to achieve.

I was trying to implay that there in no difference between AI death and Human death. @NietzscheanAI This principle will also affect hard AI. If there will be trivial way to take a snapshot of an AI it will also apply to human mind. Why do you try to differentiate it?

@Arrekin "If there will be tivial way to take a snapshot of AI it will also apply to human mind.". There is currently no evidence to support this.

@NietzscheanAI Maybe I am wrong but there is no evidence of any kind of existence preserving. So we are just speculating. And what I cannot understand is why people try to differentiate hard AI from humans. Its highly unlikely that we will build some wild AI based on on something different then our mind. We always at first mimicking what nature already invented. Its quite safe to assume that first hard AI will be based on human mind.

It is not speculation to say that I can take a state snapshot of a program. Hence, if AI can be expressed as a Turing Machine program, its state snapshot can be obtained. " Its quite safe to assume that first hard AI will be based on human mind.". There's no basis for assuming that, but even if there were, it doesn't follow that the AI can't be implemented as a computer program.

@NietzscheanAI But with snapshot you are just storing information. Why couldnt you take the same snapshot of human brain? Just go and map all brain then reprint it. It is the same. If you wondering whether it will be same person or copy or anything else then the same questions apply to AI. It will be the same AI? copy? when you take snapshot you can then copy it and run multiple instances, so which one is the original one? Here it comes. The existence and  consciousness problem.

"Why couldnt you take the same snapshot of human brain?" I've explained the distinction as clearly as I can ;-)

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
What's the difference between Starcraft and Dota from an AI perspective?
So, Deepmind is pushing for a human level Starcraft bot and Open AI just created a human level 1vs1 Dota bot.
Unfortunately, I've no clue what that signifies because I've never played Starcraft nor Dota nor do I have more than a fleeting acquaintance with similar games.
My question is what the difference between Starcraft and Dota is from a AI perspective and what scientific significance the respective super human bots would have.

Those AI-learning programs may have very similar scheme. We are changing only inputs and possible actions (like "use skill" or "move here"). Starcraft AI must do a lot of actions and control many units. Dota is MOBA so bot should be good in positioning on map for example. Different opponents to destroy and target for win.
AI needs to play many games for learn to play game with some rules to find best moves in some situations/states.
Of course it's only my newbie-programmer opinion :)

I do think the drive at DeepMind is to morph "strong narrow AI" into Artificial General Intelligence, and games are definitely a way to approach this. In some sense AGI, without reference to "strength" can be regarded as consistent strength across a wide and ever expanding array of contexts.  These context could be as simple as combinatorial games with slight difference in game mechanics, or wildly different games, such as dota2 and Starcraft.  I'm upvoting because this answer is reductionist in a valuable way, getting to the core of the matter.

In SC2, players have more control over every minuet mechanic (constructing buildings, resource mining and management, controlling minions...) in the game, thus putting more tactical responsibility on the burden of the player. In DOTA2, the player is only in control of the super-powered hero itself, and not much of the other aspects of the gameplay.
It is debatable if these options make the game "better" or more difficult as a result. But it is for certain that overall the search space of the problem increases much faster as the dimensions of freedom increases.
Of course, DOTA2 contains very many game mechanics as well (a ton of items that changes a lot of different stats, very many types of heroes which each have their own attacks, a variety of buildings scattered around the map, a shop for player items), but it seems that most of this complexity is focused around player engagements, which although crucial for the development of the game, lets us analyze a much shorter timespan of PvP as opposed to a whole game.
And indeed, the DOTA2 bot from OpenAI was restricted to a mid-lane fight as a singular hero with restricted items, hence restricting most of the complexity DOTA2 has to offer.
Perhaps I am overstepping with this analogy, but the OpenAI result is a bit like a solved chess endgame configuration, while SC2 would be like chess under the knowledge that neither players can see each other's pieces until they are in a position where you can capture them.
In short: SC2 is more tactical. DOTA2 is more arcade-like.

Nice analysis.  Related: https://ai.stackexchange.com/a/3838/1671  (I attempted an answer to a similar question without knowing too much about the dota2 mechanics, and took the line that "assuming both games have similar complexity in terms of mechanics...")


text:
What are the flaws in Jeff Hawkins's AI framework?
In 2004 Jeff Hawkins, inventor of the palm pilot, published a very interesting book called On Intelligence, in which he details a theory how the human neocortex works.
This theory is called Memory-Prediction framework and it has some striking features, for example not only bottom-up (feedforward), but also top-down information processing and the ability to make simultaneous, but discrete predictions of different future scenarios (as described in this paper).
The promise of the Memory-Prediction framework is unsupervised generation of stable high level representations of future possibilities. Something which would revolutionise probably a whole bunch of AI research areas.
Hawkins founded a company and proceeded to implement his ideas. Unfortunately more than ten years later the promise of his ideas is still unfulfilled. So far the implementation is only used for anomaly detection, which is kind of the opposite of what you really want to do. Instead of extracting the understanding, you'll extract the instances which your artificial cortex doesn't understand.
My question is in what way Hawkins's framework falls short. What are the concrete or conceptual problems that so far prevent his theory from working in practice?

The short answer is that Hawkins' vision has yet to be implemented in a widely accessible way, particularly the indispensable parts related to prediction.
The long answer is that I read Hawkins' book a few years ago and was excited by the possibilities of Hierarchical Temporal Memory (HTM). I still am, despite the fact that I have a few reservations about some of his philosophical musings on the meanings of consciousness, free will and other such topics. I won't elaborate on those misgivings here because they're not germane to the main, overwhelming reason why HTM nets haven't succeeded as much as expected to date: to my knowledge, Numenta has only implemented a truncated version of his vision. They left out most of the prediction architecture, which plays such a critical role in Hawkins' theories. As Gerod M. Bonhoff put it in an excellent thesis1 on HTMs,

"In March of 2007, Numenta released what they claimed was a “research
  implementation” of HTM theory called Numenta Platform for Intelligent
  Computing (NuPIC). The algorithm used by NuPIC at this time is called
  “Zeta1.” NuPIC was released as an open source software platform and
  binary files of the Zeta1 algorithm. Because of licensing, this paper
  is not allowed to discuss the proprietary implementation aspects of
  Numenta’s Zeta1 algorithm. There are, however, generalized
  concepts of implementation that can be discussed freely. The two most
  important of these are how the Zeta 1 algorithm (encapsulated in each
  memory node of the network hierarchy) implements HTM theory. To
  implement any theory in software, an algorithmic design for each
  aspect of the theory must be addressed. The most important design
  decision Numenta adopted was to eliminate feedback within the
  hierarchy and instead choose to simulate this theoretical concept
  using only data pooling algorithms for weighting. This decision is
  immediately suspect and violates key concepts of HTM. Feedback,
  Hawkins’ insists, is vital to cortical function and central to his
  theories. Still, Numenta claims that most HTM applicable problems can
  be solved using their implementation and proprietary pooling
  algorithms."

I am still learning the ropes in this field and cannot say whether or not Numenta has since scrapped this approach in favor of a full implementation of Hawkins' ideas, especially the all-important prediction architecture. Even if they have, this design decision has probably delayed adoption by many years. That's not a criticism per se; perhaps the computational costs of tracking prediction values and updating them on the fly were too much to bear at the time, on top of the ordinary costs of processing neural nets, leaving them with no other path except to try half-measures like their proprietary pooling mechanisms. Nevertheless, all of the best research papers I've read on the topic since then have chosen to reimplement the algorithms rather than relying on Numenta's platform, typically because of the missing prediction features. Cases in point include Bonhoff's thesis and Maltoni's technical report for the University of Bologna Biometric System Laboratory2. In all of those cases, however, there is no readily accessible software for putting their variant HTMs to immediate use (as far as I know). The gist of all this is that like G.K. Chesterton's famous maxim about Christianity, "HTMs have not been tried and found wanting; they have been found difficult, and left untried." Since Numenta left out the prediction steps, I assume that they would be the main stumbling blocks awaiting anyone who wants to code Hawkins' full vision of what an HTM should be.
1Bonhoff, Gerod M., 2008, Using Hierarchical Temporal Memory for Detecting Anomalous Network Activity. Presented in March, 2008 at the Air Force Institute of Technology, Wright-Patterson Air Force Base, Ohio.
2Maltoni, Davide, 2011, Pattern Recognition by Hierarchical Temporal Memory. DEIS Technical Report published April 13, 2011. University of Bologna Biometric System Laboratory: Bologna, Italy.

Great answer! I want to add that apparently IBM is giving it a shot now: https://www.technologyreview.com/s/536326/ibm-tests-mobile-computing-pioneers-controversial-brain-algorithms/

Is this answer still current?

@claytond That's a good question, 1 I don't know the answer to. I read up on the latest neural net research every month or so though & haven't seen anything fresh on the topic since this. There's always some fresh news from some unexpected niche of AI that rivets everyone's attention for a few years, so that past ideas are forgotten before they're fully implemented. It's a longstanding pattern. I recently had to explain in CrossValidated why the buzz over fuzzy sets seems to have died way down in the past 10 years - it's basically the same dynamic. Too many promising leads, too little time LOL

10 years to production ready?
Let's put that in perspective. The perceptron was introduced in 1957. It did not really even start to flower as a usable model until the release of the PDP books in 1986. For those keeping score: 29 years.
From the PDP books, we did not see that elaborated as usable deep networks until the last decade. If you take the Andrew Ng and Jeff Dean cat recognition task as a deep network defining event that's 2012.
Arguably more than 25 years to production ready.
https://en.wikipedia.org/wiki/Timeline_of_machine_learning

That is not an answer to the question. Also, we now already have computers that are fast enough for some very impressive AI achievements. But those achievements don't happen in HTM.

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Should I use reinforcement learning to automate the throw of a ball in a Pokemon game?
I am trying to automate the throw of a ball in a game in order to get "Excellent Throw".
To achieve an "Excellent" throw, you need to hit the center of the shrinking target circle when it's at its smallest size. The mechanics involve:
Target Circle: When you encounter a Pokémon, a target circle appears around it, which shrinks and expands. The size of this circle determines the throw bonus:
Large Circle: "Nice" throw
Medium Circle: "Great" throw
Small Circle: "Excellent" throw
Timing: The key to getting an "Excellent" throw is to release the Poké Ball when the target circle is at its smallest.
Accuracy: You need to aim for the center of the target circle to hit the Pokémon accurately.
Examples:

What I would normally do is:
1. Initialize game screen capture.
2. Detect and track the target circle's size.
3. Calculate the optimal release time when the circle is at its smallest.
4. Aim for the center of the circle.
5. Simulate the throw with appropriate speed and trajectory.

The thing is I would need to adjust these for each pokemon, since each one has a different circle. So I was wondering if ML would be preferable in this case scenario and more specifically if RL would be the more preferable choice.
The reward would be of course reading from the screen capture "Excellent!" after the throw.

Why are you worried about need to adjust your algo for each pokemon? The same algo should apply to each appeared pokemon universally once it detects its appearance on the screen. Also note your reward is sparse and binary at the very end of throw assuming the algo only has one chance to throw for each pokemon.

@cinch Because different pokemon have different circles size and distance. The problem is not so much with the circle size but with the distance of the pokemon, so I would need to adjust the velocity of the swipe. Not necessarily binary the reward since I could also provide also rewards with lesser values.
Miss: -1
Normal throw: 0
Nice throw: 1
Great throw: 2
Excellent throw: 3

Yes this is indeed a very plausible approach !
Mind however, that RL is not very sample efficient, so you need a lot of runs for try and error.
So it essentially boils down to the question whether you can provide/simulate a sufficient amount of samples to train the RL agent. If so, then I would recommend you to go with a very simple Q-learning approach. No deep neural networks are needed here.

I could provide samples as I am playing. I was thinking basically to start with random throws and adjust the aim and velocity as I go accordingly to the Q-table.


text:
How exactly is the dynamical unfolding implemented in ByteNet?
I am thinking about making use of ByteNet (https://arxiv.org/abs/1610.10099) architecture for a project, and would like to get a better understanding of how the model works.
I've read through the paper about a million times, but can't figure out how exactly the dynamical unfolding is implemented.
I understand that the input sequence is mapped to a longer intermediate representation, whose length is a function of the input length, but don't understand how 1×1 convolutional layers are able to do this.
I am also unclear on how input sequences can be of variable length without any recurrence.
Any help would be appreciated! Or of anyone knows of any good YouTube videos that explain it, that would also be helpful.

Could you please create a post for each of your specific questions and put your specific question in the title? Thanks. I think that will help people to focus on one problem at a time.

It seems you main question is about the mechanism of variable input length handling of a series of 1d convolutional layers. This is mainly due to the mechanism of the 1d convolutional layer which avoids the limitations associated with RNNs like fixed-length inputs or the need for padding to a common length.

The encoder processes the source string into a representation and is formed
of one-dimensional convolutional layers that use dilation but are not masked.

1d convolution aka cross correlation in ML is like dot-product operation between the 1d filter and the 1d input sequence in a consecutive sliding-window fashion. Often the input sequence will have multiple input channels aka feature dimensions and we can convolve each channel separately and add up the result using a different 1d filter for each input channel. This outputs a 1d vector of the same length as the input sequence which encodes the input assuming we ignore any potential boundary effect. Therefore in this way ByteNet's encoder can handle variable length sequence which is very similar to the usual 2d convolution for CNNs to be capable of handling variable length image input.
Finally the non-masked dilations between each 1d convolutional layer in the encoder network exponentially grows the region of the input that influences a neuron in a convolutional layer which is called receptive field, so the encoder can capture long range dependencies in a possibly long input sequence.


text:
How do you fine-tune a LLM in theory?
What does it mean to fine-tune a LLM? What can be accomplished with fine-tuning?
I am working on cleaning up messy text (call it tweets) into short clean summaries. How can I take advantage of fine-tuning an LLM like LLaMa 3.1 or any of the other ones out there, to improve the quality of the results?
I am not looking for specific code, but just trying to get a vision of what is theoretically possible.

How much "training data" do I need? I've seen people throw around "you need 1000's of examples", examples of what? What do I send to the LLM exactly? (In my case, these tweets to be summarized).

I'm wondering if it's worth my time to try and fine-tune a model somehow, given it's just me (solo developer). Or if my time is better spent elsewhere. From my limited knowledge, creating 1000's of examples of tweets and their summaries would take weeks of 8-hour long grinding days, which I just don't have the energy to do. I can code all day, but manually writing the quality summaries to create 1000's of test cases would be energy-draining for sure.
Is that what fine-tuning means? I am new to the idea of fine-tuning. Looking to shed some light on what it is and what I can do with it (and roughly how to fine-tune at a high level).

You can try synthetic data augmentation technique to generate more data, or for a small data set you can use feature extraction transfer learning to add new layers upon a frozen pretrained model instead of fine tuning with usually very small learning rate and require large amount of data like 1000+ in your case.

You won't be able to fine-tune on Groq. But you can upload your own model, which, of course, you can fine-tune beforehand.
Fine-tuning is a process whereby you provide the already trained LLM with additional data and train it further. In order to be able to update the model, at least some layers need to be unfrozen, i.e. their weights are not locked. Typically you would unlock the last couple of layers, keeping the rest of the model weights frozen, before training on the new data. The new model benefits from the general knowledge of the base model, but will hopefully be more attuned to the use case embodied in your new data. The more layers you unlock, the more data you will require to achieve good results.
There are various forms of fine-tuning. With supervised fine-tuning, you provide labelled data. With instruction fine-tuning, your labelled data matches instructions that your LLM should understand. In your case, you would provide a prompt for the action of summarising the tweet, an example tweet and an example clean summary. As @cinch said, you will want synthetic data for this. This can either be from a dataset with clean tweets, which you mess up in a similar fashion to your target dataset; generated by ChatGPT or another LLM; manually curated; or a combination of methods.
You may be able to split the process into cleaning and summarising. In this case you would fine-tune two models, one on each task.
If you want to get an idea of the effort involved, HuggingFace has a tutorial


text:
How can you calculate the amount of FLOPS required to process, given model data, a prompt length and an answer lenght?
I wanted to calculate the rough number of floating point operations (or float multiplication) that is required to generate a response to a prompt.
I am using llama 3.1, 70B as an example:
    prompt length (using words instead of tokens for simplification): `What's the capital of russia`=>5

    answer length: `the capital of russia is moscow` => 6
    embedding size=8192
    number of layers=80
    number of heads=64

and so the amount of flops should be something like

Single QVK Generator Network Number of weights=(8192/64)*(8192/64)=16’384=>16’384Flops per generator

number of QVK Generators=80*64=5120=>16384*5120=>83886080 Flops per token for QVK

dense network num weights=8192*8192=67108864

num dense networks=80=>67108864*80=5’368’709’120 Flops per token

attention calculation=(num_tokens^2*8192)*2*80

totaling(num_tokens) (for 1 single inference)=(5’368’709’120+83’886’080)*num_tokens+(num_tokens^2*8192)*2*80

and since we have to do this multiple times (one for each token of the output), this is the total amount of tokens

    totaling(num_tokens) for num_tokens in {6,7,8,9,10,11}

which gets me 279’116’840’960 FLOPS. Which I have no idea to verify, but it seems like an insane number of flops. Can someone tell me if and where I've made a mistake?


text:
Why exactly do we need the learning rate in gradient descent?
I am currently following course 1 of Andrew Ng's Machine Learning Specialization. I understood we need a convex cost function to reach the global minimum of the loss. But that means the gradient will reduce and approach 0 by itself as long as we choose a convex function.
Then what is the need of the learning rate?
My intuition tells me its an additional measure to give us more control in training the model, but I want a proper answer and evidence to solidify my understanding.

Just pointing out a misconception in the question: It is not true that gradient descent with a fixed learning rate will converge, even for a convex function. Consider $f(x) = x^2$ with learning rate 10 and starting point $2$. The sequence of iterates is $-38, 722, \ldots$. Generally you need a condition like $\eta < 2/L$, where $L$ is the Lipschitz coefficient

@ChrisCundy by η do you mean the learning rate? I was accustomed to alpha so trying to confirm.

Yes,  is another variable typically used for the learning rate

In short, there are two major reasons:

The optimization landscape in parameter space is non-convex even with convex loss function (e.g., MSE). Therefore, you need to do small update steps (i.e., the gradient scaled by the learning rate) to find a suitable local minimum and avoid divergence.

The gradient is estimated on a batch of samples, which does not represent the full let's say "population" of data. Even by using batch gradient descent, which uses the full dataset each step, the resulting gradient does not point in the direction of the true gradient. So you need to introduce a step size (i.e., the learning rate.) Moreover, at least in principle, it is possible to correct the gradient direction by including second order information (e.g., the Hessian of the loss w.r.t. parameters) although it is usually infeasible to compute.

Point 1 doesn't really have anything to do with non-convexity, GD can diverge even on a simple 1D convex function like $x \mapsto x^2$ if the learning rate is too high. In fact, if anything, non-convexity is a reason to use larger (and/or stochastic) steps, at least at first, to avoid converging on a poor local minimum near the starting point.

@leftaroundabout My point was to explain that with a step size of 1, the optimization is really unstable unless the problem is trivial, because the updates are just too large. Indeed, in DL, to avoid premature convergence and ensure stable training you need at least a well-designed architecture with suitable weights initialization, a learning rate schedule, gradient clipping, and some regularization as well. But all of these are outside the scope of the question.

@LucaAnzalone he is saying that even in trivial cases you need a stepsize, the only case where you don't need it, is if the conditioning of the problem is 1, but your point is valid, just maybe too specific

Indeed your intuition of Learning rate is right regarding its additional control in training the model, and the precise terminology for your somewhat vague 'additional control' intuition even in a convex loss landscape is called hyperparameter or tuning parameter in ML which specifies details of the learning process in contrast to parameters which determine the model itself, such as learning rate, momentum (Adam, Nesterov), batch size, regularization strength, etc. Specifically the linked reference clarifies the necessity of your concerned learning rate hyperparameter as follows.

Since it influences to what extent newly acquired information overrides old information, it metaphorically represents the speed at which a machine learning model "learns"... In setting a learning rate, there is a trade-off between the rate of convergence and overshooting. While the descent direction is usually determined from the gradient of the loss function, the learning rate determines how big a step is taken in that direction... In order to achieve faster convergence, prevent oscillations and getting stuck in undesirable local minima the learning rate is often varied during training either in accordance to a learning rate schedule or by using an adaptive learning rate.

Usually a fixed learning rate is set very small to ensure convergence, however, in practice a learning rate schedule is often used by decay and momentum which help faster convergence and prevent oscillations as discussed in my answer to another post.

Your intuition is correct and the short answer is: The learning rate is necessary in order to control the size of the update!
You probably already know that gradient descent (GD) is derived from the [Newton-Raphson algorithm] (https://en.wikipedia.org/wiki/Newton%27s_method "or Newton's method").
In Machine Learning applications, the learning rate in GD plays the same role as the second order derivative which encodes the curvature information. To be more explicit, let's consider two convex functions (which, if you know your math, have positive second derivatives), $f_{1}(x) = 2x^{2}$ and $f_{2}(x) = \frac{x^{2}}{2}$.
We can see that their gradient and second-order derivative are: $(f'_{1}(x) = 4x, f''_{1}(x) = 4)$ and $(f'_{2}(x) = x, f''_{2}(x) = 1)$.
Now, if we consider the Newton-Raphson algorithm, then we see that:
$x_{k+1} = x_{k} - \frac{f'_{1}(x_{k})}{f''_{1}(x_{k})} = x_{k} - \frac{4x_{k}}{4} = x_{k} - \frac{f'_{2}(x_{k})}{f''_{2}(x_{k})} = x_{k} - \frac{x_{k}}{1} = 0, \;\forall x_{k}\in\mathbb{R}$.
We can see that the second order derivative rescales the gradient so that $\forall x_{k}\in\mathbb{R}$, the update always takes you directly to the minimum (this works in one step because the functions are quadratic. When the function is not precisely quadratic, the algorithm will take more iterations, but will converge similarly to the minimizing solution).
Hence, in the case of $f_{1}$, the scaling factor $\frac{1}{f''_{1}(x_{k})} = \frac{1}{4} = \alpha^{*}_{1}$ and for $f_{2}$, the scaling factor $\frac{1}{f''_{2}(x_{k})} = 1 = \alpha^{*}_{2}$. These represent the optimal learning rate values $\alpha^{*}_{1}$ and $\alpha^{*}_{2}$ for each function.
But, what if instead of these values we used values that are smaller or larger? Well, let's see:

Let $\alpha_{1} = \frac{1}{6} < \alpha^{*}_{1}$, then:
$x_{k+1} = x_{k} - \frac{4x_{k}}{6} = x_{k} - \frac{2x_{k}}{3} = \frac{x_{k}}{3} \neq 0$. However, since this will be the case for every time step $k$, the update rule will give you a geometric progression (e.g. if we start with $x_{0} = 1$, then $x_{1} = \frac{1}{3}$, $x_{2} = \frac{1}{9}$, $x_{3} = \frac{1}{27}$, $\cdots$, $x_{k} = (\frac{1}{3})^k$. If $k$ is large enough, then the final solution will be very close to 0, i.e. $k\to\infty \implies x_{k}\to 0$). Hence, quite intuitively, a smaller learning rate leads to a slow convergence.
Let $\alpha_{1} = \frac{1}{2} > \alpha^{*}_{1}$, then:
$x_{k+1} = x_{k} - \frac{4x_{k}}{2} = x_{k} - 2x_{k} = -x_{k} \neq 0$. As can be seen, this does not converge at all to the optimal solution, 0! In fact it oscillates back and forth between $x_{0}$ and $-x_{0}$. This is a divergent progression! In fact, if we chose $\alpha_{1} = \alpha^{*}_{2} = 1 > \alpha^{*}_{1}$, then: $x_{k+1} = x_{k} - 4x_{k} = x_{k} - 4x_{k} = -3x_{k} \neq 0$. which implies a geometric progression with ratio $r=-3$ which is divergent. Hence, a larger learning rate leads to divergence.

In summary, the learning rate scales the gradient in order to control the amount of change in the optimized parameters at every step and it plays the same role as the second order derivative, i.e. it is an estimate of the function's curvature information or shape. If properly estimated, then the algorithm will converge quickly. If underestimated, the convergence will be slow (but guaranteed to converge after a potentially large number of updates). If overestimated, the algorithm will overshoot and diverge, never settling down to a specific value.
P.S.: Chris Cundy mentions in his comment the Lipschitz coefficient and in general, you want your learning rate to satisfy $0 < \alpha < \frac{1}{L}$ where $L$ is the Lipschitz coefficient. This is also related to the second order derivative information and is valid for functions Lipschitz continuous gradients (this connects to L-smoothness). Indeed, if $f(x)$ is twice differentiable and if there exists $L < \infty$ such that its Hessian matrix (second order derivative) has a bounded spectral norm, i.e. $||f''(x)|| \leq L$, then $f(x)$ has a Lipschitz continuous gradient with Lipschitz constant $L$.
I recommend checking the theorem 3.4. in [1] https://gowerrobert.github.io/pdf/M2_statistique_optimisation/grad_conv.pdf


text:
What is the reason for the difference between the expected input tensor order for LSTM and Conv1d?
What is the reason for the difference between the expected input tensor order for LSTM and Conv1d?
Say I have an input tensor for time series data of shape (Batch Size, Sequence Length, Features). If I wanted to pass this into an LSTM layer I just add batch_first=true and I'm good to go. However, if I wanted to perform a temporal convolution I would need to run permute(0, 2, 1) before the conv1d layer. Likewise, I would need to perform permute for the LSTM if I had the data input the other way around.
It would seem to be that these layers, despite working on the same kind of data, expect different input shapes.


text:
Is there any AI trained in algebraic simplifications of symbolic expressions?
Is there any artificial intelligence specifically trained in algebraic simplifications of symbolic expressions?


text:
How do I improve the prediction speed of a model?
I have  a use-case where we need a classifier to take decisions in real time, meaning that as data arrives, we need to decide to which category that data belongs and it has to be done fast. The better the classifier's accuracy, the slower it seems to be. Is there a library or type of model you recommend for this sort of problem? I.e. a time constrained classification.

If you have tabular data (vectors of features) you can opt for a logistic regression which is quite cheap to compute, or a shallow decision tree. Moreover, decision trees can be further pruned to reduce their complexity.
Otherwise, if your data is more complex (e.g., images, audio, etc) you probably need a neural network. If so you can optimize, i.e., compress or accelerate the model via weight or activation quantization (e.g., to fp16 or int8 precision) - there are libraries to do this, like tensorflow-lite, DeepSpeed, PyTorch built's in methods, and OpenVINO to name a few.
There are also more sophisticated optimizations that are hardware related, i.e., you can optimize your neural net for CPU with Intel's specific stuff (now I don't remember how it is called), or use CUDA for Nvidia GPU acceleration. Things can be pushed even further by deploying your ML model on a FPGA accelerator: one solution is through HSL4ML library.

Hello @Luca Anzalone. Thank you for your comment. Yes, we tried shallow decision trees, but it turns out that the performance degrades significantly when you make them shallow, we see an acceptable performance with a depth of 10. We did not try a logistic regression, but we have never used that. You mean some sort of hyperplane to split our categories? That might not perform well though, because yes our data is probably complex.
I see, we might try tensorflow with the neural network. Bear in mind though, that our datasets are only about 10K-20K samples and we have around 10-15 features.

@acampove If so, you can try a SVM classifier maybe some light implementations. Also, you can look at CUDA-enabled xgboost and/or LightGBM that run on GPU.

so the GPU part helps not just in the training but also in the prediction?

@acampove Well, the LightGBM docs says that GPU speeds up the feature histogram computation during training, whereas, the XGBoost ones state that "Most of the algorithms in XGBoost including training, prediction and evaluation can be accelerated with CUDA-capable GPUs." I think you should benchmark the GPU vs CPU for inference (i.e., prediction) to be 100% sure


text:
What do we mean by "AI is correlated"?
From Wikipedia

Causal AI is a technique in artificial intelligence that builds a causal model and can thereby make inferences using causality rather than just correlation. One practical use for causal AI is for organisations to explain decision-making and the causes for a decision.

Are the AI like LR, SVM or ANN correlated? If yes, how come?

The statement does not say that "AI is correlated" but that "they make inferences using correlation". So, maybe this question should be reformulated. Also, can you please provide the link to where we can find the quoted text?

I've tried to save this question by making some assumptions about what you really want to ask and about the source of the quote, but please next time do try to write a clearer question and provide the link to the article that you're quoting.

Most predictive machine learning, that creates model with input and output, is completely agnostic to how or why two the two sets of variables (inputs and outputs) are linked.
As such the model learning process will use any observed correlation between inputs and outputs observed to inform the learning process and reduce loss.
This doesn't prevent the process creating an approximate causal model. However, unless you put the effort in to uncover causation and structure the learning process to model it, then you cannot tell.
This problem is not limited to machine learning. It's a common issue in scientific studies of all kinds, and you will often hear the warning "correlation doesn't imply causation", when e.g. studies show people who eat a particular diet have a certain incidence of an interesting health outcome. It is rarely strong proof that the diet causes the health issue, at least not on its own.
To answer your question more directly, then yes most uses of ML build models of correlation. However, this is not really a model class issue. You could structure experiments and data collection to isolate causation using many of the same model types.

An example may clarify.
When more sunscreen is purchased, more swimsuits are purchased. This does not mean, however, that the sunscreen seeps into our skin, makes its way to our brain, and tells us to buy swimsuits. There is another underlying factor at play: it is summer, so people are going to the beach and the pool a lot and need both sunscreen and new swimsuits. That is, there is a mere correlation between sunscreen sales and swimsuits sales, nothing causal.
Nonetheless, if you, for whatever reason, did not have access to a calendar or a thermometer, if you wanted to know when your clothing store should have a large inventory of swimsuits, an uptick in sunscreen sales might be a reliable predictor of the demand for new swimsuits. That is, despite the lack of a causal mechanism between the sunscreen and the swimsuits, you might be able to have a reasonably accurate predictive model (a simple form of AI/ML) using sunscreen to make your predictions about swimsuits.
Note, however, that if it became popular to wear sunscreen all year and not just in the summer (this was recommended at my last physical), such a predictor about swimsuits would fail to make good predictions about swimsuit demand when summer hits, since sunscreen is not the true causal mechanism. Nonetheless, the mere correlation may be a reliable predictor in many cases and may be the best you can expect to get in a complicated situation.


text:
Why can't we use only keys to calculate self-attention?
I was reading about the self-attention mechanism and the paper suggests to have 3 things to be computed: Key, Query and Value. As far as I understood the reason for having Value is to allow adjustments to the initial embedding (after the positional encoding) depending on the context (that's intuitive). However, I don't get why we need the Query there. Why can't we do the similarity calculations using only the Keys?

I remember a student asking this question when I first learned about transformers. The professor responded that while this is possible, empirical performance is better if they are separate.


text:
Should the experience replay memory only contain unique experiences?
I'm training an RL agent/model (DRL/DQN).
Say that, for each learning step, the memory replay used by the agent to learn, has N elements (experiences) stored, where only X are unique elements (experiences), meaning X <= N.
Would it be beneficial for the agent to sample from the whole memory or from a memory with unique elements?

This question is related to some unresolved issues in reinforcement learning with approximation.
The following is a partial answer, but is the advice you should initially follow, unless you have a clear goal for doing otherwise:
A neural network approximation function, like the Q network in DQN, is sensitive to the distribution of examples. For the best accuracy metrics (lowest loss) on test and unseen data the samples should be learned with the same distribution as they will be seen when using the learned function. So the replay memory should not have its distribution modified.
Provided the samples from the replay memory follow a distribution close to the real distribution, then your loss objective will work effectively to produce accurate value estimates. So you could compress the results, provided you weighted the sampling to match what was observed.
However, it gets more complex than this in practice:

Off-policy samples are not in the same distribution as the target policy anyway. This is one reason you should use a relatively low $\epsilon$ when using Q learning with approximation.
Further to that, only training with the exact correct distribution from the optimal policy can risk catastrophic forgetting, where the network loses generalisation to any other policy choices, and can more easily make mistakes because it cannot tell when choices are bad.

There are a few different approaches to address catastrophic forgetting in reinforcement learning, but the basic message is that the "correct" balance of training data to most usefully train a Q function approximation is not fully resolved. This won't really impact your decision to de-duplicate the states - you probably shouldn't, or rather it won't be worth the effort. It does mean it could be worth experimenting a little with what data does go into the memory, and how it is sampled. I had some success on simple problems by keeping 10% of the memory for "long-term" memory of poorer policies, to stabilise the approximation so it can predict what the bad decisions are regardless of what the most recent policies have sampled.

It's so funny to read how they say that the state distribution should be as close as possible, and anybody with some RL notion considers DQN as "off policy"


text:
Can you claim copyright over a social media post that is used to train an AI model?
Can user-generated content from social media platforms be considered copyrighted training data for AI models, despite agreements between the platforms and AI companies (note that the users themselves have no agreement with the AI company)?
What if an AI model's output is very similar to the training data ingested from this source. Can that output be considered copyrighted?
Are there first-principle arguments for the same, and is there some part of the technical process of training a model that can help navigate this?
What about the argument that if the model has spat out something very similar to the source it has been trained on, the original source did not have much (or any) creative content to begin with, therefore not allowing for copyright in the first place?

There is no general answer to this question, but usually application of copyright law won't help by itself.
Many social media sites, especially ones with free access, have rights to reuse your data, that you will have agreed to in order to use the service. Those will generally be written so that any agreements the media companies then make onwards to sell or give away your generated content are valid. However, some more general rights like those addressed in Europe's GDPR might conflict for some kinds of data.
Whether you have any legal standing or rights over content you posted is going to depend on the specific social media service, the content, and the AI service in question. If you have those details, then you may be able to ask a more concrete question. If there's anything serious at stake you will need to involve a lawyer. If you want to get a more open opinion on your rights and options for a specific case, you could ask elsewhere, e.g. on Law Stack Exchange.
There are some grey and unresolved legal areas around non-consensual data harvesting used to train generative models. Some large cases may be decided one way or another (which you could use to approximately assess your own cases if they are similar), and there is also the possibility of new laws that give more precise answers in future.


text:
Advice on Handling Variable Input Sizes in a Neural Network Model for Predicting Football Match Outcomes
I am developing a machine learning model aimed at predicting football match outcomes based on past team performances. The model incorporates data from the last 10 home games for the home team and the last 10 away games for the visiting team, in addition to all past confrontations between the two teams, regardless of the number. However, I am facing a few challenges:
Missing Data: Sometimes, a team hasn’t completed 10 previous matches before the given match.
Variable Number of Past Direct Confrontations: The number of times the two teams have previously faced each other varies, with some pairs never having met before.
How can I structure my neural network to accommodate these inputs with variable sizes? Are there specific techniques or methods for integrating this kind of uneven or missing data effectively without impairing the model's performance?
Any advice or resources you could recommend would be greatly appreciated.

You can simplify things by introducing a home advantage as the square root of the average number of home goals divided by the average number of away goals in one season. You can then normalize the outcome to one on neutral ground. You should, however, take into account that the home advantage is constantly decreasing for all professional soccer leagues (and probably others).  So if you train your model with long-term data, you should estimate the home advantage with a linear regression first.

Have you considered RNN's? Would that work?


text:
Should batch normalization be used before or after, when using sigmoid or tanh?
This prior post discusses Batch-norm with Relu ordering.
I have a similar question but pertaining to sigmoid or tanh kind of activation functions. Should batch-norm be used before or after? Is there a difference?

We add the BN transform immediately before the nonlinearity, by normalizing x = Wu+ b. We could have also normalized the layer inputs u, but since u is likely the output of another nonlinearity, the shape of its distribution is likely to change during training, and constraining its first and second moments would not eliminate the covariate shift. In contrast, Wu + b is more likely to have a symmetric, non-sparse distribution, that is “more Gaussian” (Hyvarinen & Oja, 2000); normalizing it is likely to produce activations with a stable distribution.

^ Quote from the original BN paper. In the BN paper they seem to have the batch-norm before the sigmoid and evaluate it on MNIST dataset and show improved results.

It may be more appropriate after the activation function if for s-shaped functions like the hyperbolic tangent and logistic function.

^ However, this BN article claims that putting BN after sigmoid might be better. Doesn't give any justification...
Does anyone know the difference/have mathematical justification? If you put ordering as (Linear->BN->Sig) then the bias term in the linear layer and the BN can cancel out and makes training faster. But (BN->sig) would mean that the discrimination from sigmoid is less contrastive. This means that you would not have as much confidence in the 'on/off'-ness of the activation?
In my current use case, I see that BN after (LL->Sig->BN) is improving my results. I do not understand any why.
I wrote this code to visualize some differences. I understand why the output looks as it does, but I do not understand how it carries over to the learning process.

import numpy as np
import matplotlib.pyplot as plt
import torch
import torch.nn.functional as F

# Generate a random uniform distribution D
np.random.seed(0)
D = np.random.uniform(-3, 3, 1000)

# Function to apply sigmoid and layer normalization
def sigmoid_then_layernorm(data):
    sigmoid_data = torch.sigmoid(torch.tensor(data, dtype=torch.float32))
    layernorm = torch.nn.LayerNorm(sigmoid_data.shape)
    normalized_data = layernorm(sigmoid_data)
    return normalized_data.detach().numpy()

# Function to apply layer normalization and then sigmoid
def layernorm_then_sigmoid(data):
    data_tensor = torch.tensor(data, dtype=torch.float32)
    layernorm = torch.nn.LayerNorm(data_tensor.shape)
    normalized_data = layernorm(data_tensor)
    sigmoid_data = torch.sigmoid(normalized_data)
    return sigmoid_data.detach().numpy()

# Apply both methods
sigmoid_then_layernorm_data = sigmoid_then_layernorm(D)
layernorm_then_sigmoid_data = layernorm_then_sigmoid(D)

# Plot the distributions
plt.figure(figsize=(14, 6))

plt.subplot(1, 2, 1)
plt.hist(sigmoid_then_layernorm_data, bins=50, alpha=0.7, label='Sigmoid then LayerNorm')
plt.title('Sigmoid then LayerNorm')
plt.xlabel('Value')
plt.ylabel('Frequency')
plt.legend()

plt.subplot(1, 2, 2)
plt.hist(layernorm_then_sigmoid_data, bins=50, alpha=0.7, label='LayerNorm then Sigmoid')
plt.title('LayerNorm then Sigmoid')
plt.xlabel('Value')
plt.ylabel('Frequency')
plt.legend()

plt.tight_layout()
plt.show()

# Generate a normal distribution D
D = np.random.normal(0, 1, 1000)

# Apply both methods
sigmoid_then_layernorm_data = sigmoid_then_layernorm(D)
layernorm_then_sigmoid_data = layernorm_then_sigmoid(D)

# Plot the distributions
plt.figure(figsize=(14, 6))

plt.subplot(1, 2, 1)
plt.hist(sigmoid_then_layernorm_data, bins=50, alpha=0.7, label='Sigmoid then LayerNorm')
plt.title('Sigmoid then LayerNorm')
plt.xlabel('Value')
plt.ylabel('Frequency')
plt.legend()

plt.subplot(1, 2, 2)
plt.hist(layernorm_then_sigmoid_data, bins=50, alpha=0.7, label='LayerNorm then Sigmoid')
plt.title('LayerNorm then Sigmoid')
plt.xlabel('Value')
plt.ylabel('Frequency')
plt.legend()

plt.tight_layout()
plt.show()


text:
How do transformer models handle negation in sentiment analysis
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 "The movie is not good."
A simple model using word embeddings + global averaging fails to handle negation properly. Intuitively, for example, if "good" has a positive sentiment score and "bad" has a negative sentiment score, a model might misinterpret "not good" by simply averaging the scores of "not" and "good".
Example Without Negation
Consider the following sentences with sentiment words:

"The movie is good."
"The movie is awesome."
"The movie is terrible."

Suppose we have the following word embeddings representing sentiment scores:

"good" = [10]
"awesome" = [12]
"terrible" = [-10]

Neutral words (assuming embeddings around 0):

"the" = [0]
"movie" = [0]
"is" = [0]

For these sentences, a simple global average of the sentiment scores works well:

"The movie is good" = average([0, 0, 0, 10]) = 10 / 4 = 2.5 (positive sentiment)
"The movie is awesome" = average([0, 0, 0, 12]) = 12 / 4 = 3 (positive sentiment)
"The movie is terrible" = average([0, 0, 0, -10]) = -10 / 4 = -2.5 (negative sentiment)

Example With Negation
Now, consider the sentence "The movie is not good." In this case, the sentiment should be negative due to the presence of "not." However, averaging the scores naively might not handle this correctly. For example:

"The movie is not good" = average([0, 0, 0, -5 (for not), 10 (for good)]) = (0 + 0 + 0 - 5 + 10) / 5 = 5 / 5 = 1 (incorrectly positive)
"The movie is not bad" = average([0, 0, 0, -5, -9]) = (0 + 0 + 0 - 5 - 9) / 5 = -14 / 5 = -2.8 (incorrectly negative)

How Transformers Handle Negation
Can someone explain, with a concrete example, how a transformer model like BERT or GPT can correctly understand and model negation in a sentence? Specifically, I'm interested in:

How the self-attention mechanism captures the relationship between words like "not" and "good".
An example with numerical values to illustrate the process.

To answer this question, it makes sense to go over how multi-headed self attention works. Say we have 2 heads defined as follows (I am leaving small details out for simplicity):
$$W_q^1, W_k^1, \text{ and } W_v^1$$
$$W_q^2, W_k^2, \text{ and } W_v^2$$
where the superscript defines the head number. We also have our token embeddings  $X$, for our sequence.

We multiply our embedding by each of the previously defined matrices to get our query, key, and value features for each head.

\begin{align}XW^i_q &= Q^i \\ XW^i_k &= K^i \\ XW^i_v &= V^i\end{align}

We then preform the dot product attention between the key and values of each head

$$E^i=Q^i K^{i \top}$$

We then apply softmax row-wise to get our attention scores

$$A^i=softmax(E^i)$$

Then, using each row of attention scores, we get the linear combination of the corresponding value vectors in $V^i$

Then, to combine the outputs from each head, we concatenate or average the head outputs.

Finally, we throw these vectors into a linear layer, so that our final representation can encapsulate all the nuance that exists in the outputs from the two heads.

$\textbf{The answer to your first question specifically pertains to the fourth step.}$ In that the attention scores that we created encapsulate the relationships between words, our value vectors hold the meaning to the words, and our linear combination creates a representation, from these aforementioned components that encapsulates the negation of some word. The ability of any transformer-based architecture, with appropriate regularization, to do this increases as we stack these multi-headed attention blocks on top of each other.

thank you Jayson. I already read a lot about the theory of how the attention mecanism and a transformer work. But i need a concrete example. That is why i used some fictives numbers. Could you use some concrete fictive numbers for QKV ?

I don't think it would be a good idea to just come up with a fictive example.  Rather, why don't you just grab a pretrained language transformer, plot the value vectors, and inspect how the attention scores interact with the value vectors to create expressive representations yourself, so you know exactly what's going on.

Additionally, I think AttentionViz -- https://attentionviz.com/ -- might help you accomplish this quite easily


text:
How to calculate the gradient for the output with respect to the input pixels
Hi for my project I'm using a somewhat simple CNN consisting of several convolution layers and pooling layers. Essentially the model is trained to perform a blur of sorts on an input image.
For my project the gradients of the output pixels with respect to the input pixels is very important. I'm aware of how to get gradients for the output with respect to weights. But I am not sure how to do it with respect to input pixels.
Basically it will tell me how changing an input pixel effects the output!
I'm currently using pytorch but I dont mind using any package that could give me this functionality.

"But I am not sure how to do it with respect to input pixels." the same way you do it for the weights... you take your input tensor, you set requires_grad to True, you do the forward pass thus having an output $y = f(x)$, and you just do y.mean().backward(), and your input tensor will have the gradient saved in


text:
Is it possible to use attention layer as a sort of filter of input data before passing it further to the network?
Is it possible to use attention layer as a sort of filter of input data before passing it further to the network?
Is it possible to use it to reduce the dimension of the input (similar as PCA, for example - only attention layer would be trained with the network) and therefore reduce the network architecture (for example we can use network which accepts smaller input dimension)?
I can't find decisive sources on that matter.

It's of course possible to reduce dimension using attention mechanisms, for instance by just setting a lower output dimension.  However, it's not obvious in the general case, as to why the processing provided by an attention layer should provide a good trade-off compared to other sorts of processing that can reduce dimension (like an ordinary dense layer plus activation).
Ordinarily, and perhaps almost exclusively in current research, attention is used with some idea of gathering or reorganizing information across sequence, time or space, or between different sources or types of information such as in cross attention.  This might be because the similarity scores after projections could be just about anything.  If you were to divide up data between different chunks, it could provide a weighting of the chunks.  Depending on your data, perhaps this could be helpful, but so could a more ordinary approach.
A quick search was able to find a reference to a paper which uses cross attention to help with dimensionality reduction and refers to it as Attention Feature Filters.  However, it should be noted that a separate feature is used to inform whether or not a feature is relevant.
To summarize, feel free to experiment, but I would suggest first trying a more simple baseline approach unless there's additional data to inform the attention weights.