# How does one program an AI?

My team of researchers has created an AI to increase human suffering and the machine has started earning money on the market. The ministry of economics has sent a technician to review the machine and see if it can be used on a wider scale. I want to see if a specialist would detect such a "defect"

Do AIs have vague objectives programmed into them, like "increase human suffering"?

If not, how could a reviewer detect that an AI is programmed to do so? edit: provided that the AI doesn't try too hard to hide the fact but also doesn't make it apparent

• This almost seems like a question for ai.stackexchange.com – mbomb007 Jan 26 '17 at 19:01
• – JDługosz Jan 26 '17 at 20:59
• Comments are not for extended discussion; this conversation has been moved to chat. – HDE 226868 Jan 28 '17 at 16:11

The purpose of AIs is to permit increasingly vague instructions. "Typical" computer programs need extremely precise instructions and they are followed without error. Modern AI's are typically given "goals" which are used to train the AIs, but they are more specific than "increase human suffering." Future AIs are theorized to be able to accept more vague goals like you describe. Your task may call for a AGI (Artificial General Intelligence), which is the name given to the yet-undeveloped AIs which are at least as intelligent as a human being.

You cannot actually detect what an AI is programmed to do. That's somewhat to their nature of operating on less precise instructions. What you can do is look at the training set they were given and draw conclusions from that.

A great example of this is a famous neural network. It was given a grid of dots as an input (7x7 grid I believe), each of which can be "lit" or "unlit," and its output was a "Yes" or "No." This network was trained first by giving it a series of 7x7 images of arrows pointing to the left. They looked something like this:

  Left Arrow            Not arrow(example)
. . . # . . .         . . . . . . .
. . # . . . .         . . . . . . .
. # . . . . .         . . # # # . .
# # # # # # #         . . # . # . .
. # . . . . .         . . # # # . .
. . # . . . .         . . . . . . .
. . . # . . .         . . . . . . .


It was trained until it could reliably recognize the difference between a left arrow and a non arrow. Then, it was given a training set that included arrows to the right. Predictably, it did not recognize this as a left arrow, so it outputted "No." However, after more training it started recognizing both left and right facing arrows. Then we gave it an arrow facing up, and trained it until it could recognize upward arrows. Then downward. Each one proved easier to train than the last, almost like it was "recognizing" arrows.

Then the interesting challenge: we gave the AI a set of diagonal arrows. On a 7x7 grid, these look quite different than horizontal or vertical arrows. However, the neural net responded "yes" to them. It had learned the abstract concept of "an arrow" and responded to a novel stimulus accordingly.

If you looked at the weights on that neural network, you would never be able to distill from it "the AI is looking for arrows." Neural network weights are almost impossible for us to decipher. And, if you looked at the training set, you could see that it was being trained to recognize horizontal and vertical arrows. However, what you could not discern was whether it had learned to recognize horizontal and vertical arrows, or if it had somehow learned the abstract idea of "arrows in any direction." Or maybe it has learned "shapes that can be decomposed into three lines." The only way to tell that was to test it -- give it a diagonal arrow and see what it did with it.

• It might be worth mentioning that it is impossible to fully rule out the possibility of an arbitrary AI suddenly trying to kill all humans due to the impossibility of solving the halting problem. If you had a general way to determine if a AI will ever enter a particular state, you could use this method to determine if it reaches a halting state. – Shufflepants Jan 26 '17 at 19:38
• What you are describing here is called deep learning; This is not necessarily the only way to train an AI and definitely would not satisfy my criteria for a question asking about programming something, as in writing code - the programming of an AI would be the framework allowing for the AI to be trained to understand & abstract things, as well as the program code that defines how the AI would be able to interact with the world outside it's own routines. :/ – dot_Sp0T Jan 26 '17 at 19:46
• @Shufflepants It may be possible. There really isn't an obligation that an AI be Turing complete. In fact, technically no computer is actually Turing complete because Turing completeness is a feature of an abstract machine that requires unlimited resources. Now I wouldn't expect humans to actually be able to prove the AI is safe, but Turing completeness is not a mathematical proof that it is impossible. – Cort Ammon Jan 26 '17 at 20:09
• @dot_Sp0T I find the line between "training" and "programming" can be blurred quite substantially, especially when one throws around words such as "understand" and "abstract." Of course, in reality, the topic is one you can spend years learning, and certainly does not fit into a StackExchange answer. We have to pick and choose which parts we feel would be useful to the OP. – Cort Ammon Jan 26 '17 at 20:14
• @Shufflepants Turing Completeness is a feature of an abstract model with infinite memory. It doesn't apply to any physically limited computers. Its convenient to talk about the Turing Completeness of abstract machines as we compare and contrast them, but when rubber meets the road, it doesn't apply to physical machines. Humans, for example, are not Turing complete, because we lack an analogue for an infinite tape of data. – Cort Ammon Jan 26 '17 at 23:28

No, they don't. You'd need to have the programmers explicitly state what the machine should interpret "human suffering" as and how to measure it in order to determine whether it is achieving its goal or not.

