{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"execution":{"iopub.status.busy":"2023-07-04T16:01:50.180118Z","iopub.execute_input":"2023-07-04T16:01:50.180536Z","iopub.status.idle":"2023-07-04T16:01:50.189902Z","shell.execute_reply.started":"2023-07-04T16:01:50.180505Z","shell.execute_reply":"2023-07-04T16:01:50.188306Z"},"_kg_hide-input":true,"_kg_hide-output":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# AI Ethics through the lens of Immanuel Kant","metadata":{}},{"cell_type":"markdown","source":"## Introduction\n\nThe term Artificial Intelligence (AI) was first coined in 1956 by John McCarthy, as an opposition to human, or natural intelligence. Despite its nearly 70 years of existence, the endeavour to produce machines that can mimic human intelligence has faced two \"winters\" where the direction of research at the time hit a dead end and progress all but came to a halt. With the rise of Internet of Things (IoT) devices and machines with the capability to store and process Big Data, AI has made a comeback in the 21st century, with advancements being made at a more rapid pace than ever.\n\nHowever, in the midst of all the growth, we cannot neglect the consideration of AI ethics as a check-and-balance system to ensure that the AI systems we create do not violate the innate code of conduct that binds us together as a society. In this essay, we use ethical formulas developed by Immanuel Kant to examine various ethical issues that are commonly raised with the recent developments in AI, most notably of all, generative AI in the recent years. We then draw a conclusion of what needs to be done in both the development and use of recent AI, in order to be deemed ethical by Kantian standards.","metadata":{}},{"cell_type":"markdown","source":"## Kantian Ethics\n\nImmanuel Kant was a philosopher who lived in the 18th century. His philosophy on ethics is that man is guided by moral duty to do what is right. His theory states three formulas by which man can test their actions against to determine what he morally ought to do. \n\nThe first formula specifies a universal law. To judge whether an action is moral or not, one must first ask if it is permissible for everyone to perform this action. If the answer is yes, then the action is judged as moral. Otherwise, the action is immoral.\n\nThe second formula is that \"we ought to treat humanity (self and others) as an end and never as a mere means\" (Wilburn, 2022). Kant reasoned that since humans are capable of autonomy and rational thought, it is crucial for us to treat each other and ourselves \"with respect and dignity\". The third formula expands this to state that we should act in a way that is acceptable \"within a community of other rational agents\".","metadata":{}},{"cell_type":"markdown","source":"The table below summarises Immanuel Kant's Three Formulas of Moral Theory, adapted from Wilburn (2022).\n\n| Number  | Formula  |\n|---|---|\n|  1 | One ought to act in a way such that the maxim, or principle, of our act can be willed a universal law.  |\n|  2 | One ought to treat humanity (self and others) as an end and never as a mere means.  |\n|  3 | One should act on principles that could be accepted within a community of other rational agents.  |\n\n\nKant's three formulas may serve as a useful lens when determining what is ethical in development and use of Artificial Intelligence, and what is not.","metadata":{}},{"cell_type":"markdown","source":"## Ethics in the Development of AI\n\nThere are several ethical concerns in the development of AI. Much has been discussed about algorithmic bias that stems from unrepresentative data. With the recent rapid advancements in generative AI, concerns about copyright of training data have also risen up. We examine each of these in turn.","metadata":{}},{"cell_type":"markdown","source":"### Algorithmic Bias\n\nAlgorithmic bias refers to the phenomenon where algorithms introduce unintended biases into decision-making processes (Singh & Joachims, 2018). Algorithmic bias in machine learning often occurs because of biased datasets on which the machine learning model is trained. The results produced by the biased model may then strengthen our conscious or unconscious stereotypes and beliefs.\n\nFor example, an article published online in 2016 exposed scores from a computer system predicting how likely criminals are to reoffend (Angwin et al., 2016). These risk assessment scores generated by artificial intelligence seemed to implicate black defendants as 77% more likely to commit a future violent crime, compared to white defendants. Furthermore, when tracking these defendants after their risk assessment was done, it was found that in many cases, the white defendants, which the computer rated as low risk, went on to commit further crimes, while the higher-rated black defendants did not.\n\nAlgorithmic bias can also lead to the exclusion of certain groups of people from the use of new technology. In 2018, MIT Media Lab published a video on YouTube featuring Joy Buolamwini, who was then a MIT PhD student (Youtube, 2018). In the video, which is embeded below, Ms Buolamwini shared about her thesis project, nicknamed \"Gender Shades\", where she explores how accurate the gender classification software from three different companies worked with faces of different skin tones. Her conclusion was that people with darker skintones have a higher tendency to be misgendered by these softwares, hinting at the low representation of such people in the datasets the softwares were trained on.","metadata":{}},{"cell_type":"code","source":"from IPython.display import YouTubeVideo\nYouTubeVideo('TWWsW1w-BVo')","metadata":{"execution":{"iopub.status.busy":"2023-07-16T02:21:32.213103Z","iopub.execute_input":"2023-07-16T02:21:32.213742Z","iopub.status.idle":"2023-07-16T02:21:32.327603Z","shell.execute_reply.started":"2023-07-16T02:21:32.213707Z","shell.execute_reply":"2023-07-16T02:21:32.326511Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"To discriminate or shut out certain groups of people in the use of technology does not create a fair society. In Kant's theories, it violates the second and third formulas that we should treat everyone with dignity and respect, in an manner that is acceptable to all. To create ethically sound AI technology that is fairer for all, AI engineers must engage a conscious effort to avoid biased data and algorithmic bias. In a literature review of papers about algorithmic bias, Kordzadeh and Ghasemaghaei (2021) proposed that if users of AI systems perceive the systems to be fair, they are more likely to trust them. The danger is that these users may experience confirmation bias when they encounter biased AI systems that align with their own biased beliefs. Users who are not familiar with the concept of algorithmic bias may consider that computers, which has no concept of discrimination, cannot be wrong in their calculations, and therefore the AI systems' conclusions must therefore be representative of the world. The duty to create unbiased AI systems falls to the AI engineers, whose understanding of algorithmic bias is more complete due to their expertise in the field, in order to avoid encouraging the deep-seated biases that humans have against people who are different from themselves.","metadata":{}},{"cell_type":"markdown","source":"### Copyright\n\nIn recent years, AI generated art from platforms such as DALL.E and MidJourney have become popular among companies and individuals looking for a cheap and quick illustration to go along with their text. However, generative AI requires a large amounts of data to learn from, and much of the modern art available online is protected by the Creative Commons \"BY\" license that requires that the use of the artpiece be accompanied with attribution back to the author. \n\nIn June 2023, following the European Union (EU)'s release of a draft of their law regarding AI, a debate was held the matter of generative AI, art and copyright. The draft AI Act states that generative AI will have to comply with several transparency requirements, including publishing summaries of copyrighted data used for training. After the debate, Creative Commons posted on their website a pledge to \"represent the public interest in negotiations around AI policy\" and their hope to \"support the development of this technology while also respecting the work of human creators\" (Creative Commons, 2023).\n\nTo violate copyright is akin to stealing one's work. If we examine this modern form of theft against Kant's first formula, we realise that it is unacceptable as a world where everyone steals freely from each other would lead to a complete breakdown of trust in the society. Developers of generative AI must thus strive towards achieving the transparency that the EU's AI Act calls for. ","metadata":{}},{"cell_type":"markdown","source":"### Human-Labelled Data\n\nSupervised learning, one of the most popular machine learning paradigms for its ease of application and accurate results, requires massive amounts of labelled data. For example, a simple Twitter Sentiment Analysis predictor would need to be trained on thousands of tweets labelled with their respective sentiments or moods. While methods have been developed to get AI to tag data by itself, the accuracy is may not be high and human intervention is still required to ensure better accuracy. After all, we are training artificial intelligence that mimics human intelligence - the way humans behave and make decisions.\n\nOften, it is also simply cheaper to hire humans to do the work manually. Since 2007, when AI researcher Fei-Fei Li hired thousands of workers through Amazon's Mechanical Turk, a crowdsourcing platform for finding people to complete small tasks at low cost, the salary of \"professional\" annotators have not increased by much, despite the middlemen companies that hire them earning billions (Dzieza, 2023).\n\nThe exploitation of low wage workers to annotate or label data is reminiscent of the use of sweatshops to produce fast fashion clothing for multi-billion dollar corporations. The companies' self-serving nature in making great profits off the labour of these low wage workers falls squarely in violation of Kant's second formula, where these corporations are treating humanity as a means to their ends. Just as people have called a boycott on fast fashion labels, this author wonders if we will eventually see a similar fate for large corporations that exploit their data annotators, and how effective such a boycott would prove to be.","metadata":{}},{"cell_type":"markdown","source":"## Ethics in the Use of AI\n\nOne of the biggest concerns in the use of generative AI is misinformation when the AI generates information that is untrue. But ethics in the use of AI goes beyond the era of generative AI. It has long been debated who will shoulder the responsibility when AI systems make the wrong decision. How can we ensure that AI and humanity co-exist, so we can keep advancing technologically without the constant threat of AI taking over?","metadata":{}},{"cell_type":"markdown","source":"### Misinformation\n\nLarge language models like ChatGPT are primarily concerned with generating results that grammatically and logically sound when read together with the given prompt. Factual accuracy scores low in priority of the output. OpenAI, the company who developed ChatGPT, acknowledges the problem, admitting that \"ChatGPT sometimes writes plausible-sounding but incorrect or nonsensical answers\" (OpenAI, 2022).  \n\nDespite this, many people still go to ChatGPT for answers. The Assurance Theory of testimony states that in telling something, a speaker offers their assurance that they are speaking the truth (Graham, 2023). Although the Assurance Theory precludes AI machines as they are not human, the chatbot's effective communication with humans and its confidence in the answers it produces compels us to offer our trust.\n\nTherefore, ChatGPT and other chatbots' so-called hallucinations can cause a dangerous spread of misinformation in society when the results produced by generative AI are believed and shared by humans without thorough fact-checking. As a community of \"rational agents\", as Kant's third formula puts it, users of AI need to be more prudent in how they approach the responses that generative AI produces, so as to treat the information produced and subsequently shared an ethical manner.","metadata":{}},{"cell_type":"markdown","source":"### Moral Responsibility\n\nOn a larger scale to chatbots being responsible for the misinformation they produce, is the dilemma that AI systems are responsible for the decisions they make. At the forefront of this debate is the topic of autonomous vehicles (AVs). Should a traffic accident occur involving an AV, who should be liable in court to compensate the victim: the AI itself, the company who manufactured the AV and the AI system behind it, or the human who sat at the wheel of the vehicle and should have been looking out for dangers on the road?\n\nTaking reference from \"Aristotelian ethics and contemporary philosophical research\", Constantinescu et al. (2022) created a Moral Responsibility Test and, upon applying it to these autonomous AI systems, it was concluded that \"AI cannot qualify as morally responsible agents\". This conclusion is unnerving for companies and individuals who reply of AI to make decisions for them. If the AI system cannot be responsible for the decisions made, then the ownership must then fall to the humans who sanctioned the use of the AI system.\n\nEven if we were to judge that AI can be responsible for the fault or poor decision making, we need to consider that AI systems often draw from various sources before coming to a conclusion and decision. However, it is difficult to map \"how the multitude of data and features considered by an AI system contribute to specific conclusions\" (Mittelstadt, 2021). Furthermore, some of these information sources may be so tangled together that it is difficult to pick them apart to tell which accurately which source contributed most to the decision made. Fueling the problem is the opacity of AI systems; the \"black box\" in which \"the logic behind turning inputs into outputs may not be known to observers or affected parties or may be fundamentally inscrutable or unintelligible\" (Mittelstadt, 2021). As such, when things go wrong, it is nearly impossible to identify the source of the error and attribute blame, even if we wanted to blame the AI.\n\nIf we attribute blame on AI systems when they cannot understand the decisions being made, let alone be made responsible for them, we as humans are shirking our own moral responsibility. Examining the situation through the lens of Kant's first formula, if everyone were to insist that AI systems take the blame for their errors in judgement, we would degenerate into a lawless society where companies and individuals cannot be held responsible, even though they could potentially have done something to intervene with the AI system and avoid a bad decision. Laws and consequences exist to guide human behaviour and compel us to be more shrewd in our decisions. Being able to blame AI systems would be a get-out-of-jail-free card that enables less morally-inclined companies and individuals to act immorally without fear of repercussions. Therefore, we must insist that companies and individuals still hold most, if not all, of the responsibility for the decisions that autonomous AI systems in their care make,","metadata":{}},{"cell_type":"markdown","source":"## Conclusion\n\nWe have examined five issues about AI ethics through the lens of Kantian ethics. In each situation, the conclusion always seems to be that humans need to be more careful with the AI systems they design and use in order to maintain the fair and inclusive society that we have worked hard to build. For AI engineers, more thought needs to be put into the ethics of the AI systems they create. It is imperative that AI ethics is a critical subject that needs to be taught to all data scientists and AI engineers, so they may keep these issues in mind as they create AI systems. Companies should also consider adding AI ethicists onto their payroll, as the systems they create has potential to reach and impact a wider audience of users.\n\nUsers of AI systems should not be spared the responsibility of ethical use of AI. More can be done to educate society about ethical issues so AI systems can be used in a responsible manner. \n\nA key consideration that both developers and users of AI can apply is the \"human-in-the-loop\" principle, where humans control the learning and decision-making process of the AI system. Traditionally, \"human-in-the-loop\" refers to humans having the final say in implementing the decisions recommended by AI. The principle has recently expanded its definition to include humans being involved in the learning process. This leads to a more transparent and explanable training where the AI is able to explain the rationale behind the decision made (Mosqueira-Rey et al., 2022).\n\nAI has long held humans enthralled with its recent developments and rapid growth. However, now is the time to take a step back and shift our focus away from \"how can we make AI more accurate\", to \"how can we make AI more ethical, inclusive and fair\". After all, it is our ability to think and act ethically that makes us who we are.","metadata":{}},{"cell_type":"markdown","source":"## Acknowledgements\n\nThis author would like to thank all reviewers who have read and provided their comments on the first version of this essay. \n\nSpecial acknowledgements go out to the Kaggle community member who goes by the username Morgan, who shared the anecdote of the exploitation of data annotators, which was too rich not to include in the final version of this essay. Thank you.","metadata":{}},{"cell_type":"markdown","source":"## References\n\nAngwin, J., Larson, J., Kirchner, L., &amp; Mattu, S. (2016, May 23). Machine bias. ProPublica. https://www.propublica.org/article/machine-bias-risk-assessments-in-criminal-sentencing \n\nConstantinescu, M., Vică, C., Uszkai, R. et al. Blame It on the AI? On the Moral Responsibility of Artificial Moral Advisors. Philos. Technol. 35, 35 (2022). https://doi.org/10.1007/s13347-022-00529-z\n\nCreative Commons. (2023, July 1). CC joins key AI panel in Brussels. Creative Commons. https://creativecommons.org/2023/07/01/cc-joins-key-ai-panel-in-brussels/ \n\nDzieza, J. (2023, June 20). Ai is a lot of work. The Verge. https://www.theverge.com/features/23764584/ai-artificial-intelligence-data-notation-labor-scale-surge-remotasks-openai-chatbots \n\nGraham, M. (2023, March 9). Chatgpt can’t lie to you, but you still shouldn’t trust it. The Conversation. https://theconversation.com/chatgpt-cant-lie-to-you-but-you-still-shouldnt-trust-it-201127 \n\nKordzadeh, N., &amp; Ghasemaghaei, M. (2021). Algorithmic bias: Review, synthesis, and future research directions. European Journal of Information Systems, 31(3), 388–409. https://doi.org/10.1080/0960085x.2021.1927212 \n\nMittelstadt, B. (2021, December). The impact of Artificial Intelligence on the Doctor-Patient Relationship. https://rm.coe.int/inf-2022-5-report-impact-of-ai-on-doctor-patient-relations-e/1680a68859 \n\nMosqueira-Rey, E., Hernández-Pereira, E., Alonso-Ríos, D., Bobes-Bascarán, J., &amp; Fernández-Leal, Á. (2022). Human-in-the-loop machine learning: A state of the art. Artificial Intelligence Review, 56(4), 3005–3054. https://doi.org/10.1007/s10462-022-10246-w \n\nOpenAI. (2022, November 30). Introducing chatgpt. OpenAI Blog. https://openai.com/blog/chatgpt/ \n\nSingh Ashudeep and Joachims Thorsten (2019). Policy learning for fairness in ranking. arXiv:1902.04056. Retrieved from https://arxiv.org/abs/1902.04056.\n\nWilburn, H. (2022, August 12). An Introduction to Kant’s Moral Theory. Pressbooks. https://open.library.okstate.edu/introphilosophy/chapter/a-brief-overview-of-kants-moral-theory/\n\nYouTube. (2018). Gender Shades. YouTube. Retrieved July 2, 2023, from https://www.youtube.com/watch?v=TWWsW1w-BVo&amp;ab_channel=MITMediaLab. ","metadata":{}}]}