Love.Law.Robots. by Ang Hou Fu

When registering myself from some professional conferences, I found greater emphasis on ChatGPT and AI regulation. I write about what I am now dreading with this trend.

Cover Photo by Bogomil Mihaylov / Unsplash

Read more...

I share my experience and process of generating daily newsletters from Singapore Law Watch using ChatGPT, serverless functions and web technologies. #Featured

Feature Photo by Food Photographer / Unsplash

Introduction

It's easy to be impressed with Large Language Models like #ChatGPT and GPT-4. They're really helpful and fun to use. There are a ton of uses if you're creative. For weeks I was mesmerised by the possibilities — this is the prompt I would use. Using this and that, I can do something new.

When I got serious, I found a particular itch to scratch. I wanted to create a product. Something created by AI that people can enjoy. It has to work, be produced quickly and have room to grow if it is promising. It should also be unique and not reproduce anything currently provided by LawNet or others.🤔

There is one problem which I felt I could solve easily. I've religiously followed Singapore Law Watch for most of my working life. It's generally useful as a daily update on Singapore's most relevant legal news. There's a lot of material to read daily, so you have to scan the headlines and the description. During busier days, I left more things out.

So… what can ChatGPT do? It can read the news articles for me, summarise them, and then make a summary report out of all of them. This is different from scanning headlines because, primarily, the AI has read the whole article. Hopefully, it can provide better value than a list of articles.

Read more...

I discuss how ChatGPT can be augmented with custom data to improve its performance using Singapore law as an example.

My DALL-E prompting still needs improving.

🔷 Update (31 May 2023): (1) Added a reference to Intellex's Scott; (2) Streamlit now embeds your apps, so there's a convenient way to access the Compare app.

#ChatGPT is a language model developed by OpenAI, with 1.5 billion parameters. It is capable of generating high-quality text in response to prompts and has been used for a variety of natural language processing tasks. It was trained on a large corpus of text from the internet and has achieved state-of-the-art performance on a number of benchmark datasets. Its versatility and accuracy make it a powerful tool for a wide range of applications.

It’s made me excited, and also many others in the legal profession as well.

One of the biggest questions I had was how it would perform on the subject of Singapore law. Law is a specialised area, and Singapore law is an even smaller niche in that. I suspected that statistically, ChatGPT wouldn't know much about it. I wouldn’t be holding my breath.

Read more...

I explain how to use #ChatGPT to write resumes, including finding a template, directing the model to produce bullet points, and summarizing experiences. The article highlights the benefits of using ChatGPT and provides tips for using the tool effectively.

Feature Image  by Marten Bjork / Unsplash

If you are an introvert like me, writing a #resume or a curriculum vitae (#CV) must be one of the most irritating chores. Unfortunately, it’s integral to finding a new job and opening new opportunities. In this post, I try to save myself from this nonsense by getting ChatGPT to do it for me instead. Once you see how easy and effective it can be, you’d probably never want to do it on your own again.

Read more...

Very little is understood about how #ChatGPT and Large language Models could work, but that has not stopped others from having an opinion about it.

Feature Image

Read more...

A litigant in person goes all the way and abuses the justice system. Would introducing more tools to help them encourage such abuse?

Feature Image by he zhu / Unsplash

A little knowledge can be a dangerous thing when it’s in the wrong hands.

A case has captured the attention of Singaporeans, which is remarkable for what it wants. A man, spurned by a woman, sues a woman for a breach of contract, defamation, loss of profits and negligence, claiming over $3 million in several lawsuits. When asked how they could settle the claims, he wanted a letter of apology and to continue developing on “individual shortcomings” together.

AWARE, the leading gender equality advocacy group in Singapore, issued a statement on this case:

Women do not owe men their time or attention, much less their friendship, love, sexual activity or emotional labour. Attempting to demand or coerce these things, via legal means or otherwise, can constitute harassment.

I can’t imagine the stress the woman is going through for this, so her resilience is laudable. Lawyers can dismiss this because of their background, but the effect of seeing difficult words like “defamation” and “letter of demand”, or seeing correspondence from a court, can give someone trauma and pressure.