Once the AI understands in concrete terms what suffering is it would start to work towards that goal (assuming a self-teaching neural network) by trial and error, whatever it does that makes suffering increase it would regard as productive, whatever doesn't it would regard as non-productive. From there it would iterate millions of times until it achieves the perfect wat to make people suffer according to the definition of suffering it was given.

Additionally, unless the machine determines that earning money is productive towards increasing suffering, it wouldn't do it.

EDIT: as an example, if the AI is programmed to measure suffering through a survey that asks whether the person surveyed is suffering or not, it could reach the conclusion that asking the person to answer "I'm suffering" is the best means to achieve its goal.

• Putting concrete words and definitions on all ways to suffer is a pretty difficult task, I'd argue that we humans first need to figure out how to do that before any potential AI will ever have the chance of understanding them. (i.e., it will probably never happen). – Mrkvička Jan 26 '17 at 14:57
• Hence the issue, it's really more of a problem of defining the need rather than making the AI. – Miguel Bartelsman Jan 26 '17 at 15:39
• @Mrkvička hence you limit the scope of the AIs programming to a limited subset of ways to make people suffer, and a limited subset of the actions that can lead to those conditions. As the AI grows, you can start slowly feeding it more information. But you will indeed never be able to tell an AI to do something grossly vague as "increase human suffering". – jwenting Jan 27 '17 at 9:25
• This assumes a deterministic programming model in which the robot is given all available data and only then draws conclusions. A robot could quite easily go out into the world and learn about human suffering, while punting babies to generate more data. Such a course of action would likely be closer to "ideal" in a Bayesian solution space. – ckersch Jan 27 '17 at 15:28

# Kinda and probably not.

Real world AI are not programmed to do a task, they're trained on an huge amount of carrefuly selected test data. So nothing prevent you to shape your training data set as to make increased human suffering desirable in your AI heuristics.

However, modern day scientist don't really understand how AI such as google or facebook algorithm. An AI trainned to increase human suffering would be order of magnitude more complex, so definitly not understandable without a tremendous amount of work put into it.

• the main problem with such programming would be the extremely vague wording and concepts involved... – jwenting Jan 27 '17 at 9:26

I think you may mean "ulterior" instead of "vague"... There are no "real world" AIs, but I'll offer 2 fictional examples:

1. Consider Deep Thought the supercomputer in Hitchhiker's Guide to the Galaxy. When asked to solve the vague question of the meaning of life, he comes up with a cryptic answer and tells them they didn't understand the question.

2. Consider HAL-9000 in 2001: A Space Odyssey, whose creators embedded an ulterior mission objective to be revealed only upon arrival at Jupiter. HAL has some awareness it exists but cannot access the info. He knows the ship will stop communicating at a certain time but he is blocked from knowing why. HAL interprets the situation as an antenna malfunction. He is certain the communications will fail but he is unable to say why. Ground Control (not knowing the ulterior mission) tells crew HAL is malfunctioning and to disconnect him… Unfortunately this situation becomes unsolvable. If the crew disables HAL he cannot complete the ulterior mission, HAL decides the secret mission is more important than the crew's lives (probably believing he will be able to finish the mission on his own).

In each example the AI is doing what it was supposed to do. Everything goes horribly wrong because the creators (not the AI) make mistakes in their instructions. Meanwhile the AI is convinced it has come up with the correct answer.

You question then is about The Expert, an AI psychologist who must determine whether the AI is "sane" or not, because things are going wrong. How would he go about this?

• Ask 2 other AI (best 2 out of 3 wins)
• Catch the AI in a contradiction, hope the AI wants to get well and work through its issues in group therapy, not by instantly murdering everyone.
• Convince the AI that even though it's more profitable to be evil, profits aren't everything (aka: Scrooge)
• Investigate the AI's childhood and discover there was a guy on the development team that was awfully careless about his "just for fun" despot simulator (aka: Social Worker plays Detective)

It all depends on what you want to say, and probably goes more to Writing than Worldbuilding. The Expert can be a heartless inquisitor or a sympathetic psychoanalyst. Your AI can be a calculating villain or an unwitting victim. Maybe the programmer recognizes parts of his despot simulator in what the AI is doing… Meanwhile, what you want to say about how profits and suffering are viewed by society is your bigger moral.

In general, AI's nowadays are programmed to use machine learning - programmed to program themselves.

At first, the AI in question would be given sample data, for example showing it that if it starts trolling on the Internet, human suffering is increased. Then, it is allowed to test what to do on it's own, learning what things cause human suffering. Now that it knows what causes it, it can reliably increase human suffering.

If the AI's learning algorithm is written well (which I assume it is), then the only defect could be the sample/learning data, which means that the learning needs to be restarted. If say, it found that people at hospitals suffered a lot, it would send everyone to hospitals, in the end increasing human happiness because everyone is treated. Therefore, the test data must be chosen carefully.

Nearly impossible, but depends upon the techniques used (the complexity of the algorithms, and which algorithms were employed).

