During the Meanwhile

Herko Coomans' personal weblog. Est. 1996.

Blog

  • Playing with AI on my own machine

    As I delved into the world of AI and machine learning, I knew I wanted to take things into my own hands. Literally. Instead of relying on cloud-based services or remote servers, I decided to set up a local Large Language Model (LLM) instance on my Synology NAS.

    Step 1: Selecting the Right Tools

    My goal is to experiment with large language models for text analysis and generation, specifically in the context of digital health policy analysis. I want to explore how these models can be used to identify trends, patterns, and insights from large datasets of health-related texts.

    In my search for suitable tools, I came across three options: h2o.ai, Jan.AI, and AnythingLLM. Each has its own strengths and weaknesses, which I’ll outline below:

    • h2o.ai: H2O is a machine learning platform that provides pre-trained models for various NLP tasks, including text classification, sentiment analysis, and language modeling. Its benefits include ease of use, flexibility, and scalability. However, it may not be as comprehensive as other options.
    • Jan.AI: Jan.AI is an AI-powered research platform that enables users to analyze and generate text based on large datasets. It offers features such as natural language processing, entity recognition, and topic modeling. Its benefits include ease of use, speed, and scalability. However, it may not be as customizable as other options.
    • AnythingLLM: AnythingLLM is an open-source LLM framework that allows users to train and fine-tune their own models for specific tasks. Its benefits include customization, flexibility, and adaptability. However, it may require more technical expertise and computational resources.

    Comparing these tools with my use case requirements:

    • h2o.ai: While h2o.ai provides pre-trained models, they may not be tailored to the specific task of digital health policy analysis.
    • Jan.AI: Jan.AI is easy to use and scalable, but it may not offer the level of customization I need for my specific use case.
    • AnythingLLM: AnythingLLM offers customization and flexibility, which aligns with my requirements.

    I decided to opt for AnythingLLM due to its ability to be customized for my specific use case. However, before setting up AnythingLLM, I also considered the importance of data privacy and security.

    Step 2: Preparing My Synology NAS

    Before setting up the LLM instance on my NAS, I needed to upgrade the RAM. According to the Reddit community, upgrading the DS920+ with 16GB of RAM is possible, but requires careful attention to the specific requirements for the RAM module.

    To upgrade the RAM, you will need:

    • RAM Module: The Synology DS920+ supports up to 32GB of RAM, but only in specific configurations. You can use a single 16GB DDR4 SO-DIMM module or two 8GB DDR4 SO-DIMM modules.
    • Frequency and Voltage: The RAM module must have a frequency of 2400MHz and a voltage of 1.2V.
    • Timings: The RAM module must support the following timings: CAS Latency (CL) 16, RAS to CAS (tRCD) 10, Write Recovery Time (tWR) 20.

    Failure to meet these requirements may result in compatibility issues or even damage to the NAS. Make sure to check the specifications of your RAM module before upgrading.

    Step 3: Setting Up AnythingLLM

    After installing Docker on my NAS, I focused on setting up AnythingLLM. According to the official documentation, the installation process involves several steps:

    1. Pulling the Docker Image: Run the command docker pull anythingllm/anything-llm to pull the latest version of the AnythingLLM Docker image.
    2. Creating a New Container: Run the command docker run -d --name anything-llm -p 3001:3001 anythingllm/anything-llm to create a new container and map port 3001 to the host machine.
    3. Configuring the Environment Variables: You need to set up environment variables for the LLM instance, such as LLM_ MODEL and LLM_TOKEN. You can do this by adding the following lines to your docker-compose.yml file:
    version: '3'
    services:
      anything-llm:
        image: anythingllm/anything-llm
        ports:
           - "3000:3000"
        environment:
           - LLM_MODEL=your-model-name
           - LLM_TOKEN=your-token
    1. Running the Container: Run the command docker-compose up to start the container and make it available on port 3001.

    Loading LLM Models

    After setting up AnythingLLM, I encountered another challenge:

    • Challenge 4: Loading LLM Models into Ollama: To load the desired LLM models into Ollama, I had to SSH into the Docker instance and set up secure access rights for my NAS. Once I did this, I was able to load the Llama3.2 3b model into Ollama.

    The Failure

    Unfortunately, after completing these steps, I discovered that the system as I set it up does not work. According to an issue report on GitHub (https://github.com/Mintplex-Labs/anything-llm/issues/1331), there is a known bug in the AnythingLLM Docker image that prevents it from loading LLM models correctly.

    As I delved deeper into the issue, I discovered that the problem wasn’t with the LLM model loading or processing, but rather with the underlying hardware requirements of AnythingLLM. Specifically, it relies on a database called Lancedb, which has specific CPU requirements.

    What is Lancedb?

    Lancedb is a high-performance database designed for large-scale natural language processing tasks. It’s used by AnythingLLM to store and manage its models, allowing for efficient querying and retrieval of information. However, Lancedb requires a specific set of CPU instructions to function properly.

    AVX (Advanced Vector Extensions)

    AVX is a set of instructions introduced by Intel in 2011 that enables CPUs to perform complex vector operations more efficiently. It’s designed to improve the performance of scientific simulations, data compression, and other compute-intensive tasks. AVX allows for wider registers, which can store multiple sets of data simultaneously, making it possible to perform calculations on large datasets more quickly.

    AVX2 (Advanced Vector Extensions 2)

    AVX2 is an extension of the original AVX instruction set, introduced by Intel in 2013. It offers improved performance and functionality over its predecessor, with support for additional instructions and features. AVX2 enables CPUs to perform even more complex vector operations, making it essential for many modern applications, including machine learning and data science.

    The Issue

    The problem arises because the Synology NAS’s Intel Celeron 4125 processor does not support AVX or AVX2 instructions. This means that the Lancedb database, which relies on these instructions to function, cannot be used with this hardware configuration. As a result, the Docker image crashes and fails to start, causing the AnythingLLM instance to stop working.

    Conclusion

    In conclusion, the failure of the AnythingLLM instance was due to the CPU requirements of Lancedb, which demands support for AVX2 instructions. Unfortunately, the Synology NAS’s hardware does not meet these requirements, making it incompatible with Lancedb and preventing the Docker image from running successfully. This highlights the importance of considering the specific hardware requirements of software applications when setting up complex systems like LLMs.

  • Taking control over my own data

    Taking control over my own data

    A lot of my work at the Ministry of Health focusses on empowering people/citizens/consumers/patients/experience experts/health professionals to be able to take control over their own (health) data. Now, that sounds like a noble cause, not something you’d disagree with on the face of it, but tricky to imagine the transition to a world where you do actually control your own data. So I thought, let’s see if I can get some basic control over my own data, and see what the experience actually is.

    Now, you have to understand that I don’t have a lot of data myself (I hear you thinking: Hah, what a naive fool! The big data companies, ad trackers and many more have tons of data on you! and you’re right about that), so I wanted to see what I could do myself. And let me tell you: it isn’t easy to manage your own data.

    Follow my experiment

    I’ll write about my progress over time, as I go about discovering what I need to do to get control over my own data. For me it’s about the learning curve, about sharing my experiences with people who might have the same ambition and about having the tools that fit this ambition.

    What data do I have, anyway?

    There’s several kinds of data that I ‘have’:

    I have websites, I have e-mails, documents, video’s, photo’s, backups etc. -basically the regular stuff that I actively manage using several ‘free’ and commercial services already. These I’ll call the known known data, it’s where I’m aware that I have it and that I actively manage it (or let others manage it for me).

    Than there’s the known unknown data, which is the data I know is out there, but I have no idea’s where it is stored or how it is managed. This is a broad category, so I’ll include social media posts, location data, service usage statistics, other meta-data about me. But I’ll also include my energy usage, medical records and other data that seems to belong to (trusted?) third parties, and may or may not be about me personally, or about the services I use.

    The last category is the unknown unknown data, which is data about me that I have no idea about. This is where my naivity will shine through, but also where more awareness is likely necessary. In this category I’ll put my search metadata, my mac-address being followed in stores, other types of surveillance, even inclusing captcha.

    So, let’s see if I can take control over ‘my’ data!

    Tools of the nerd: tech stack

    There’s several things to consider in this mission. First of all: what do I mean by ‘take control’? As a nerd, my first response is to be able to manage it in an environment I have complete (or as complete as possible) agency over. And that means: self-hosted.

    So, what do I need for this? I’ll need a server somewhere connected to the Interwebz, and since I want control, it’ll have to be self managed. I could go for the expensive hardware of a self hosted rack server, but my needs are small currently, so I’ll settle for a Virtual Private Server (VPS) solution. Ah, it already has the word private in it, so I’m feeling better already. That feeling evaporates as soon as I realize that I’ll need to learn how to manage a server…

    What services do I need to install and self-manage (boo!) on this private (yay!) server?

    Known known data:

    • Websites/weblogs: I’ve been dabbling with websites since 1993 (yes, I’m that old) and I’ve been a user of the open source WordPress CMS since version 0.7. I love it’s openness and user-friendlyless and the fact that it has a huge ecosystem that provides a lot of support and learning material. I have a number of domains and web projects that I’ve had hosted by the likes of MediaTemple and such, but managing the webserver part myself needs to be easy.
    • E-mail: this is one of my biggest wishes, that for the personal domains I use and the e-mail addresses this provides to me and my family, I’m not only feeding Google’s and Apple’s and Yahoo’s and whatnot’s algorithms, but have complete ownership of my correspondence. But, e-mail is notoriously maintenance-heavy, mainly due to the security risks of having a badly configured and secured mailserver. But, if this is going to be a learning project for me, e-mail shold be part of my stack.
    • Documents, images, video’s: my personal cloud storage for documents. There’s several services dedicated to this, but many monetize your data and your useage of that service as well (like uploading your video’s to youtube, for instance).
    • Backup storage: data I don’t want to lose will need to be backed up somewhere I can access them if necessary.

    Known unknown data:

    This is a tricky category, as a lot of this data it tied to services like Facebook, Apple etc. and are notoriously difficult to detatch. So, in the spirit of ‘taking control over my data’ I’ll be looking into ways to minimize the third party control over my data in their systems and ways to migrate my data from third party services to self-hosted alternatives.

    • Facebook is at the top of my list. Because it’s got a terrible track record, because a lot of the time I’m on it I’m not really enjoying it, and because they’re just evil and I’m enabling their evil by remaining on their services.
    • Amazon is a nice second to look into.
    • Google services, because of their incredible farreaching scope.
    • Apple services. I’m an Apple fanboy and their integration is really tight but user friendly, so this’ll be especially hard.
    • Other services I use(d).
    • Special attention will go to medical data and smart home data. Because this is what I strive to empower everyone to be able to do. So I’ll see what I can do myself.

    So here I’ll look into what (meta)data the services I use gather and store about me, what the level of control is I have over that data, what the alternatives are, whether there are self-hosted alternatives, and what the consequences will be.

    Unknown unknown data:

    In this part I’ll research who has what kind of data points on me, and what I can do to minimize the potential damage that data might do to me and my family, as well as to see what kind of control I can exert on that data.

  • Dutch Digital Health Approach closes 2019 ONC Interoperability Forum

    Dutch Digital Health Approach closes 2019 ONC Interoperability Forum

    In August of 2019 I was graciously invited by Steven Posnack, the US Deputy National Coordinator for Health IT, to participate in a panel discussion as part of the 3rd Interoperability Forum. This is their annual event where everyone who is involved in health data interoperability comes together and hears about the work and plans from the Office of the National Coordinator (ONC) itself. I was honored to accept, with my colleagues Vincent van Pelt and Ruben de Boer. Vincent is an architect at the Dutch national competence center for digital health Nictiz, and Ruben (at the time) was my colleague at the Ministry of Health, Welfare and Sport responsible for our policy on access to health data.

    This was a great opportunity for us to showcase the work that has been done in The Netherlands, especially on providing patients and citizens the tools to access, collect and share their own health data in a secure and trusted way. The podium provided by the national authority on health IT of a country that is dominant in this market -US- means that it validates the direction we are taking. It felt a bit like the mouse asking the elephant to make some noize together, but we grabbed the opportunity to do so.

    Oh, and Steven Posnack challenged us to bring Stroopwafels, so we did 🙂

    The ONC livestreamed this panel discussion, with closed captions added.

  • Protected: Aim for the moon, shoot for the stars, part III: the pitch

    Protected: Aim for the moon, shoot for the stars, part III: the pitch

    This content is password-protected. To view it, please enter the password below.

  • Protected: Aim for the moon, shoot for the stars, part II: the Heart of Change

    Protected: Aim for the moon, shoot for the stars, part II: the Heart of Change

    This content is password-protected. To view it, please enter the password below.

  • Protected: Aim for the moon, shoot for the stars, part I: the threads of the weave

    Protected: Aim for the moon, shoot for the stars, part I: the threads of the weave

    This content is password-protected. To view it, please enter the password below.

  • Doctors, Nurses and the Paperwork Crisis That Could Unite Them

    Doctors, Nurses and the Paperwork Crisis That Could Unite Them

    They don’t always get along. But they are both under siege by the bureaucracy of a failing health care system. Ms. Brown is a clinical faculty member at the University of Pittsburgh School of Nursing. Dr. Bergman is a professor of medicine at New York University.

    from Pocket
    via Did you enjoy this article? Then read the full version from the author’s website.

  • Paging Dr. Google: How the Tech Giant Is Laying Claim to Health Data

    Cerner was interviewing Silicon Valley giants to pick a storage provider for 250 million health records, one of the largest collections of U.S. patient data.

    Excellent article rom the Wall Street Journal. Read the full version from the author’s website.

  • Seen on the web: Lord of the Rings, 2020 and Stuffed Oreos: Read the Andrew Bosworth Memo

    On Dec. 30, Andrew Bosworth, a longtime Facebook executive and confidant of Mark Zuckerberg, wrote a long memo on the company’s internal network. In the post, titled “Thoughts for 2020,” Mr.

    from Pocket
    via Did you enjoy this article? Then read the full version from the author’s website.

  • Seen on the web: Twelve Million Phones, One Dataset, Zero Privacy

    Every minute of every day, everywhere on the planet, dozens of companies — largely unregulated, little scrutinized — are logging the movements of tens of millions of people with mobile phones and storing the information in gigantic data files.

    from Pocket
    via Did you enjoy this article? Then read the full version from the author’s website.