Guess what? He might have been able to pull this off because he is a litigant in person. Who cares if the Court isn't able to give you what you want or if no one wants to represent you? Having a few difficult words in your vocabulary, knowing how to send a fierce letter and how to file a claim in court is all you need.

You can read the judgement here if you want.

Litigants in person (LIP) occupy a strange position in our justice system. It's difficult, like piloting a plane when you have only seen the cockpit once. Infrequent users need more time and leeway to get the process right. Courts make an effort to ensure that they can see that there is fairness in proceedings. Often, judges implore lawyers to help them, even if they are on the opposite side. The issue is severe enough to warrant its book.

Even so, there are more materials to help you along the way. Like Google, and its latest challenger, ChatGPT. If you believe the hype, you can even get AI to write your pleadings and any other court document once you prompt it well enough. If you screw up, plead your layman’s ignorance before the judge, and promise not to do it anymore until you’ve done it again. These infrequent users of the justice system have no long-term interest in it.

I am sceptical about the laws regarding unauthorised practice, and lawyers who diss tech tools might be putting down technology for their interest. However, we can’t be too romantic about who gets access to justice. There will be users who will use the information they can get to harass, mislead, or coerce others.

As I am writing my AI chatbot, I wonder if I have any responsibility to ensure that whatever information or advice it issues is used responsibly. Maybe the chatbot can say that alternative dispute resolution methods should always be considered or that the justice system should not be used that way. The chatbot can persuade, but it can’t control.

Whatever it is, it seems to be an excellent strategy to try my best to ensure tools that I develop don’t unleash a monster. Having a good reputation in a space that is often ethically challenged is a big asset.

This case shows that other actors in the justice system have better control of such abuse. I am impressed that the judge, in this case, declined to take the easy way out by following the letter of the law and prolonging everyone’s misery. The court should be more open to examining the intentions of litigants and stomping out egregious, abusive cases.

This is a better solution than the unauthorised practice of law or lawyer licensing anyway.

Author Portrait Love.Law.Robots. – A blog by Ang Hou Fu

Feature Image Photo by Maria Lupan / Unsplash

I give anti-bribery and corruption training to my colleagues regularly. During this training, I find myself talking about the Keppel Offshore and Marine FCPA case very often. For an audience in this part of the world, there are lots of highlights:

  • It’s bribery carried out by Singaporeans. We might have a reputation for being docile, law-abiding citizens, but anyone is capable of corruption overseas
  • The amount of the bribe and the criminal fine (millions of US dollars!) is eye-catching. This case received some attention in Singapore’s Parliament as well.
  • The case shows that the authorities in the US can prosecute cases with seemingly few connections to their country with devastating consequences
  • A bribery scheme impacts lots of people in the company. A senior member of the legal department had to plead guilty for his role in drafting agreements in the scheme — that could be me! Being in the back won’t spare you from liability once you’re involved.

This happy state of affairs was interrupted when Singapore’s anti-corruption agency, the Corrupt Practices Investigation Bureau, issued stern warnings to six former senior management staff of Keppel Offshore and Marine. A “stern warning” sounds scary, but it’s probably the meekest in the agency’s arsenal.

The upshot is that while the US authorities deemed it fit to fine the company over $422m dollars, no humans in the company are going to get punished for this in Singapore. Does this mean that the authorities here aren’t able to go against Singaporeans who commit bribery overseas? What if somebody stands up to me during training and tells everyone that there are no real consequences to overseas bribery?

Let’s make this clear — anti-corruption cases are not easy to prosecute, even when they don’t involve foreign witnesses or evidence. For senior staff, short of declaring at a meeting that “the company will commit bribery and damn the consequences!”, determining involvement and culpability is not a straightforward task. Failing to monitor your subordinates and preventing them from committing crimes might have professional and reputational consequences, but it’d take more to claim that you thus have the common intention to commit the crime.

Undoubtedly, the story would have been magical if the CPIB scored a slam dunk and marched those responsible into jail. Reality dictates otherwise. There will be complaints that the agency didn’t do enough, or that there are nefarious forces protecting the elites. The CPIB has its own track record of success it should stand on. In any case, it is worth discussing whether the CPIB has enough expertise or resource to investigate and prosecute a case of such scale and complexity.