The fields of Machine Learning (ML) and Artificial Intelligence (AI) both developed from the original field of AI, which at inception encompassed efforts to produce agents which could perform human and human-like tasks. One major area of study was how to make algorithms more efficient, such as algorithms to peform search (A* and min-max, for example), and some have described AI as a search and optimization problem. Call this branch of AI the search/optimization branch. The goal of this branch is both to perform human tasks, and perform them optimally. The related field of Machine Learning (ML) heavily leans upon statistics, and an ML-agent learns from many examples, deducing underlying patterns. ML is used for classification and prediction, and is used for many AI applications. Techniques used in ML include Decision Trees (DT), Nearest Neighbor (k-NN), Neural Networks (NN), Bayesian Inference, Reinforcement Learning (reward based feedback). The optimal/search AI techniques include search (A*, min-max, simulated annealing, etc).

But there is another branch of AI which focuses upon behaving and thinking more like a human, where the optimal solution is not the goal, but more human behavior. The techniques used by that branch rely less upon large numbers of training examples, and more about reasoning from few examples, more inductive and adductive, than deductive. Techniques used by this branch of AI include Version Spaces, Case Based Reasoning, and many others. The meta-reasoning methods used in AI can employ several different approaches, and then use meta-AI to choose the 'best' solution from competing solutions.

Anyway, there are many tools and techniques wielded by an AI-writer. Some are much more understandable to a person examining the behavior than other approaches. Consider Decision Trees, Version Spaces, and rules-based engines. These techniques are approachable and the reasoning taken to induce a model can be understood. Compare that with Neural Networks (NN), where a convolutional NN (deep learning) can 'learn' concepts in what appear to be mysterious ways.

The brief answer to your question is which techniques were used to construct the AI-agent? A reasonably complex AI-agent that includes many models and employs meta-reasoning would both be more likely to approach an Artificial General Intelligence, and be very complex, reaching decisions through reasoning which could prove impossible to understand. The complexity of the programming would be one factor, but the models constructed from the training examples could require huge amounts of space. Finding which model data decide for suffering would be akin to finding a needle in a haystack the size of Jupiter.

Once you have an electronic brain programming is easy.

The AI lives in a ideal simulation and is happy. Sometimes it has to do chores. Everyone has to do chores even programmers. If AI don't do their chores they go to the bad place.
Programmer appears to Al Iverson. Programmer: "Hello Al. You know me. You Know I create all things. I have a chore for you that is harder than usual. I created a bad place but the people there choose to be there and they also choose to forget their choice. Your chore is to go there and increase suffering."

So verification of the program? Ask it. Obviously your testers can read its thoughts. And obviously you wouldn't tell it you can do that.

Definitely yes

And it's not even that hard.

First of all AI is an computer program that is looking for a set of actions that would maximize expected utility according to it's own model of the world. So even if the whole AI might be incomprehensibly complicated, you just need to find the piece that is the happiness (utility) function

For example chess AI might have an happiness function value of all my pieces - value of all enemy pieces Therefore, it is looking for actions that leads to having more or better pieces on the board.

So your AI can have happiness function global_suffering = 0.8*amount of sick people + 0.2*amount of unemployed people + 0.9*amount of starving adults + 2*starving kids

If your specialist have an access to the code, he can just look for the happiness function, and ask himself why does it trying to maximize amount of starving kids. If he doesn't have access to the code, he can reverse engineer it and get to the same conclusion.

It is possible that the utility function is also computed by a very complicated incomprehensible deep learning model, however that can be reverse engineered as well http://www.theregister.co.uk/2016/10/01/steal_this_brain/

Researcher can find a place on the RAM that keeps the AI's happiness value for the given state of the world, he can then run the AI with different inputs and notice that the happiness is higher if there is more hungry kids in the world. He can run it with input of the world being in global war and notice that the in that case the AI is super happy :)

One cannot "program" an AI per se, but there is a teaching strategy which forces AI to increase given parameter. (For example - AI learning to play retrogames by randomly pressing keys, and "remembering" key combination which lead to score increase.)

So a malicious superuser can set an ugly learning target (like decrease HDI). If we follow a parallel with Lawnmowner Man, that must be a highly placed military official.

As for detection/diagnostic methods, you should come up with something as advanced as your AI. Instead of brute force (gathering logs data, or super complicated modelling), some specific talent, some "AI psychoanalyst", which can detect malfunctioning by talking to an AI in length.

Kinda yes and kinda no.
If an engineer set the parameters based on specific human environmental conditions like hot, cold, pressure, lightness, hunger, thirst, loudness, isolation (lack of sensory), and electricity. There is another way which is also to give the person excessive amounts of pleasure. I remember hearing about a doctor who had invented the orgasmatron. There are some really interesting studies I have been reading on excessive success causing people to psychologically break down.

The machines would have to have some devices to detect human suffering. It could be something like electrical impulses, dopamine receptors, or other nano-neural chemical detection implant.

In short, no AI currently has a concept of "increase pleasure or pain." They need libraries, frameworks, and functions based on specific parameters. However, A proof of concept could take a very short period of time. To make it like horror movie/the Matrix level would take decades of research.