I first asked this at Writers.SE but was advised I might do better here...

I am working on a science fiction novel that will involve a large quantity and variety of synthetic life forms. I have been highly influenced by the works of Asimov, and while I may not explicitly state the laws I utilize for the governance of artificial life, I want to have a solid footing for how my robots -or whatever they might be called- are able to make ethical decisions. From a plot perspective, I also want some realistic ways ways that these rules could be hacked or otherwise subverted.

What I would love to find/engage in, is a discussion of what some algorithms that would make Asimov's laws of Robotics work, might look like translated into current programming concepts. If this exists already then great! If not, then I'm hoping we can talk about it or that people might direct me to the right place.

I know I could ask this question on a pure coding site, but I don't want to be inundated with lines of raw code. At the same time, I don't want to read through tomes of philosophy that have no foundation in modern computer programming. I'm looking for something in between... So I thought that there must be some other sci-fi minded folks around the SO community with experience into this type of research.

I want my end product to be hard SF and I do have a degree in software, but I don't want to have to spend 20 years in robotics in order to research this topic either. If anyone would like me to clarify, just comment or shoot an attempt at an answer. I greatly appreciate any help in finding some answers to this question.

Edit: Thanks for the comments... is anyone willing and able to start a chat on this idea?

closed as primarily opinion-based by Valorum, Ward, Politank-Z, Rand al'Thor Jun 5 '16 at 18:11

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    As you acknowledge, this is a discussion question. Remember that this (along with all other SE sites) is a question-and-answer site. As interesting as this is, you should come into our chat room and ask there, you are more likely to get not only an answer but the good discussion you are looking for. – Kevin Jan 25 '12 at 6:13
  • 1
    @Kevin: Unfortunately, I've already jumped into this headlong. I've basically answered the question What sort of algorithm would Asimov's robots employ to implement the the Three Laws? But I'm in agreement about moving discussions to chat. – HNL Jan 25 '12 at 8:25
  • 2
    @AndresF. - while true AI maybe SF, the work towards it is here and now and I've seen plenty of unintelligent systems in the lab at least appear to do "whatever it wants" :) – HorusKol Jan 25 '12 at 12:52
  • 2
    @HNL - A good answer to a question rarely stops it from being closed. That's part of why one can still vote and accept an answer on a closed question, and the rep doesn't go away like with a deleted one. – Kevin Jan 25 '12 at 13:44
  • 2
    I'm somewhat at a loss how this question survived. – Valorum Jun 5 '16 at 17:10
up vote 29 down vote accepted

A highly speculative question, but let us take a stab at it:

Step #1: Define a robot

  • A robot is basically a computer with sensors and actuators attached.
  • You can take away the sensors and actuators without reducing the essence of a robot, which leaves the computer, or the brain.
  • A computer is based on three things (as someone with your level of education will know very well): Input, Processing and Output

Step #2: The laws in human-readable form

  1. A robot may not injure a human being or, through inaction, allow a human being to come to harm.
  2. A robot must obey orders given it by human beings except where such orders would conflict with the First Law.
  3. A robot must protect its own existence as long as such protection does not conflict with the First or Second Law.
  4. Zeroth Law: A robot may not harm humanity, or, by inaction, allow humanity to come to harm.

Step #3: Algorithm prerequisites

  • Ability to sense, objectively quantify and compare "Harm"
  • Thorough knowledge of human vulnerabilities (physiological, nutritional, psychological)
  • A thorough understanding of the causal laws of its operating domain (e.g. device A emits radiation; concrete column B can only withstand a force of 10,000 newtons etc.)
  • Thereby posses the ability to predict the consequences of all actions open to it and actions that human beings may be about to take, with a degree of accuracy acceptable to humans.

Step #4: Algorithm

  • Raw input: Sensor inputs (visual, auditory, tactile, remote sensors, real-time feeds from distributed networks such as the Internet, etc.)
  • Processed input for the algorithm: A massive vector/matrix of projected probabilities: e.g. car A's speed & direction projected to hit human H in 3 seconds; human driver reflex: 0.3 seconds; this robot's ETA to H's location: 2 seconds -> Keep processing these variables until a risk threshold is exceeded and (in this case, before car's ETA reaches two seconds) initiate preventive action.
  • Raw output: Evaluated risk matrix of possible actions
  • Evaluation of possible preventive actions against time taken, risk to self and others, probability of success, severity of harm human is under: e.g. move human H out of way? warn the driver? warn the human H if car is moving slowly?
  • Final output: Action
  • While action is being taken, run a continuous evaluation loop to see of the risk variables change, so that actions can be adjusted as necessary.

