CODE Presents: Building HAL 9000 (And It Runs Completely on My Mac)
by Sahil Malik
HAL 9000 is a fictional artificial intelligence (AI) character in Arthur C. Clarke's novel “2001: A Space Odyssey” and its film adaptation directed by Stanley Kubrick. It had a conversational interface—humans could just talk to it like humans talk with each other. It was super intelligent. The original idea came about in 1964 when Kubrick and Clarke started working on the project.
The year 1964 was when the Ford Mustang was introduced. Rotary phones were how you made phone calls, and you wore thick black polycarbonate glasses. Microwave ovens were a new thing, as were color TVs. As the world danced to “Pretty Woman” by Roy Orbison, or “Twist and Shout” by the Beatles, society was looking forward to the seemingly impossible goal of putting man on the moon by the end of the decade.
It's in that enchanting time that HAL 9000 was imagined, a super intelligent computer program that could control the functions of a spaceship, that was self-aware, and people could interact with in natural language.
Fast forward to 2024. Although I don't quite yet have my personal flying spaceship, HAL 9000 is a pretty close reality. Nerd that I am, I set out to build HAL 9000 for myself.
In my last article in CODE Magazine, I talked about running AI locally. The goal of this article is different but straightforward. I want to build a HAL 9000 that I can speak to, in any language, about any topic. And it should give me answers about whatever I ask for. Additionally, I want to do it all on my off-the-shelf commercially available MacBook Pro. Finally, I want to be able to build it so that it runs completely offline, so that in the rare case I manage to get a spaceship, I don't have to rely on an internet connection to run it.
As I build it, I'll share all of the code and explain it as I go. In the end, I'll put together a fully functioning application, HAL 9000.
What You're Going to Need
To follow this article, you'll need a beefy machine. You're not going to rely on the cloud to build the model for you. You'll need a powerful local compute capability. This means either a higher-end Windows/Linux laptop or one of the newer Macs. And yes, you'll need a GPU. AI involves a lot of calculations and to speed things up, a lot of them are offloaded to the GPU. The difference between doing everything on the CPU vs. GPU is astronomical. For my purposes, I'll use my rusty trusted M1 Max MacBook Pro. It's a few years old, but it has enough oomph to work on thousands of pages of text, which is good enough for my needs. Hopefully, you have a similarly equipped machine, or, to follow along you could just use a smaller input dataset.
Also, you'll download and use standard libraries, packages, and large language models that other companies and people have built. But when you're done with it, no data will be sent to the cloud, and your application will have the ability to be able to run completely offline. To get started, though, you'll need an internet connection.
Also, I will use Python, so ensure that you have Python 3x installed.
The Main Components
Let's think about the problem and break it down into smaller parts.
- I'll need the ability to listen and convert my spoken text into ASCII text. When I speak into my mic, saying “Let's talk about New York City,” my program should be able to transcribe the text I say on the fly.
- I'll need a large language model (LLM) that takes my spoken text, transcribed to plain text, as inputs, and returns a sensible response.
- And finally…
… this article is continued online. Click here to continue.
dtSearch®- INSTANTLY SEARCH TERABYTES |
|---|
![]() |
Enterprise and developer products include:
- over 25 different search features
- credit card search and other forensics-oriented options
- efficient multithreaded indexing and searching
dtSearch's document filters support:
- local and remote “Office” files, PDFs, compression formats, etc.
- emails with multilevel attachments
- a wide variety of databases
- web data
Developers:
- SDKs for Win / Linux / macOS
- APIs for current .NET / C++ / Java
- faceted search, granular data classification and other API options
- deploy on-premises or in cloud

Visit [www.dtSearch.com?utm_source=dtSearch1.28.2025&utm_medium=newsletter&utm_campaign=sm-articles]dtSearch.com
- for hundreds of reviews and case studies
- for fully-functional enterprise and developer evaluations
Harness the Power of AI and Copilots with CODE Consulting! |
|---|
Schedule Your COMPLEMENTARY AI Executive Briefing Today! Want to know how Artificial Intelligence can revolutionize your business? Don't let the hype confuse you—make informed decisions and propel your organization forward with an AI Executive Briefing. During our AI Executive Briefing, your company will receive:
|

Comments
Post a Comment