Project Highlites: A Lightweight Open-Source Predictor for any Classifications, Trained with Data of Choice
Alain Descamps
We welcome Alain Descamps for his first guest blog post, and hope there are many more to follow. If you would like to post on the YottaDB blog please contact us at info@yottadb.com.
Introduction
My name is Alain, and I have been writing code in M since about 1984, except during weekends and holidays. For the last 25+ years, I have been working for the University of Antwerp in a team called Wander, that writes software, used for libraries, research data, heritage collections and various other stuff. They also provide services for other organisations, mostly in the Public Sector, like museums, archives and other libraries. Almost superfluous to say that Wander software is based on YottaDB.
After you have read this blog, you will probably have more questions and possible urgencies for extra stories: I kindly inform you that I warned you.
The Occasion
All publications from the University are registered in a M database, and – traditionally – subject codes are added to them, by means of harvesting from external sources or manually by the cataloger. One day, I was informed that the Flemish government had invented a new subject coding system, and would it be possible to assign these subject codes to publications, and oh, yes, also retroactively for the previous years. It was clear that this was not a job that could be achieved by the cataloger in a reasonable time: we needed extra tooling because of too many records.
So my idea was: instead of looking for some cloud-based AI solution, let me see if I can write something in M, hopefully useful to predict subject codes. I admit that I liked the challenge to try to kill a mosquito not with a cannon, but with something more appropriate.
The Resources
We had roughly five ‘locally available’ resources:
- The first resource was our database engine, the YottaDB M database, which I could talk about, but that would be a different story.
- The second resource was the programming language used to originally access the database: M. Talking about this would be another story.
- The third part involved expanding the M database to also be accessible from Lua: this project, now known as YDBLua, was sponsored by the University of Antwerp and made open-source. This made it possible to develop precisely those things in Lua where Lua is stronger than M. The M database has also since been integrated into other programming languages, including Python and Go. But again, that is another interesting story.
- The fourth part consisted of software pieces from our Wander repository, which had already proven their worth in our applications and each solved specific problems.
- The fifth (non-essential) part was our back-office application, that let us make some necessary forms and configurations.
The Challenge: a Fast and Useful Algorithm
Developing the algorithm itself was quite an adventure: it had to be lightweight. For practical reasons, guessing a classification had to be done within a reasonable timeframe – say, a second – and it shouldn’t consume a lot of computer power, which is shared with all other applications. Thanks to the M hierarchical database model, combined with bitmaps, driven by the $ZBIT extensions, we got the engine working. It would be a great story to talk about bitmap indexes in M globals.
The algorithm consisted of a few steps:
- During training:
- Extract tokens from a given text: the short version, tokens are words in the text, normalised somehow, like converted to lowercase. This works for any UTF-8 code. There is even a hidden possibility to chose the Unicode version. The long version is another story.
- Store a bitmap index between every token and the linked subject code.
- During prediction:
- Extract tokens from a given text, the same way as during training.
- Look for the tokens, that are linked to the fewest topics. Stop if these subjects are reasonably few.
- Intersect with the tokens, that are linked tot the second-fewest topics, … until you have (almost) nothing left.
- The resulting set of 1 or more subject codes is your prediction.
Remark: although there are a few tweaks added to this algorithm, the base idea stays. I will repeat myself, but I could write another story about this, too.
The Product
The project is currently available as an open-source beta version at https://gitlab.com/AlainDsc/highlites/. The final product of this project is not a ready-made application, but a piece of software that a developer can work with. Essentially, the software is accessible via 3 openings.
- The first is a command-line interface that allows the necessary instructions to be executed via the prompt. These instructions consist of a ‘training’ component – to train the ‘know-how’ – and a ‘predict’ component, to calculate a classification proposal. This appears in standard output.
- The second way is a Lua module. As the main engine is written in M, all ingredients are present to build a module in Python, Go, Javascript or Rust.
- The third way is calling the M routines directly. For predictions, you only need the M part. If you really want, you could create something with only M available.
Please know that this is genuinely usable in a multi-task and multi-user environment: you can train multiple knowledge systems simultaneously and make use of them, and you can also train the same system via a number of parallel processes. You can train a system on literally thousands of different subject codes: that comes from the underlying database engine, which happens to be the most scalable database überhaupt.
The cases
In my article, I spend a lot of efforts to show a ‘good’ and a ‘bad’ case in practice. I can refer to the article itself, for details, but the short story goes like this : your prediction will be not better than the data that you have worked with. You cannot make any beauty from clutter.
Conclusions
Well, this Highlites project was a nice trip, and one is always surprised at how far you can jump. There were some other surprising conclusions, as side effects.
Surpassing ‘Classic’ AI Methods in Speed by a Factor
With predicting speeds between 36 and 910 predicts per second in our test, and with the possibility to launch parallel prediction sessions, one cannot help but conclude that, structurally, this is an order of magnitude faster than a ‘classic’ targeted AI. Long live MUMPS.
Fast, Economical, and Usable in Real Life
Although we were unable to take exact measurements of power consumption, the impact of the
Highlites processes on our servers was no greater than the impact of a standard process: one can therefore cautiously conclude that Highlites is an order of magnitude more consumer-friendly than ‘classic’ AI processes. Execution speeds were more than fast enough to support a real-life application.
Extra electricity consumption was not measurable.
Acceptable Prediction Rate, Bad Noise
Although prediction rates are highly dependent on the size and quality of the training data, one can conclude that the Highlites algorithm yields usable results in some cases. The disappointing part: in addition to predicting correct subject codes, there is a fair amount of noise from false positives.
Ceci N’est Pas un Remplaçant
Highlites is therefore certainly not a replacement for the cataloger. The contribution of the cataloger should never be underestimated either. However, it can play an assisting role in generating suggestions, and in reducing hundreds of subject codes to a manageable list from which one can easily choose.
One Cannot Prepare a Good Meal from Waste
Finally, I would like to briefly point out that predicting subject codes based on titles and abstracts has its limits: a title can be so general or misleading that any prediction using any algorithm fails. An example of a title: Obtaining more information from conjoint experiments by best-worst choices: Highlites found no code that stood out and predicted 8 (!) codes, from 61 (Human medicine) to 37 (Educational sciences). The correct subject code was not among them (681.3 Computer).
Viva la privacy
The whole Highlites training system and software resides on your computer: there is no data in the cloud, except if you put it there deliberately: so, sharing your training knowledge is controlled by you, dear local software engineer.
Live long and prosperous!
About Alain Descamps
Alain has talked about himself in the Introduction. He is also an aficionado of the Citroën 2CV “Deux chevaux”. You can reach him by e-mail.
Credits
- Photo of Alain Descamps with his Citroën 2CV At Nordkapp, the Northernmost point in Europe reachable by road courtesy the author.
- Blog roll photo of the University of Antwerp by K.S. Bhaskar.
Published on November 23, 2026