Implications

  • Notice that this is basically a risk assessment system.
  • Notice that the "through inaction, allow" clause is very difficult to implement -- only robots with an in-depth understanding of humans will be able to intervene in human action to prevent harm
  • Notice that the zeroth law requires risk data encompassing the entirety of humanity that it will be difficult to implement in individual robots -- it will take a super computer.
  • 3
    +1 Great answer. It seems this should be moved to chat, but I am new to this SO page, so I don't yet have the privileges to do so... The only reason your answer isn't complete is because I'm not being completely forthcoming with my question. There's a fine line as an author between bouncing ideas off of people and taking ideas from people. I guess my thinking is that as long as were talking about Asimov's laws someone's probably already thought of it. If we were talking about my own laws specifically I'd be in more danger of binding myself a bit. I look forward to chatting about this. – Steve the Maker Jan 25 '12 at 13:19
  • @StevetheMaker You might ask people interested in discussing this to first state that all they say or produce during that disucssion will be in public domain. That way, you're free to use any product of such chat in your works. I don't think people would mind. – Ilari Kajaste Apr 25 '12 at 7:27
  • @IlariKajaste Exactly. Personally, I don't mind at all if Steve uses any part of this answer in his story. – HNL Apr 26 '12 at 4:11
  • 2
    Don't forget "Define 'Human'". I remember something about certain robots that were programmed to define "human" as something very specific to a certain race and/or group and were thus able to be used as weapons. – Steam Jun 27 '12 at 17:45

As an addition to @HNL answer, here are some diagrams showing robot internals.

General diagram

robot internals

Actually 'processing' itself could be divided to 2 layers, similarly to a human neural system - there should be high-level system performing high-level tasks (like 'Go shopping'), and low-level tasks like 'Left leg - make next step'. That seems more logical from technical perspective. It's easier to develop. Also it's easier to re-use some modules. Levels' tasks have different orientation - high-level system manages relationship and ethic, while low-level - physical movements and interaction with things.

So the process inside the "neural system" is as follows:

  1. Situation parsing module creates a description to be consumed by next module. For high-level system it describes people involved (master who gave an order), locations (shop), etc. Low-level describes nearest physical environment (pavement, street to be crossed, etc.)

  2. Decision making module makes a decision. High-level module is the place where we implement 3 laws primarily. Low-level module defines if robot should wait for green light, or stop movement to not step a cat for example.

  3. Actions module receives decision and performs actions. High-level: To go shopping I need find out what's required, go down the street, etc. High-level actions are broken down to series of low-level actions (move arms, legs, say something, etc.)

  4. Feedback provides robot with abilities to see/foresee its own actions or their consequences.

Decision making module

decision making

Input is the situation description (an output from the parser module). Decision module uses several different approaches for analysis.

First, passing through neural network, robots realizes the task, then applies logical rules. Robot Laws could strictly specified in Exceptions processing, so it could react immediately. The rest of tasks should pass through neural network/logic modules (maybe several times) in order to find out some execution plan.

Summary

First, from technical perspective, robot executes tasks. High-level tasks are broken down to a sequence of simple tasks, which are broken down to a sequence of low-level tasks, like movements of a particular robot part. Robot continuously analyzes the situation and makes decision if tasks queue should be modified.

Here are some thought about hacking and subversion:

  1. Even if robot's sensors are so good that robot can track all people in the city, you should restrict robot's responsibility. For example, robot can't help people who are at the other part of the city. (This actually contradicts with 1st law). So probably from ethic point of view you should restrict robot's sensors' abilities.

  2. You can't give robot powered forecasting abilities - in the street robot will calculate people destinies forever. That's actually either could be a "Robot oracle", or just an interesting malfunctioning.

  3. Due to modular nature, you can plug into a robot different situation parsing module. For example, plug robot into a computer game and see what happens.

  4. Decision making module should be different in different countries/cultures. Good example - different gestures in different cultures and robot should react in a different way. (For sure Japanese robot would be confused in Europe).

  5. You could give robots abilities to communicate each other via the network. So they could unite and coordinate their actions in order to satisfy laws. From the other side it could be a disaster like Skynet.

  6. When the part of decision making module is broken and robot kills a human - robot should still "understand" that - situation would go through sensors to it's "brain" and "memory". What should robot do in this case? Report about itself as broken, or develop "self-defensive" instinct?

  7. There can be interesting memory erasing flow. For example, there is a neural network which contains some rules implicitly, and a separate "memory" where robots stores some facts. So if you erase only raw memory, robot's behavior and some experience would be still located in the neural network, and robot could somehow recover "erased" past self.

