My undergraduate thesis was "Learning Regular Expressions0 from Positive Examples". For example, say we have the following examples a, aa, aaa, aaaa
a human may deduce that the regular expression is a+
, in English it means the letter a
repeated multiple times. Task: How could we get computers to reach the same conclusion? Especially when even people may reach a different conclusion. One such alternative answer is: any letter repeated multiple times. The conclusion of my thesis was that it cannot be done. More specifically it can, but only if you introduce restrictions, because if you don't .*
, which is the regular expression for "everything is permitted", will always work, and will always be the shortest and simplest answer. If we introduce restrictions on how the expression looks like, we can come up with something better, or at least closer to what a human would, but the restriction in itself is a negative example.
We humans are fairly good at inferring context. Which is why there is an acknowledgement in "Artificial Intelligence" research that while humans may find it easy to figure out the rule to a sequence of numbers from a fairly small sample set, computers cannot. At the same time, there may not be one singular answer either, and computers are not known to deal well with ambiguity.
So let's look at inferring sequences. For 1,1,2,3,5,8
there is one obvious answer. It's the Fibonacci sequence, right? We know the next number is 13
. And here is where context comes in. As humans, we are good at extrapolating information. Which is usually useful. However, sometimes we can make the wrong assumptions, and end up with some pretty unfortunate fallacies1. But this example in itself is not without negative examples. The fact that the sequence is in increasing order, by virtue of extrapolation, we give ourselves the following negative examples 4,6,7
, we know these are not in the sequence. Similarly, in the regular expression example before, we imagine patterns and draw meaning from the examples that the author did not include. However, when the regular expression can generate an infinite number of results, can we even make the assumption, really that the not mentioned examples are in fact negatives? We may have just not gotten around to them.
While my thesis focused on computer science, the principle of needing both positive and negative examples extends far beyond algorithms, and it took me quite a while to fully understand that myself.
I'm not writing a blog post here to summarise my mediocre undergraduate research. What I am writing about is what it took me 7 years to realise the applications of this conclusion to real life. It struck me as I was doing a coaching course. What I like about this course is that it threw us in to practice from the first session. With the simple instruction of "Just listen". Now as you can imagine some people are not too comfortable with that, both ways really. It requires some comfort to just talk for 5 minutes without wondering what the other person is thinking and wanting to check in with them. Because if they're not saying anything, are they actually listening? So we made the mistake of not just listening, and that was when I realised why the instruction was "just listening". Thing is, it was only in doing it the wrong way that, at least, I realised why the "right" way is the right way.
Just like computers, we cannot learn without making mistakes. Sometimes we get lucky, and we can learn from someone else's mistake, but that in itself is rare. Making the mistake, we can notice our own thought pattern that lead to it. We can figure out the difference in the thinking and behaviours between the mistake and the correct behaviour. It's particularly tricky when the desired behaviour and the mistake are very similar, especially externally. And we can easily excuse it as a difference between intent and impact, when we don't really want to deal with our own behaviours.
Imagine trying to learn a new skill, say cooking by watching a perfectly executed dish done by a Michelin starred chef. Safe to say it will be very unlikely that you will be able to replicate the dish. Without seeing common mistakes or understanding why certain techniques are used, the learning would be incomplete. Unexpected events happen in life at all stages, and if we don't fully understand both successes and failures we may not have the tools to recover from the draw backs life inevitably throws at us. We won't have mastered the skill, or maybe even learned it. But we can repeat it back, as long as everything goes perfectly. But when does it ever?
Growing up mistakes were severely punished. The philosophy behind that, if one could say there was one, was that only if the mistakes are punished will I learn from them. I will tell you now, that is absolute bullshit, there is plenty developmental and sociological research nowadays that backs it. Robert Cialdini's Influence is a good resource here referencing a variety of different studies. Ultimately punishing mistakes or certain behaviours does make people unlikely to do them under supervision. However, they learn to avoid the punishment, but not learn from the mistake itself. If you are interested in more books on how it can affect the developing brain, books like Pete Walker's Complex PTSD: From Surviving to Thriving, or Lindsay Gibson's Adult Children of Emotionally Immature Parents are some favourites of mine.
However, that is not how I felt for a very long time. I internalised the message that all mistakes are bad, to the point where even a harmless mistake, like dropping a glass and shattering it would lead to a panic attack. I turned to perfectionism as a coping mechanism and that prevented me from learning from my mistakes. And just learned to avoid them. Eventually there were points where I ended up paralysed unable to make a decision, because I didn't want to make a mistake. There were a couple of times, where it made me unable to take responsibility for my mistakes, because accepting it as a mistake would, based on my experience throughout my developmental years have ended up in disaster. This has changed over time, but I'm a long way from done.
Being in the environment of this coaching course, which is one of the first places where I have felt 100% safe to make mistakes, things have worked out a bit differently. That is not to say I have never learned from my mistakes before, but it always felt difficult, and regrettable that I had made the mistake in the first place. Whereas here I was happy to have made the mistake. I was happy the mistake happened to me. I learned why there is a "no interruption" rule, not just the rule. A learning environment is difficult to achieve. The coaching course has the benefit of being a course, so it's easier, but if we take a workplace for example, or real life, it seems like a much harder feat. After all mistakes in real life have real consequences.
And yes, there will be areas where mistakes are not acceptable, like a surgery. Nick the wrong artery and the patient dies because of blood loss. Once the patient is dead, not much one can do to fix the mistake. It's why surgeons practice on cadavers and a myriad of other teaching tools, so they can make mistakes when it doesn't matter.
In a lot of other industries mistakes are often not life-threatening, and there can be guardrails put in place to allow undoing or fixing mistakes with relative ease. Sure a social media platform may lose a lot of money if its services went down for half an hour, but nobody is going to die if they can't see the latest viral cat video. I am lucky enough that software is not a "do or die" type of field. There are test environments, automated tests, alerting to catch mistakes and ways to roll back most times and iterate. With a bit of care, most code can be written in a way that it can be rolled back. The rest is all about people, and if we all treat each other with respect, accept that mistakes can be made and repair after we have made mistakes, then we can learn.
Some of the best feedback I have ever gotten was from making mistakes. Some of that feedback wasn't in an environment where it felt safe to make mistakes, and it took me years to internalise and deal with it. When it was safe, the feedback went much smoother, and I could act on it right away.
Learning a set of rules and following them blindly may lead to us not making mistakes, but do we actually learn? Learning is the process where we understand why things are the way they are and why we do certain things the way we do them. If we only follow a set of rules with the promise of an eventual result, basically nothing short of a cargo cult, can we actually guarantee the result we are seeking. The term got further popularised in the world of software engineering. I have seen this in others and myself, where I seemed like I was doing the right things, but I had no idea why it didn't pay off. Yes, in one circumstance it had been the classic case of workplace sexism, but I can see that in a few others, while the behaviour seemed to be there, the underlying motivation and thinking wasn't, because I hadn't yet learned the skill.
It is easy to make things look like they are doing the right thing. And sometimes we can learn right off the bat how something is the right thing to do, but we often, if not always, need the contrast to learn why. We may otherwise always wonder how would it be if we took this tiny shortcut, after all, we are still following the rules, right? And then it doesn't work.
Take my learning from the coaching course. I always thought that active listening was about asking probing questions to get more information, and make sure it sounds like you're listening. I followed the rules and did not ask anything, gathering all the questions I wanted to ask in my mind, not asking them because of the rules. But still thought internally they would have been good questions to ask, and the conversation may have gone better had I asked them. Nonetheless, I followed the rules. I am, after all, a rule follower. Then came the mistakes. It was only then that I realised why the questions were bad. They were not there for the benefit of the person talking, they were there to satisfy my own curiosity. Yes, it was a form of listening, but it wasn't what the speaker (me in this particular mistake) wanted to talk about. Mind you it was an interesting conversation, and an interesting topic, but not the one I wanted to discuss. It was only in the mistake that I realised why I was not supposed to ask questions. But never asking questions, or just asking the same generic "Can you think of anything else?" that even a simple LLM can do, is not the actual point. Questions are fine, but they should be for the benefit of the speaker, and the listener should try to continue the focus that the speaker was choosing.
Just as I concluded in my thesis that computers can't learn regular expressions from only positive examples, I realised that we, as humans, can't fully learn life skills without experiencing or observing mistakes. Mistakes happen, and treat them as a gift, because they do teach lessons no one else can. And it will only be mistakes that will prepare us to deal with the unexpected, and the unexpected always happens, otherwise we could just automate our lives away.
Interested in learning more? Feel free to explore my coaching here and book a free intro call to discuss how I can help you.
0 Regular expressions are a representation of a pattern that in computer science we can use to see if one thing is part of the pattern or not. They can also be used to produce more results in the same pattern.
1 Confusing correlation with causation is one of my favourites here