In the meantime, if anyone in the company believes that anti-bribery training is no longer important, be warned that being charged for an offence is only one facet of their troubles. This case has loomed over them for several years. They have already lost their positions in the company, and people online (rightly or wrongly) want their heads. None of this is enviable, and they likely would have lawyers to back them. Most employees, like you, me and that lawyer in this case, are far more likely to be forced to enter a guilty plea.

This case might vividly illustrate the limits of law enforcement, but that is cold comfort for those who are affected by it.

Author Portrait Love.Law.Robots. – A blog by Ang Hou Fu

Feature Image

I sorely wanted my first post of 2023 to be about the Opening of Legal Year speeches in Singapore. I've always been fascinated by these speeches because they provide a useful prism to what are the hopes and anxieties of the legal profession. As such, I wanted to explore using sentiment analysis on the speeches to compute the relative anxiety of... I haven't figured out how to perform that experiment yet though, so that's for another post.

For now, I wanted to highlight an interesting nugget in the Law Society President's speech about offshoring:

  1. What other options are there besides technology? Can we follow the free market? Can law firms “offshore” or outsource some of their legal work to overseas lawyers? This is being explored by some firms. Provided that the legalities are observed, some of the work traditionally performed by junior lawyers, such as research, drafting, and discovery, maybe carried out by foreign lawyers sitting in another country.

  2. As one senior partner observed, if young lawyers prefer to continue with the idea of hybrid working, working from home, and zooming in for meetings, there will not be any real difference between a partner working with a Singaporean associate on a matter, and that same partner working with a lawyer sitting in Kuala Lumpur. Both are trained in the common law, both have access to our legal tools, and in fact the Malaysian might be more senior, and yet cost a fraction of the price of the Singaporean.

  3. So, one can understand the appeal of such an arrangement. It makes economic sense for Singapore firms in the short term, but it won’t benefit the industry in the long term.

I didn't like this part of the speech because it's a diatribe against hybrid working, which has no link to hybrid working.

Law firms, particularly large, global law firms, were already trying to source for cheaper bases to perform some aspects of legal work before the pandemic. Clients should be happy that law firms are doing this because it can bring their bills down. It would be hard for Singapore law firms to compete if they stuck to billing high costs associates on every aspect of legal work.

Here's a little more self-reflection. If clients also found that senior partners of different countries are interchangeable, wouldn't that mean everyone's job is at risk in a race to the bottom?

Somebody might claim that senior partners in Singapore are more charismatic than their counterparts from cheaper countries, so clients prefer them. (This is a joke, by the way)

Here's a different perspective and why I found this nugget fascinating. This sort of outsourcing is harder to achieve than it looks: a senior partner who wants to “right” source some aspect of legal work has to ensure that the quality of the work from the other source is at least good enough for the client. He also has to figure out what extent of the work to outsource and what to keep in-house. As such, the senior partner has to decompose the legal work, which is no mean feat.

It also turns out that there are various ways to outsource. In Richard Susskind's “The End of Lawyers” (pages 46 to 50), Prof Susskind identifies no less than 12 sources of legal services, such as computerising, de-lawyering and even no sourcing. Offshoring makes sense in some scenarios, but it's not the only way.

The 12 sources of Legal Service as described in Richard Susskind's "The End of Lawyers".

The skills required to decompose legal work and ensure the quality of service deliverables are vastly different from legal research and drafting, and I am not even sure all senior partners have them. A legal associate in Singapore might be unable to compete on “low” level legal tasks with their counterparts overseas, so it might make sense to acquire a unique skill that will surely be in demand in a globalised and changing profession. It would be more rewarding than trench warfare, at any rate.

Talking about outsourcing to spook young lawyers into exploring new ways of working might be effective. There's a missed opportunity here, but it requires us to think of the legal industry less as a profession and more like a business. Judging by the legal speeches delivered at the Opening of Legal Year, that might be the biggest elephant in the room.

Author Portrait Love.Law.Robots. – A blog by Ang Hou Fu

It’s my last post of the year!

I didn’t reach my desired subscriber count 😅

