by David Reichel
Ethical artificial intelligence
Discussions around the use of artificial intelligence (AI) are everywhere. Pictures of robots, stories about artificial general intelligence (AGI) and the use of algorithms are featured almost daily in news papers these days. While one should not believe the hype, the past years have certainly seen major technological developments in the area of machine learning and other areas, which have contributed to many new opportunities, but at the same time present challenges for society. Apart from the question about what really is behind the hype, many governments, international organisations, businesses, civil society organisations and academics have published or started developing texts, analyses, guidelines or recommendations on how to do ethical AI. In this post I would like to highlight one issue related to the discussion on ethical AI - what do developers think about writing (un-)ethical code and who are the (un-)ethical developers?
Ethics vs human rights
The Fundamental Rights Agency of the European Union (FRA) in its Fundamental Rights Report 2019 stated that only a rights-based approach guarantees against a possible misuse of new technologies and that fundamental rights should be put at the heart of any national strategies on AI.1 Several United Nations experts recently stated that human rights must be embedded in the design of our digital age.2 I obviously strongly support the approach to put human rights at the heart of these discussions. However, let’s have a look at some data about developers and ethics.
Would developers write unethical code?
Stack Overflow, a major platform for developers, asked several thousands of developers and programmers about their views and experiences in relation to their work in its Annual Developer Survey.3 In 2018, a few questions were added in relation to ethics and programming. One of the questions asked respondents whether they would write ‘unethical code’. Figure 1, below, shows the overall result. Not surprisingly, only very few respondents indicated to be willing to do that. While still 1 in 20 developers would be willing to write code for unethical purposes, the majority clearly said ‘No’ (58.5 %). What about the rest? Interestingly, 1 in 3 of the respondents said depends on what it is. This clearly points to the unclarity of what it means to be ethical. Maybe something is unethical, but still not a problem for some. And people can obviously disagree on what (un-)ethical purposes are.
Let’s have a closer look at the data. Who are the ethical developers? Figure 2 shows the results of a logistic regression on whether a respondent indicated not to be willing to write unethical code (i.e. willing to write ethical code, 58.5 % of respondents. The country of origin of the respondents were put as random effects.). I put those who say ‘yes’ and those who say ‘depends on what it is’ in one other category. The results indicate that older respondents, women and those who are not dissatisfied with their career tend to be less likely to write unethical code. So, young men, who are unhappy with their jobs, are more often saying they would write unethical code.
However, these statistics are limited in what they can tell us, because we just know that most people would not want to write unethical code, while many others say that it depends. Given that only few would write unethical code and many might to so (‘it depends’), what about if developers learn about others writing unethical code? The survey included a question about whether developers would report or otherwise call out the unethical code in question. Again a small share of unethical developers (or people who did not take the survey too serious) would not report at all - but still almost 1 in 20. Here, almost half of respondents say again depends on what it is. One in three would only report within the company and 13 percent would do so publicly. See Table 1.
EthicsReport | n | percentage |
---|---|---|
Depends on what it is | 32812 | 46.6 |
No | 3254 | 4.6 |
Yes, and publicly | 9200 | 13.1 |
Yes, but only within the company | 25160 | 35.7 |
Ok, this is not much promising. However, the larger share of respondents, saying again that it depends, does not say that respondents don’t think that ethics are important. The majority of developers do think that they have to consider ethical implications. Most developers (80 %) believe that they have an obligation to consider the ethical implications of the code that they write. This is illustrated in Table 2, below. 14 percent are unsure about this or don’t know. Maybe they think it is not (always) the developers who are responsible for considering ethical implications.
EthicalImplications | n | percentage |
---|---|---|
No | 4216 | 6.1 |
Unsure / I don’t know | 9893 | 14.3 |
Yes | 55200 | 79.6 |
Now an important question arises. Are developers ultimately responsible for code that accomplishes something unethical? On a personal level, I would say: yes, of course. On a structural level though, it might be someone else who is ultimately responsible.
When asked about this, one in five developers think that they are ultimately resonsible (20 %). Slightly more think that the person who came up with the idea is ultimately responsible (23 %). Finally, most developers interviewed clearly state that upper management is ultimately responsible for code that accomplishes something unethical. See Table 3.
EthicsResponsible | n | percentage |
---|---|---|
The developer who wrote it | 12696 | 19.7 |
The person who came up with the idea | 14726 | 22.8 |
Upper management at the company/organization | 37118 | 57.5 |
This makes sense. Because, ultimately, those running a company or organisation should be responsible for whatever is done under their responsibility. Let’s have a closer look at the percentages of developers who think that it is not individuals themselves but rather management being responsible. Are there differences across countries?
The map below (Figure 3) shows the differences across countries in the share of developers who think that management is responsible for unethical code. We see some differences. The shades of blue are getting darker starting in Europe from North to South and West to East.
The countries with the highest shares of developers who would say that management is responsible are: Sweden, Argentina, Italy, Spain, Denmark, Uruguay, Finland, France, Slovenia, New Zealand. The countries with the lowest shares of developers making management responsible are: Myanmar (Burma), Nicaragua, Cambodia, Kenya, Ethiopia, Cameroon, Zimbabwe, Nigeria, Philippines, Tanzania. This seems like we have many richer European countries making management responsible and poorer African countries rather not. Could this be linked to the level of corruption in a country or, relatedly, human rights protection? The idea would be that people (and developers) living in more corrupt countries with lower human rights protection do not think that management could be trusted either because companies are more corrupt or the state does not (or cannot) ensure rule of law and human rights.
Let’s match the country level data with data on corruption4 and human rights protection5. This provides us with a dataset of 109 countries. Both indicators, the one on corruption and the one human rights protection, are correlated with the share of respondents who think that management is ultimately responsible for unethical code. The Corruption Perception Index in these 109 countries correlates with the share of respondents at a level of 0.67 and the human rights protection index based on Farris’ work at 0.66. The two indicators, corruption and human rights protection, correlate at 0.81. Figure 4a and 4b, below, visualise the level of correlation. There is a modest correlation. This could indicate that a lack of state protection of human rights and higher levels of corruption make people (developers) think that they themselves have to take responsibility because management cannot be trusted. In a way, this points to the importance of human rights protection through putting the responsibilities on those who are ultimately responsible. While everyone is responsible for their deeds, if a company wants to accomplish something unethical (whatever this means), management should be held responsible for what they do. And when it seems that human rights protection and less corruption appear to offer some protection in the respect as well.
That’s some food for thought. I’ll leave it at that and I hope you enjoyed reading. If you are interest in how the analysis was done, here is the code to reproduce all the analysis.6
Such strategies are mushrooming currently across the globe.↩
(https://www.ohchr.org/EN/NewsEvents/Pages/DisplayNews.aspx?NewsID=24696&LangID=E)↩
Transparency International, Corruption Perception Index 2018, downloaded on 22 June 2019 from (https://www.transparency.org/cpi2018#downloads).↩
Data taken from: Max Roser (2019) - “Human Rights”. Published online at OurWorldInData.org. Retrieved from: ‘(https://ourworldindata.org/human-rights)’ [Online Resource], using the data from: Schnakenberg, K. E. & Fariss, C. J. (2014). Dynamic Patterns of Human Rights Practices. Political Science Research and Methods, 2(1), 1–31. (doi:10.1017/psrm.2013.15) and updated at Fariss, C. J. (2019). Yes, Human Rights Practices Are Improving Over Time. American Political Science Review. Advance online publication. doi: 10.1017/S000305541900025X, Latent Human Rights Protection Scores Version 3: (https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/DVN/TADPGE). I calculated the average score from 2000 to 2004 per country.↩
The folder includes the R markdown document that creates the R notebook.↩