A University of Hong Kong team has merged law with artificial intelligence to develop a computer program they say can predict sentences in drug-trafficking cases with up to 90 per cent accuracy.

While the program is not expected to replace professional advice given by lawyers, Anne Cheung Shann-yue, a co-director of HKU’s law and technology centre, said she hoped it would be a helpful tool for those tasked with explaining drug offenders their options.

“This software is dedicated to the professionals, including lawyers, social workers and teachers, who sometimes find it hard to explain the legal principles,” the law professor said as she unveiled the system at the varsity campus on Tuesday.

Benjamin Kao Chi-ming, the centre’s other co-director, said the platform was made possible by teaching the computer to read more than 3,000 judgments on drug-trafficking cases.

A new computer program created at the University of Hong Kong weighs both the type and amount of drugs involved in helping determine likely prison sentences.


Users accessing the webpage are first asked to enter the type of drug involved in the case and the amount – two key pieces of information in determining how long a sentence is likely to be.

The new software then quickly scans sentences handed down in court rulings scattered across decades looking for cases involving similar circumstances.

For example, the sentencing guidelines for cocaine and heroin can be found in two judgments in 1990 and 1994, while the sentencing range for Ecstasy is contained in a 1999 ruling.

“It may be difficult for a human being to recite 3,000 judgments … But the computer is really good at remembering things,” Kao said.

The system also asks if a defendant intends to plead guilty, and, if so, at which point in the judicial process – a key determining factor, as showing remorse can mean as much as a one-third deduction on the sentence.

Research officer Michael Cheung introduces the new sentencing prediction tool on the University of Hong Kong campus.


There are also boxes to enter possible aggravating factors – such as whether an international element is involved – or mitigating ones, including willingness to assist authorities in their investigation.

The system then looks at all past judgments to determine how much has been typically deducted or added to sentences based on those factors.

Wilson Chan Man-ho, of the Hongkong Federation of Youth Groups, said without the new tool, frontline social workers dealing with clients facing drug-related charges have been advising them based on their own experience, or research through the press.

But sentencing is an art not a science, according to many judges and criminal lawyers.

Kao noted the limitations of the current set-up, which confines mitigating and aggravating factors to just a few options, even though they could come in many shapes and forms in the real world.

In a 2019 judgment, three appeal justices also noted that sentencing guidelines for particular drugs were “not fixed, compulsory or arbitrary straitjackets, nor should they be slavishly applied”. Cases could also vary greatly based on the particular role a defendant played in drug trafficking, they said.

Kao said allowing users to key in tailor-made scenarios may be possible in the future, though it would require a lot more examples for the computer to study.

The database currently runs up to 2019, he noted, adding that he and his team would likely update it later.

The new sentencing prediction program is accessible at wwwnew2.hklii.hk/predictor
.