Let me get this off my chest first: I didn’t achieve my “modest” goal of reaching 50 subscribers this year. I believe a big part of this is that I still haven’t decided what this blog is — is it about my projects, my experience or my thoughts? The elevator pitch is still this is about me. I wonder, I wander, and I dally a lot. I’m a unicorn, not in the sense that I am a one-of-a-kind $1b company, but I have a horn on my head, which I am not sure what it is for.

Photo by Annie Spratt / Unsplash

(Just kidding, the unicorn refers to technically inclined builders who are a rarity in the legal field. You might be a unicorn too!)

It's been a good journey, though. The subscription model helped to contribute to the running costs of the blog. It brought me friendships and generated interest in what I do, which I think is worth a lot. I still get excited when I get a new subscriber and have an overwhelming sense of purpose when I get a full subscriber. Numbers are important, but they are not the most important.

I ended the year reaching roughly 80% of my goal. Still, I am going to keep working on it. Thinking about sales is an entirely different skill set, one I should work on. If anything, it made me respect the work sales persons do.

Let’s Do Some Navel Gazing

Unexpectedly, one of the most popular posts I wrote this year is a book review — “How Data and the Law Interact: A Book Review”. I got word of the book early and decided to read it as soon as it was published. Luckily, it was a breeze to read, and I enjoyed it very much. I hope there’s a second edition so I can write about it again.

I was also proud of some of the projects I completed this year. Chief of which is a statistical analysis of the readability of legislation in Singapore: Evaluating Legislation for Readability, Exploring PLUS. I uncovered sections which require 120 years of formal education to read and made a graph which shows that legislation is still too difficult to read for most people.

The results fortified my belief that endlessly tweaking words and advances in statutory interpretation have done little to improve access to laws — we need a radical approach like legal design to make headway into this.

Unfortunately, 2022 turned out to be a dry period for personal projects. Maybe I am too hard on myself here, but many posts featured me exploring new stuff and not much more. For example, Let’s Play With SQLModel was the first time I involved myself with SQL. I saw why many applications would use it, but I haven’t found a project to use it. Same with K8s. And probably even FaaS and Serverless.

What I want to do in 2023

I mostly kept to posting on a weekly schedule, but I am unsure whether that was the best approach. I don’t have enough tech stuff to post every week (If I am writing a post, I am not building). I also want to write 3-minute posts on Singapore law for fun, which detracts from other things I post about. So, spinning off Singapore law may be the way to go. Writing a new newsletter needs a logo and other assets, so I need more time before officially formalizing the split.

In the meantime, I hope to complete at least one quick app as a personal project. “Quick” means I shouldn’t spend excessive time dreaming up a complicated landing page or an elaborate backend server. I want to focus on other aspects of making an app, such as marketing, listening to feedback and improving it. Hopefully, I can record the lessons I learnt on it.

On the professional front, I would be looking at management and strategy, so you might see book reviews focused on that sort of thing.

Oh, and having more friends is always a yearly goal. Join me on Mastodon!

Conclusion

With that done, I am done with 2022. Let’s go, 2023! 🏎️

Author Portrait Love.Law.Robots. – A blog by Ang Hou Fu

Feature image

I’ve wanted to pen down my thoughts on the next stage of the evolution of my projects for some time. Here I go!

What’s next after pdpc-decisions?

I had a lot of fun writing pdpc-decisions. It scraped data from the Personal Data Protection Commission’s enforcement decisions web page and produced a table, downloads and text. Now I got my copy of the database! From there, I made visualisations, analyses and fun graphs.

All for free.

The “free” includes the training I got coding in Python and trying out various stages of software development, from writing tests to distributing a package as a module and a docker container.

In the lofty “what’s next” section of the post, I wrote:

The ultimate goal of this code, however leads to my slow-going super-project, which I called zeeker. It’s a database of personal data protection resources in the cloud, and I hope to expand on the source material here to create an even richer database. So this will not be my last post on this topic.

I also believe that this is a code framework which can be used to scrape other types of legal cases like the Supreme Court, the State Court, or even the Strata Titles Board. However, given my interest in using enforcement decisions as a dataset, I started with PDPC first. Nevertheless, someone might find it helpful so if there is an interest, please let me know!