From the stories I've read, it looks like Asimov did a great job at skirting the details of how the positronic brain really works. This is what has spawned the same question, namely how to implement the three laws in an artificial brain. NHL did a great job at summarizing the robots as computer entities with a bunch of sensors and actuators attached to them. But then he took the usual way of seeing the computer as a mega-computing machine in some way. We don't have this kind of mega-computing abilities as human beings, though we are able to assess risks ourselves, and are able to take action. However, as common sense may fail us (quite often actually), it would be a very good augmentation and should be seen as an additional independent module if you will. That module, when fed with memories or some facts extracted from the senses, would give even more information in the form of usable outputs to other parts of an artificial brain.

Jeff Hawkins said in his book On Intelligence, we should maybe not talk about "artificial intelligence," but rather "true intelligence induced by an artificial device." I would suggest anyone interested in this kind of stuff to read this very interesting book. For me it was an inspiring one. As I'm "working" in the Machine Learning field, I was rather frustrated by the directions taken so far in this field, as was Hawkins some time ago.

Maybe we should tackle the problem from the perspective of mimicking biology more closely, as his work suggests, by using a so-called "hierarchical temporal memory." Intelligence (and therefore memory) is actually made of a hierarchy of associations of a multitude of stimuli (including action's feedbacks) encoded in the form of circuits in the brain. If some behaviors are deeply rooted in us, this is in part because of some kinds of rewards our brain releases from time to time in the form of hormones. Hormones facilitate (or inhibits) the building of particular associations the brain deems good (bad) for us (which are not necessarily good (bad) in the absolute... unfortunately). In this sense and with regard to the three laws, I think that for it to be really adapted to our societies, a robot should have limited means of action first (fewer actuators for instance), and should be exposed to society and its environment as much as possible before being allowed to fully interact with them. Some desired behaviors and associations could be enforced with facilitated fixed stimuli to give strong hints at what is good or bad in a particular context. These fixed stimuli are the closest things I can come up with to encode the three laws in practice. These associations should be frozen in some way in order for them to be sufficiently effective. Humans could develop bad or good habits that can be hard to change after all. By making that ones particularly hard to change we should be okay.

I don't think perfection will ever be attained with this kind of architecture. In some cases it would fail, as humans themselves do, but with the information provided by some extra modules, like the "mega-computing" one, this could be somewhat alleviated. I'm willing to bet that an artificial brain in the sense of a computing machine alone will never go as far as that either. In fact, the human brain intelligence itself could largely be surpassed by intelligence induced by those kind of devices. It could build up instead of being lost at some point (like at the end of a human subject's life). All a human being is left with is language to extract their intelligence or knowledge out of their own brain. Unfortunately, it takes time to transfer that knowledge to another brain in this way. Further, no matter how hard you try, it is often altered in the process. Another issue is that sometimes we never make crucial associations that are, however, latent and at the verge of being made if given a little more time. Conclusion, a lot of time is lost. You never see more than the tip of the intelligence iceberg within a single brain in such a short lifetime as ours. Maybe a solution to our limitations would be to find a way for our brains to communicate with such a device. It would be a lot harder I think but not impossible. Ethics would also be pointing its nose I suppose.

I would appreciate if this were on a forum where I could talk more about it because I digress a lot. I'm not the one who came up with that by the way... Hawkins transferred it to my brain through his book. And for him we should maybe consider forms of intelligent agents in a broader sense, not necessarily human- or animal-like entities. Also feel free to stole these ideas for you next book :).

P.W. Singer argues that Asimov's Laws of Robotics don't work. He brought up issues with implementing Asimov's "Three Laws of Robotics" in his book "Wired for War" (2009), specifically on page 423 in the paperback edition.

There are only three problems with these laws. The first is that they are fiction. They are a plot device that Asimov made up to help drive his stories. Indeed, his tales almost always revolved around robots' following the laws but then going astray and the unintended consequences that result. An advertisement for the 2004 movie adaptation of Asimov's famous book I, Robot put it best: "Rules were made to be broken."

For example, in one of Asimov's stories, robots are made to follow the laws, but they are given a certain meaning of "human." Prefiguring what now goes on in real world ethnic cleansing campaigns, the robots only recognize people of a certain group as "human." They follow the laws, but still carry out genocide.

The second problem is that no technology can yet replicate Asimov's laws inside a machine. As Rodney Brooks put it, "People ask me about whether our robots follow Asimov's laws. There is a simple reason [they don't]. I can't build Asimov's laws in them." Daniel Wilson is a bit more florid. "Asimov's rules are neat, but they are also bullshit. For example, they are in English. How the heck do you program that?"

Finally, much of the funding for robotics research comes from the miltary. It explicitly wants robots that can kill, won't take orders from just any human, and don't care about their own lives. So much for Laws One, Two, and Three.

As a programmer, I would hate to have these laws as software requirements. They deal with abstract concepts: injury, inaction, human, order, existence, humanity. These concepts are not defined in the laws and you would have a hard time getting a group of people to agree on what they mean.

Assuming that people could agree on concrete, observable definitions for those abstract concepts and technical hurdles could be overcome, one can argue that many parties, particularly the military, have no interest in encoding these laws into robotic behavior.

  • 2
    Asimov devised his three laws for one simple reason: to avoid the "Frankenstein" cliche. He felt that it was too easy and lacked imagination to write stories where robots run amok and kill their human masters. In devising the three laws, he saw a great deal of room for story ideas and also differentiated his writing from what he saw as the overdone killer robot trope. If you suspend your disbelief in regard to a practical implementation of the three laws, they are at least plausible in intent where robots must work alongside humans in a peaceful society. – Anthony X Aug 3 '14 at 22:32

I would suggest to explore the following angles:

In his robot stories, Asimov explored changes in behavior if the relative weight of the laws is modified. For example, in a mining environment, the weight of the first law was reduced or the robots would not allow humans to leave their space ships (because of the danger to become sick of radiation). So there is a) a deep reasoning why there are three laws and b) why they are in this order.

Of course, reality is much more complex than in the stories. If you have a train running down a track and there are three people in the track, would you flip a junction if that saved the three lives? What if there is a single person on the other track? What if there are 500 people in the train and there is a slight chance that the train will jump out of the rails, possibly killing the passengers and the 3 people on the track? Would you kill the three people if it meant to keep the track in a good enough shape to ensure the well-being of thousands of people in the next city which depends on the goods brought by train?

To be able to assess a risk, you need to be able to notice it. Sensors are rarely perfect. CPU power is limited. Algorithms are limited. If three people see a crime, you get four stories. Why? Because our brain gets 100 million bits of information each second from the body sensors but only 40 of them make it into our consciousness - we would be completely overwhelmed if we we had to deal with everything. So information gets compressed. Sometimes, important parts get lost. These parts are recreated with common sense and memories without us ever noticing. Can we build a robot that does better or would that artificial brain fry itself in a few minutes?

There are always corner cases. There are social rules. Society will not care if a sentient robot is killed but what about the robot? What about the Robot Rights Movement? How many of those social rules can a robot know? Or maybe they know more rules than any human could ever grasp and thus act in ways that no human could comprehend?

Always remember that things are never perfect. You always have a balance between advantages and disadvantages. If the robot can process a lot of information, the reasoning behind it can only be shallow. If it's a deep thinker, the amount of information must be somehow limited.

Does it have goals or a hidden agenda (think of HAL in 2001)?

Transform syndrome: If the robot had evolved itself, how easy is a communication with a human? Eventually, humans will be like ants to the robot: Primitive, simple, small, but it's still hard to get ants to build a sky scraper.

An alternate take (I tend to try to look at things from the other side if possible) would be to do it from the Robot's point of view. That is, not it, not even he, but I.

Now, hold your horses li'l tighter just a second please, I know there's already a rather famous work by a rather famous polymath whose title appears to have already covered exactly what I'm suggesting, but consider this potential opening . . . .

The beginning? Well, the first thing I can remember is my blocks. I had three blocks at first. And I could put one on top of another one. And I could put one next to another one. And if I wanted to I could put one behind another one. And I could make a tower with all three.

. . . . a distant trace of a motor-perception coordination test?

You folks are over-complicating this:

First Law

setClass Law01

if { status_human=danger;
     Then rescue_human;
}

if{ status_Self=(status_human=harm);
     then cancel action;
}

else goto 01;

Second Law

SetClass Law02;
cin >>directive;
Law01 = directive;

if {status_human= danger;
    then cout<<"I'm afraid I can't do that, Dave.";
else
    status=directive;
}

Third Law

SetClass Law03
if{ status_Self=harm;
    then Law01 action_status;

    Law02 action_status;
    if {action_status=0;
        then self_status=0;}
        else action_status=1;
}

Please note: in case you can't tell, this is meant to be a silly answer. Don't get too caught up on my mixing C++ with BASIC or having semicolons in the wrong place, ok?

Not the answer you're looking for? Browse other questions tagged or ask your own question.