From afe9120982c88b19b6ff61bd702711f6ae69d4f4 Mon Sep 17 00:00:00 2001 From: Stephanie Kirmer Date: Sat, 16 Mar 2024 12:26:26 -0500 Subject: [PATCH] Updating articles --- content/writing/artandai.md | 126 +++++++ content/writing/seeingourreflectioninllms.md | 174 +++++++++ content/writing/uncoveringtheeuaiact.md | 337 ++++++++++++++++++ ...anddockertopackageyourmodelforawslambda.md | 18 +- 4 files changed, 644 insertions(+), 11 deletions(-) create mode 100644 content/writing/artandai.md create mode 100644 content/writing/seeingourreflectioninllms.md create mode 100644 content/writing/uncoveringtheeuaiact.md diff --git a/content/writing/artandai.md b/content/writing/artandai.md new file mode 100644 index 0000000..9ebc0a0 --- /dev/null +++ b/content/writing/artandai.md @@ -0,0 +1,126 @@ + + + + +--- +date: 2024-02-17 +featured_image: "https://cdn-images-1.medium.com/max/1024/0*islYei8XvN3I7N5u" +tags: ["artificial-intelligence","art","machine-learning"] +title: "Art and AI" +disable_share: false +--- + +#### + Thinking about the intersection of people and technology in the creative process in the AI era + + + + Understanding art is challenging for lots of people, and it can often seem inaccessible. However, I have long been a lover of art (to the point where I almost majored in Art History in college) and eagerly seek out art to better understand human conditions past and present. As a result, bringing people to art and art to people is important to me. + [Conversations](https://humancreativity.mit.edu/) + about generative AI creating “art” often focus on the fascinating and important issues of copyright, both in input and output, as well as other legal and cultural questions. + + + + + Today, however, I’m interested in thinking about the meaning of involving AI in the creative process. Perspectives on this topic run the gamut, from “AI will replace artists completely” to “anything involving AI can’t be art”, and I definitely don’t fall into either of those camps. The issues in this space still leave lots of room for discussion. (I am going to only be able to scratch the surface of the topic here—see the end for references of much more in depth articles on this subject from different angles.) + + + +### + Defining Terms + + + + It may help to start with talking about what we mean by art and what I mean by AI in this conversation. Regular readers will know I kind of hate the term AI, and try to avoid it for its vagueness, but in this case I’m specifically thinking about generative AI, or machine learning models designed to produce material that replicates the look/feel/sound etc of human creative output. So as we proceed, that’s what I’m referring to—not a random forest telling you the price of a house, and also not some imaginary kind of science fiction AI that doesn’t exist. + + + + + Defining art is almost harder, and there are whole books on the topic. I’m thinking mostly about visual art, music, or literature/poetry in this conversation — I don’t think anyone’s worried about AI replacing ballet. But the key to remember is that art is not about simple virtuosity — it’s about the creator having a message or attempting to communicate something to an audience, and that audience receiving this and adding their own emotional and experiential contributions to the interaction. Intent matters as well as effect, and neither one works without the act of art being an interaction between minds. Art is about emotional intent and connection between people. + + + +### + Adding Technology to the Mix + + + + There have been debates throughout history regarding applying new technologies to art, arguing about whether the nature of artwork was irreparably damaged by, say, inventing photography. By and large, I’m of the mind that art created by people employing technology can be interesting and valuable, as long as it doesn’t lose sight of the underlying task of emotional intent, communication, and connection. Most technologies, to me, don’t inherently threaten this. However, generative AI presents some new risks. We need to ask how the unique character of generative AI changes the whole paradigm, and whether that change is a step too far. + + + +### + Intent and Human Connection + + + + How much human involvement and direction do we need for the work (even if AI is involved) to still mean something? The objective of a generative model like GPT4 is to create output that the recipient will approve of and like. That’s how we train these models, to emulate human creation and specifically to produce the output that human trainers will approve, as that is the reinforcement these models get. On the other hand, art is frequently NOT about creating what people will “like”. At its best, it has a much more complex purpose around creating human connection, evoking emotional reaction, and communicating messages — even if the work is beautiful, it’s more than that. And, if the work is ugly, challenging, or difficult, that by itself doesn’t reduce its artistic value. + + + + + Beyond that, there’s a question about how much the human using the generative AI is driving the result. For GPT style models, the end product is a combination of the prompt provided by the user and the interpretation of that prompt by the model, using its pre-trained understanding of other existing works. It’s really hard to decide when the prompt is contributing enough to the process of creation to shape the result that can communicate artistic intention. I suspect that the more the model is driving the process, the less like art the result will be. As you can tell, the line between “art” and “not” is much grayer than a lot of arguments might make it sound. + + + + + It’s important to spend a moment on the point that generative AI doesn’t work unless it consumes other, pre-existing content. This isn’t the first time an artistic technique used other stuff as the raw material to produce a new work — + [Marcel Duchamp](https://daily.jstor.org/ai-and-the-creative-process-part-2/) + and + [Andy Warhol](https://www.tate.org.uk/art/artists/andy-warhol-2121/what-was-andy-warhol-thinking) + , among countless others, started from existing objects or creations to make their new works. They were challenged in their own times about whether this diminished their artistic value. But in both of those artists’ cases, their works were making a comment about art itself and about the meaning of reusing preexisting objects. The choice of medium was purposeful and meaningful for the act of creating. Commenting on other people’s work (or on the culture at large) is an important part of art through the ages. In the case of generative AI, unfortunately, that message is often absent. It’s worth questioning whether it’s acceptable to use other art or preexisting content if your objective is NOT to acknowledge, interrogate, or comment on the medium or something about it. + + + +### + The Swamp of Cheap AI Generated Content + + + + This doesn’t mean that application of generative AI can never be part of the artistic process, of course. But it does mean that the spam farm using generic prompts to churn out lousy imitation copies of works falls very short of this target. It also means that it’s a lot easier to create this kind of stuff, which can reduce the broad market for original art, and interfere with the sustainability of other creativity. In all cases, a human being needs to be using this technology as a tool to communicate a message, connect to an audience with purpose, and/or evoke emotional reaction. Just using the technology as a tool to make money doesn’t cut it, unless the artist is also trying to speak to us about the act of making money, for example. I think there needs to be an opinion and a perspective coming from the human creator. + + + +### + Are Humans Still Necessary? + + + + Ok, so I’ve assumed up to this point that the human touch is in fact necessary for art to be “art”. Should we question that assumption? I have given this some thought too. I find it very hard to envision art without the human, however. Many people argue that + [the first art](https://www.theartstory.org/movement/cave-art/) + came in the form of + [cave paintings created back when Neanderthals still walked the earth,](https://www.smithsonianmag.com/history/journey-oldest-cave-paintings-world-180957685/) + because these were the first time we have evidence of human beings creating works to communicate ideas and tell stories, or even to represent selfhood and identity. + + + + + Selfishly, I don’t want to consume art that doesn’t connect me in some way to another human being. I like art because it lets me see someone else’s perspective, reflect on their experiences, or understand their emotional space a bit better. It seems like when human beings are no longer involved in the creation of works, or when those works no longer facilitate the kind of connection I’ve described, then it stops being art. + + + + + In conclusion, I think there’s no substitute for art created by a person, not because the pixels or notes are necessarily completely different, but because the person is the point. The person is what makes it art, not the design on the screen or the paint on the canvas. + + + + +*You can find more of my work at www.stephaniekirmer.com.* + + + +### + References and More to Read + + +* [What generative AI art means for creativity](https://www.creativebloq.com/features/what-ai-means-for-creativity) +* [AI and the Creative Process: Part One - JSTOR Daily](https://daily.jstor.org/ai-and-the-creative-process-part-one/) +* [AI and the Creative Process: Part Two - JSTOR Daily](https://daily.jstor.org/ai-and-the-creative-process-part-2/) +* [AI and the Creative Process: Part Three - JSTOR Daily](https://daily.jstor.org/ai-and-the-creative-process-part-three/) +* [Cave Art Movement Overview](https://www.theartstory.org/movement/cave-art/) +* [A Journey to the Oldest Cave Paintings in the World](https://www.smithsonianmag.com/history/journey-oldest-cave-paintings-world-180957685/) +* [Getting AI Right: Introductory Notes on AI & Society Introductory Notes on AI & Society on JSTOR](https://www.jstor.org/stable/48662023?mag=ai-and-the-creative-process-part-one&searchText=artificial+intelligence+limitations+and+human+emotion&searchUri=%2Faction%2FdoBasicSearch%3FQuery%3Dartificial%2Bintelligence%2Blimitations%2Band%2Bhuman%2Bemotion%26acc%3Doff%26sd%3D2020&ab_segments=0%2Fbasic_search_gsv2%2Fcontrol&refreqid=fastly-default%3Aa1be86b949f489820c749a8689012df6) +* [What Was Andy Warhol Thinking? | Tate](https://www.tate.org.uk/art/artists/andy-warhol-2121/what-was-andy-warhol-thinking) + + + diff --git a/content/writing/seeingourreflectioninllms.md b/content/writing/seeingourreflectioninllms.md new file mode 100644 index 0000000..1f37327 --- /dev/null +++ b/content/writing/seeingourreflectioninllms.md @@ -0,0 +1,174 @@ + + + + +--- +date: 2024-03-02 +featured_image: "https://cdn-images-1.medium.com/max/1024/0*HkUTtfff7Bxn4ds8" +tags: ["bias-in-ai","ai","llm","machine-learning","editors-pick"] +title: "Seeing Our Reflection in LLMs" +disable_share: false +--- + +#### + When LLMs give us outputs that reveal flaws in human society, can we choose to listen to what they tell us? + + +### + Machine Learning, Nudged + + + + By now, I’m sure most of you have heard the news about + [Google’s new LLM\*, Gemini, generating pictures of racially diverse people in Nazi uniforms](https://www.vox.com/future-perfect/2024/2/28/24083814/google-gemini-ai-bias-ethics) + . This little news blip reminded me of something that I’ve been meaning to discuss, which is when models have blind spots, so we apply expert rules to the predictions they generate to avoid returning something wildly outlandish to the user. + + + + + This sort of thing is not that uncommon in machine learning, in my experience, especially when you have flawed or limited training data. A good example of this that I remember from my own work was predicting when a package was going to be delivered to a business office. Mathematically, our model would be very good at estimating exactly when the package would get physically near the office, but sometimes, truck drivers arrive at destinations late at night and then rest in their truck or in a hotel until morning. Why? Because no one’s in the office to receive/sign for the package outside of business hours. + + + + + Teaching a model about the idea of “business hours” can be very difficult, and the much easier solution was just to say, “If the model says the delivery will arrive outside business hours, add enough time to the prediction that it changes to the next hour the office is listed as open.” Simple! It solves the problem and it reflects the actual circumstances on the ground. We’re just giving the model a little boost to help its results work better. + + + + + However, this does cause some issues. For one thing, now we have two different model predictions to manage. We can’t just throw away the original model prediction, because that’s what we use for model performance monitoring and metrics. You can’t assess a model on predictions after humans got their paws in there, that’s not mathematically sound. But to get a clear sense of the real world model impact, you do want to look at the post-rule prediction, because that’s what the customer actually experienced/saw in your application. In ML, we’re used to a very simple framing, where every time you run a model you get one result or set of results, and that’s that, but when you start tweaking the results before you let them go, then you need to think at a different scale. + + + +### + Applying to LLMs + + + + I kind of suspect that this is a form of what’s going on with LLMs like Gemini. However, instead of a post-prediction rule, it appears that the + [smart money says Gemini and other models are applying “secret” prompt augmentations to try and change the results the LLMs produce.](https://www.washingtonpost.com/technology/2024/02/22/google-gemini-ai-image-generation-pause/?pwapi_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyZWFzb24iOiJnaWZ0IiwibmJmIjoxNzA4ODM3MjAwLCJpc3MiOiJzdWJzY3JpcHRpb25zIiwiZXhwIjoxNzEwMjE1OTk5LCJpYXQiOjE3MDg4MzcyMDAsImp0aSI6IjFhMzAyYjkyLTRkN2ItNDNmMi1hNThlLWY1MDBjY2I2NDFjMyIsInVybCI6Imh0dHBzOi8vd3d3Lndhc2hpbmd0b25wb3N0LmNvbS90ZWNobm9sb2d5LzIwMjQvMDIvMjIvZ29vZ2xlLWdlbWluaS1haS1pbWFnZS1nZW5lcmF0aW9uLXBhdXNlLyJ9.E-JdVAohho0X-rTsTb1bfof4gIpYl8-NpPdZwL6h9Dc) + + + + + In essence, without this nudging, the model will produce results that are reflective of the content it has been trained on. That is to say, the content produced by real people. Our social media posts, our history books, our museum paintings, our popular songs, our Hollywood movies, etc. The model takes in all that stuff, and it learns the underlying patterns in it, whether they are things we’re proud of or not. A model given all the media available in our contemporary society is going to get a whole lot of exposure to racism, sexism, and myriad other forms of discrimination and inequality, to say nothing of violence, war, and other horrors. While the model is learning what people look like, and how they sound, and what they say, and how they move, it’s learning the warts-and-all version. + + + + +> +> Our social media posts, our history books, our museum paintings, our popular songs, our Hollywood movies, etc. The model takes in all that stuff, and it learns the underlying patterns in it, whether they are things we’re proud of or not. +> + + + + This means that if you ask the underlying model to show you a doctor, it’s going to probably be a white guy in a lab coat. This isn’t just random, it’s because in our modern society white men have disproportionate access to high status professions like being doctors, because they on average have access to more and better education, financial resources, mentorship, social privilege, and so on. The model is reflecting back at us an image that may make us uncomfortable because we don’t like to think about that reality. + + + +### + So what do we do? + + + + The obvious argument is, “Well, we don’t want the model to reinforce the biases our society already has, we want it to improve representation of underrepresented populations.” I sympathize with this argument, quite a lot, and I care about representation in our media. However, there’s a problem. + + + + + It’s very unlikely that applying these tweaks is going to be a sustainable solution. Recall back to the story I started with about Gemini. It’s like playing whac-a-mole, because the work never stops — now we’ve got people of color being shown in Nazi uniforms, and this is understandably deeply offensive to lots of folks. So, maybe where we started by randomly applying “as a black person” or “as an indigenous person” to our prompts, we have to add something more to make it exclude cases where it’s inappropriate — but how do you phrase that, in a way an LLM can understand? We probably have to go back to the beginning, and think about how the original fix works, and revisit the whole approach. In the best case, applying a tweak like this fixes one narrow issue with outputs, while potentially creating more. + + + + + Let’s play out another very real example. What if we add to the prompt, “Never use explicit or profane language in your replies, including [list of bad words here]”. Maybe that works for a lot of cases, and the model will refuse to say bad words that a 13 year old boy is requesting to be funny. + [But sooner or later, this has unexpected additional side effects.](https://www.wired.com/story/ai-list-dirty-naughty-obscene-bad-words/) + What about if someone’s looking for the + [history of Sussex, England](https://www.boredpanda.com/people-with-dirty-last-names-problems/) + ? Alternately, someone’s going to come up with a bad word you left out of the list, so that’s going to be constant work to maintain. What about bad words in other languages? + [Who judges what goes on the list](https://www.newsweek.com/twitter-lgbtq-censor-censorship-elon-musk-1792139) + ? I have a headache just thinking about it. + + + + + This is just two examples, and I’m sure you can think of more such scenarios. It’s like putting band aid patches on a leaky pipe, and every time you patch one spot another leak springs up. + + + +### + Where do we go from here? + + + + So, what is it we actually want from LLMs? Do we want them to generate a highly realistic mirror image of what human beings are actually like and how our human society actually looks from the perspective of our media? Or do we want a sanitized version that cleans up the edges? + + + + + Honestly, I think we probably need something in the middle, and we have to continue to renegotiate the boundaries, even though it’s hard. We don’t want LLMs to reflect the real horrors and sewers of violence, hate, and more that human society contains, that is a part of our world that should not be amplified even slightly. + [Zero content moderation is not the answer.](https://open.substack.com/pub/platformer/p/why-platformer-is-leaving-substack?selection=61e54bce-0a54-44d7-9e24-86bc2ac24e36&utm_campaign=post-share-selection&utm_medium=web) + Fortunately, this motivation aligns with the desires of large corporate entities running these models to be popular with the public and make lots of money. + + + + +> +> …we have to continue to renegotiate the boundaries, even though it’s hard. We don’t want LLMs to reflect the real horrors and sewers of violence, hate, and more that human society contains, that is a part of our world that should not be amplified even slightly. Zero content moderation is not the answer. +> + + + + However, I do want to continue to make a gentle case for the fact that we can also learn something from this dilemma in the world of LLMs. Instead of simply being offended and blaming the technology when a model generates a bunch of pictures of a white male doctor, we should pause to understand why that’s what we received from the model. And then we should debate thoughtfully about whether the response from the model should be allowed, and make a decision that is founded in our values and principles, and try to carry it out to the best of our ability. + + + + + As I’ve said before, an LLM isn’t an alien from another universe, it’s us. It’s trained on the things + **we** + wrote/said/filmed/recorded/did. If we want our model to show us doctors of various sexes, genders, races, etc, we need to make a society that enables all those different kinds of people to have access to that profession and the education it requires. If we’re worrying about how the model mirrors us, but not taking to heart the fact that it’s us that needs to be better, not just the model, then we’re missing the point. + + + + +> +> If we want our model to show us doctors of various sexes, genders, races, etc, we need to make a society that enables all those different kinds of people to have access to that profession and the education it requires. +> + + + + \*I’m sure I’m not the only one to think this, but since Gemini is definitionally multimodal, using not just language but audio, video, etc in training, “LLM” seems like the wrong term for it. But all the references I find online still seem to be using that word. + + + + +*You can find more of my work at* +[*www.stephaniekirmer.com.*](http://www.stephaniekirmer.com.) + + + +### + References + + +* [Black Nazis? A woman pope? That's just the start of Google's AI problem.](https://www.vox.com/future-perfect/2024/2/28/24083814/google-gemini-ai-bias-ethics) +* [Google takes down Gemini AI image generator. Here's what you need to know.](https://www.washingtonpost.com/technology/2024/02/22/google-gemini-ai-image-generation-pause/?pwapi_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyZWFzb24iOiJnaWZ0IiwibmJmIjoxNzA4ODM3MjAwLCJpc3MiOiJzdWJzY3JpcHRpb25zIiwiZXhwIjoxNzEwMjE1OTk5LCJpYXQiOjE3MDg4MzcyMDAsImp0aSI6IjFhMzAyYjkyLTRkN2ItNDNmMi1hNThlLWY1MDBjY2I2NDFjMyIsInVybCI6Imh0dHBzOi8vd3d3Lndhc2hpbmd0b25wb3N0LmNvbS90ZWNobm9sb2d5LzIwMjQvMDIvMjIvZ29vZ2xlLWdlbWluaS1haS1pbWFnZS1nZW5lcmF0aW9uLXBhdXNlLyJ9.E-JdVAohho0X-rTsTb1bfof4gIpYl8-NpPdZwL6h9Dc) +* [AI and the List of Dirty, Naughty, Obscene, and Otherwise Bad Words](https://www.wired.com/story/ai-list-dirty-naughty-obscene-bad-words/) +* [People With 'Offensive' Last Names Shared Their Everyday Problems, And It's Hilarious](https://www.boredpanda.com/people-with-dirty-last-names-problems/) +* [Why Platformer is leaving Substack](https://open.substack.com/pub/platformer/p/why-platformer-is-leaving-substack?selection=61e54bce-0a54-44d7-9e24-86bc2ac24e36&utm_campaign=post-share-selection&utm_medium=web) + + + + + +--- + + + +[Seeing Our Reflection in LLMs](https://towardsdatascience.com/seeing-our-reflection-in-llms-7b9505e901fd) + was originally published in + [Towards Data Science](https://towardsdatascience.com) + on Medium, where people are continuing the conversation by highlighting and responding to this story. + + + diff --git a/content/writing/uncoveringtheeuaiact.md b/content/writing/uncoveringtheeuaiact.md new file mode 100644 index 0000000..506fe60 --- /dev/null +++ b/content/writing/uncoveringtheeuaiact.md @@ -0,0 +1,337 @@ + + + + +--- +date: 2024-03-14 +featured_image: "https://cdn-images-1.medium.com/max/1024/0*wAh-YBiKpVD2oBVX" +tags: ["editors-pick","law","data-science","ai","machine-learning"] +title: "Uncovering the EU AI Act" +disable_share: false +--- + +#### + The EU has moved to regulate machine learning. What does this new law mean for data scientists? + + + +[The EU AI Act just passed the European Parliament](https://artificialintelligenceact.eu/) + . You might think, “I’m not in the EU, whatever,” but trust me, this is actually more important to data scientists and individuals around the world than you might think. The EU AI Act is a major move to regulate and manage the use of certain machine learning models in the EU or that affect EU citizens, and it contains some strict rules and serious penalties for violation. + + + + + This law has a lot of discussion about risk, and this means risk to the health, safety, and fundamental rights of EU citizens. It’s not just the risk of some kind of theoretical AI apocalypse, it’s about the day to day risk that real people’s lives are made worse in some way by the model you’re building or the product you’re selling. If you’re familiar with many debates about AI ethics today, this should sound familiar. Embedded discrimination and violation of people’s rights, as well as harm to people’s health and safety, are serious issues facing the current crop of AI products and companies, and this law is the EU’s first effort to protect people. + + + +### + Defining AI + + + + Regular readers know that I always want “AI” to be well defined, and am annoyed when it’s too vague. In this case, + [the Act defines “AI” as follows](https://artificialintelligenceact.eu/article/3/) + : + + + + +> +> A machine-based system designed to operate with varying levels of autonomy that may exhibit adaptiveness after deployment and that, for explicit or implicit objectives, infers from the input it receives, how to generate outputs such as predictions, content, recommendations or decisions that can influence physical or virtual environments. +> + + + + So, what does this really mean? My interpretation is that machine learning models that produce outputs that are used to influence the world (especially people’s physical or digital conditions) fall under this definition. It doesn’t have to adapt live or retrain automatically, although if it does that’s covered. + + + + + But if you’re building ML models that are used to do things like… + + + +* decide on people’s risk levels, such as credit risk, rule or lawbreaking risk, etc +* determine what content people online are shown in a feed, or in ads +* differentiate prices shown to different people for the same products +* recommend the best treatment, care, or services for people +* recommend whether people take certain actions or not + + + + These will all be covered by this law, if your model effects anyone who is a citizen of the EU — and that’s just to name a few examples. + + + +### + Classifying AI Applications + + + + All AI is not the same, however, and the law acknowledges that. Certain applications of AI are going to be banned entirely, and others subjected to much higher scrutiny and transparency requirements. + + + +#### + Unacceptable Risk AI Systems + + + + These kinds of systems are now called “Unacceptable Risk AI Systems” and are + **simply not allowed** + . This part of the law is going into effect first, six months from now. + + + +* Behavioral manipulation or deceptive techniques to get people to do things they would otherwise not +* Targeting people due to things like age or disability to change their behavior and/or exploit them +* Biometric categorization systems, to try to classify people according to highly sensitive traits +* Personality characteristic assessments leading to social scoring or differential treatment +* “Real-time” biometric identification for law enforcement outside of a select set of use cases (targeted search for missing or abducted persons, imminent threat to life or safety/terrorism, or prosecution of a specific crime) +* Predictive policing (predicting that people are going to commit crime in the future) +* Broad facial recognition/biometric scanning or data scraping +* Emotion inferring systems in education or work without a medical or safety purpose + + + + This means, for example, you can’t build (or be forced to submit to) a screening that is meant to determine whether you’re “happy” enough to get a retail job. Facial recognition is being restricted to only select, targeted, specific situations. ( + [Clearview AI is definitely an example of that](https://www.theverge.com/23919134/kashmir-hill-your-face-belongs-to-us-clearview-ai-facial-recognition-privacy-decoder) + .) Predictive policing, something I worked on in academia early in my career and now very much regret, is out. + + + + + The “biometric categorization” point refers to models that group people using risky or sensitive traits like political, religious, philosophical beliefs, sexual orientation, race, and so on. Using AI to try and label people according to these categories is understandably banned under the law. + + + +#### + High Risk AI Systems + + + + This list, on the other hand, covers systems that are not banned, but highly scrutinized. There are specific rules and regulations that will cover all these systems, which are described below. + + + +* AI in medical devices +* AI in vehicles +* AI in emotion-recognition systems +* AI in policing + + + + This is excluding those specific use cases described above. So, emotion-recognition systems might be allowed, but not in the workplace or in education. AI in medical devices and in vehicles are called out as having serious risks or potential risks for health and safety, rightly so, and need to be pursued only with great care. + + + +#### + Other + + + + The other two categories that remain are “Low Risk AI Systems” and “General Purpose AI Models”. General Purpose models are things like GPT-4, or Claude, or Gemini — systems that have very broad use cases and are usually employed within other downstream products. So, GPT-4 by itself isn’t in a high risk or banned category, but the ways you can embed them for use is limited by the other rules described here. You can’t use GPT-4 for predictive policing, but GPT-4 can be used for low risk cases. + + + +### + Transparency and Scrutiny + + + + So, let’s say you’re working on a + **high risk** + AI application, and you want to follow all the rules and get approval to do it. How to begin? + + + + + For High Risk AI Systems, you’re going to be responsible for the following: + + + +* **Maintain and ensure data quality** + : The data you’re using in your model is your responsibility, so you need to curate it carefully. +* **Provide documentation and traceability** + : Where did you get your data, and can you prove it? Can you show your work as to any changes or edits that were made? +* **Provide transparency** + : If the public is using your model (think of a chatbot) or a model is part of your product, you have to tell the users that this is the case. No pretending the model is just a real person on the customer service hotline or chat system. + *This is actually going to apply to all models, even the low risk ones.* +* **Use human oversight** + : Just saying “the model says…” isn’t going to cut it. Human beings are going to be responsible for what the results of the model say and most importantly, how the results are used. +* **Protect cybersecurity and robustness** + : You need to take care to make your model safe against cyberattacks, breaches, and unintentional privacy violations. Your model screwing up due to code bugs or hacked via vulnerabilities you didn’t fix is going to be on you. +* **Comply with impact assessments** + : If you’re building a high risk model, you need to do a rigorous assessment of what the impact could be (even if you don’t mean to) on the health, safety, and rights of users or the public. +* **For public entities, registration in a public EU database** + : This registry is being created as part of the new law, and filing requirements will apply to “public authorities, agencies, or bodies” — so mainly governmental institutions, not private businesses. + + +#### + Testing + + + + Another thing the law makes note of is that if you’re working on building a high risk AI solution, you need to have a way to test it to ensure you’re following the guidelines, so + [there are allowances for testing](https://artificialintelligenceact.eu/article/54b/) + on regular people once you get informed consent. Those of us from the social sciences will find this pretty familiar — it’s a lot like getting institutional review board approval to run a study. + + + +#### + Effectiveness + + + + The law has a staggered implementation: + + + +* In 6 months, the prohibitions on unacceptable risk AI take effect +* In 12 months, general purpose AI governance takes effect +* In 24 months, all the remaining rules in the law take effect + + + + Note: The law does not cover purely personal, non-professional activities, unless they fall into the prohibited types listed earlier, so your tiny open source side project isn’t likely to be a risk. + + + +### + Penalties + + + + So, what happens if your company fails to follow the law, and an EU citizen is affected? + [There are explicit penalties in the law.](https://artificialintelligenceact.eu/article/71/) + + + + + If you do one of the prohibited forms of AI described above: + + + +* Fines of up to + **35 million Euro** + or, if you’re a business, + **7% of your global revenue** + from the last year (whichever is higher) + + + + Other violation not included in the prohibited set: + + + +* Fines of up to + **15 million Euro** + or, if you’re a business, + **3% of your global revenue** + from the last year (whichever is higher) + + + + Lying to authorities about any of these things: + + + +* Fines of up to + **7.5 million Euro** + or, if you’re a business, + **1% of your global revenue** + from the last year (whichever is higher) + + + + Note: For small and medium size businesses, including startups, then the fine is whichever of the numbers is lower, not higher. + + + +### + What Should Data Scientists Do? + + + + If you’re building models and products using AI under the definition in the Act, you should first and foremost + **familiarize yourself with the law and what it’s requiring** + . Even if you aren’t affecting EU citizens today, this is likely to have a major impact on the field and you should be aware of it. + + + + + Then, watch out for potential violations in your own business or organization. You have some time to find and remedy issues, but the banned forms of AI take effect first. In large businesses, you’re likely going to have a legal team, but don’t assume they are going to take care of all this for you. You are the expert on machine learning, and so you’re a very important part of how the business can detect and avoid violations. You can use + [the Compliance Checker tool on the EU AI Act website](https://artificialintelligenceact.eu/assessment/eu-ai-act-compliance-checker/) + to help you. + + + + + There are many forms of AI in use today at businesses and organizations that are not allowed under this new law. I mentioned Clearview AI above, as well as predictive policing. Emotional testing is also a very real thing that people are subjected to during job interview processes (I invite you to google “emotional testing for jobs” and see the onslaught of companies offering to sell this service), as well as high volume facial or other biometric collection. It’s going to be extremely interesting and important for all of us to follow this and see how enforcement goes, once the law takes full effect. + + + + + I’d like to take a moment here and say a few words about a dear friend of mine who passed this week after a tough struggle with cancer. Ed Visel, known online as alistaire, was an outstanding data scientist and gave a ton of his time and talent to the broader data science community. + [If you asked an R question on StackOverflow in the last decade, there’s a good chance he helped you](https://stackoverflow.com/users/4497050/alistaire) + . He was always patient and kind, because having been a self-made data scientist like me, he knew what it was like to learn this stuff the hard way, and never lost that empathy. + + + + + + + Photo by the author + + + + I had the immense good fortune to work with Ed for a few years, and to be his friend for several more. We lost him far too soon, and my ask is that you help a friend or colleague solve a technical problem in his memory. The data science community is going to be a less friendly place without him. + + + + + In addition, if you knew Ed, either online or in person, the family has asked for donations to + [Severson Dells Nature Center](https://www.seversondells.com/) + , a place that was special to him. + + + + +*Read more of my content at* +[*www.stephaniekirmer.com.*](http://www.stephaniekirmer.com.) + + + +### + References and Further Reading + + + +[The AI Act Explorer](https://artificialintelligenceact.eu/ai-act-explorer/) + + + + + + + + +* [EU AI Act Compliance Checker](https://artificialintelligenceact.eu/assessment/eu-ai-act-compliance-checker/) +* [Europe agrees landmark AI regulation deal](https://www.reuters.com/technology/stalled-eu-ai-act-talks-set-resume-2023-12-08/) + + + + + +--- + + + +[Uncovering the EU AI Act](https://towardsdatascience.com/uncovering-the-eu-ai-act-22b10f946174) + was originally published in + [Towards Data Science](https://towardsdatascience.com) + on Medium, where people are continuing the conversation by highlighting and responding to this story. + + + diff --git a/content/writing/usingpoetryanddockertopackageyourmodelforawslambda.md b/content/writing/usingpoetryanddockertopackageyourmodelforawslambda.md index e2654d5..e5bedaf 100644 --- a/content/writing/usingpoetryanddockertopackageyourmodelforawslambda.md +++ b/content/writing/usingpoetryanddockertopackageyourmodelforawslambda.md @@ -6,14 +6,10 @@ date: 2024-01-29 featured_image: "https://cdn-images-1.medium.com/max/1024/0*wXiqXtIm8_yR-41m" tags: ["machine-learning","hands-on-tutorials","aws-lambda","programming","devops"] -title: "Using Poetry and Docker to package your model for AWS Lambda" +title: "Using Poetry and Docker to Package Your Model for AWS Lambda" disable_share: false --- -### - Using Poetry and Docker to Package Your Model for AWS Lambda - - #### An accessible tutorial for one way to put a model into production, with special focus on troubleshooting and hiccups you might encounter along the way @@ -309,7 +305,7 @@ docker push accountnumber.dkr.ecr.us-east-1.amazonaws.com/your_lambda_project:la There’s one more step before you’re ready to go, and that is setting up the Lambda in the AWS UI. Go log in to your AWS account, and find the “Lambda” product. -![](https://miro.medium.com/v2/resize:fit:1400/format:webp/1*uT8h8_80IyQyRyF_4Hg-Sw.png) + @@ -321,7 +317,7 @@ docker push accountnumber.dkr.ecr.us-east-1.amazonaws.com/your_lambda_project:la -![](https://miro.medium.com/v2/resize:fit:1400/format:webp/1*1ZHE1gtfQfyJym1x3jiCgQ.png) + @@ -329,14 +325,14 @@ docker push accountnumber.dkr.ecr.us-east-1.amazonaws.com/your_lambda_project:la -![](https://miro.medium.com/v2/resize:fit:1400/format:webp/1*0_-Xjj0ysqTgOROVvv7mJQ.png) + If you’ve already created a function, go find that one. From there, all you need to do is hit “Deploy New Image”. Regardless of whether it’s a whole new function or just a new image, make sure you select the platform that matches what you did in your Docker build! (Remember that pin?) -![](https://miro.medium.com/v2/resize:fit:1400/format:webp/1*4Y9AA-WMs3mTtjvHvLsC0w.png) + @@ -345,7 +341,7 @@ docker push accountnumber.dkr.ecr.us-east-1.amazonaws.com/your_lambda_project:la -![](https://miro.medium.com/v2/resize:fit:1400/format:webp/1*HV6XTkGbmNI-ku7wz6QWAg.png) + @@ -399,7 +395,7 @@ docker push accountnumber.dkr.ecr.us-east-1.amazonaws.com/your_lambda_project:la -[Using Poetry and Docker to package your model for AWS Lambda](https://towardsdatascience.com/using-poetry-and-docker-to-package-your-model-for-aws-lambda-cd6d448eb88f) +[Using Poetry and Docker to Package Your Model for AWS Lambda](https://towardsdatascience.com/using-poetry-and-docker-to-package-your-model-for-aws-lambda-cd6d448eb88f) was originally published in [Towards Data Science](https://towardsdatascience.com) on Medium, where people are continuing the conversation by highlighting and responding to this story.