What has happened since then?

For one, personal data protection commission decisions are not interesting enough for me. Since working on that project, the deluge of decisions has trickled as the PDPC appeared to have changed its focus to compliance and other cool techy projects.

Furthermore, there are much more interesting data out there: for example, the PDPC has created many valuable guidelines which are currently unsearchable. As Singapore’s rules and regulations grow in complexity, there’s much hidden beneath the surface. The zeeker project shouldn’t just focus on a narrow area of law or judgements and decisions.

In terms of system architecture, I made two other decisions.

Use more open-source libraries, and code less.

I grew more confident in my coding skills doing pdpc-decisions, but I used a few basic libraries and hacked my way through the data. When I look back at my code, it is unmaintainable. Any change can break the library, and the bog of whacked-up coding made it hard for me to understand what I was doing several months later. Tests, comments and other documentation help, but only if you’re a disciplined person. I’m not that kind of guy.

Besides writing code (which takes time and lots of motivation), I could also “piggyback” on the efforts of others to create a better stack. The stack I’ve decided so far has made coding more pleasant.

There are also other programs I would like to try — for example, I plan to deliver the data through an API, so I don’t need to use Python to code the front end. A Javascript framework like Next.JS would be more effective for developing websites.

Decoupling the project with the programming language also expands the palette of tools I can have. For example, instead of using a low-level Python library like pdfminer to “plumb” a PDF, I could use a self-hosted docker container like parsr to OCR or analyse the PDF and then convert it to text.

It’s about finding the best tool for the job, not depending only on my (mediocre) programming skills to bring results.

There’s, of course, an issue of technical debt (if parsr is not being developed anymore, my project can slow down as well). I think this is not so bad because all the projects I picked are open-source. I would also pick well-documented and popular projects to reduce this risk.

It’s all a pipeline, baby.

The only way the above is possible is a paradigm shift from making one single package of code to thinking about the work as a process. There are discrete parts to a task, and the code is suited for that particular task.

I was inspired to change the way I thought about zeeker when I saw the flow chart for OpenLaw NZ’s Data Pipeline.

OpenLaw NZ’s data pipeline structure looks complicated, but it’s easy to follow for me!

It’s made of several AWS components and services (with some Azure). The steps are small, like receiving an event, sending it to a serverless function, putting the data in an S3 bucket, and then running another serverless function.

The key insight is to avoid building a monolith. I am not committed to building a single program or website. Instead, a project is broken into smaller parts. Each part is only intended to do a small task well. In this instance, zeekerscrapers is only a scraper. It looks at the webpage, takes the information already present on the web page, and saves or downloads the information. It doesn't bother with machine learning, displaying the results or any other complicated processing.

Besides using the right tool for the job, it is also easier to maintain.

The modularity also makes it simple to chop and change for different types of data. For example, you need to OCR a scanned PDF but don’t need to do that for a digital PDF. If the workflow is a pipeline, you can take that task out of the pipeline. Furthermore, some tasks, such as downloading a file, are standard fare. If you have a code you can reuse over several pipelines, you can save much coding time.

On the other hand, I would be relying heavily on cloud infrastructure to accomplish this, which is by no means cheap or straightforward.

Experiments continue

Photo by Alex Kondratiev / Unsplash

I have been quite busy lately, so I have yet to develop this at the pace I would like. For now, I have been converting pdpc-decisions to seeker. It’s been a breeze even though I took so much time.

On the other hand, my leisurely pace also allowed me to think about more significant issues, like what I can generalise and whether I will get bad vibes from this code in the future. Hopefully, the other scrapers can develop at breakneck speed once I complete thinking through the issues.

I have also felt more and more troubled by what to prioritise. Should I write more scrapers? Scrape what? Should I focus on adding more features to existing scrapers (like extracting entities and summarisation etc.)? When should I start writing the front end? When should I start advertising this project?

It’d be great to hear your comments. Meanwhile, keep watching this space!

#zeeker #Programming #PDPC-Decisions #Ideas #CloudComputing #LegalTech #OpenSource #scrapy #SQLModel #spaCy #WebScraping

Author Portrait Love.Law.Robots. – A blog by Ang Hou Fu