Skip to main content

Building HAL 9000 And It Runs Completely on My Mac Code Magazine

 


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:

  1. Gain an up-to-date understanding of the current state and future trends of Artificial Intelligence.
  2. Learn proven techniques to integrate AI into your business while safeguarding your data and maintaining compliance with regulatory requirements.
  3. Receive a tailored roadmap that aligns AI implementation with your business goals, delivering substantial value and a clear ROI.

Click Here to Learn More


Comments

Popular posts from this blog

The RADIO framework provides a strong foundation for designing APIs and system integrations with consistency and maintainability in mind

  System Integrations & API Design: The RADIO Framework The RADIO framework provides a consistent, maintainable, and scalable approach to designing APIs and system integrations. It stands for Resource-oriented, Addressable, Documentable, Idempotent, and Observable. Resource-Oriented (R) Principle Focus on nouns (resources) over verbs (actions). 1. Aspect Implementation Detail Maintainability/Consistency Impact API Endpoints Use nouns in the URI (e.g., /users, /products/{id}). Employ standard HTTP methods (GET, POST, PUT, DELETE, PATCH) for CRUD operations. Predictability: Developers easily infer endpoint purpose. Clarity: Leverages standard REST principles, separating the what (resource) from the how (action). Data Models Define stable, versioned schemas (JSON/XML) for resource representations that reflect the resource's state. Decoupling: Protects consumers from internal system changes by maintaining a stable external API contract. 2. Addressable (A) Principle Every resource ...

Whooping cough is an illness that can spread easily. It's also called pertussis

  Whooping cough is an illness that can spread easily. It's also called pertussis. An infection with bacteria causes it. Many people with the illness get a serious hacking cough. Breathing in after coughing often causes a high-pitched noise that sounds like a "whoop." A case of Whooping Cough (pertussis) has been reported. Due to the nature of the illness we want to provide you with the necessary information about Whooping Cough and what steps you can take to protect your child and family. Extra advice may need to be sort if you have a newborn baby or are currently pregnant. Most students have been vaccinated against Pertussis when they were and infant. What is Whooping Cough (Pertussis) and how is it spread? Whooping Cough is a highly contagious respiratory infection caused by the Bordetella pertussis bacteria. It primarily affects the lungs and airways and can lead to severe coughing fits, especially in young children. It is spread through droplets when an infected pers...

Developing User Interfaces with GitHub Copilot

  Developing User Interfaces with GitHub Copilot, Part 3 by  John Miller  | April 30, 2025 This post is the third installment in the series on AI assisted UI development. While this post is largely stand-alone, consider reading parts  1  and  2  before reading this post. Have AI Add a Data Visualization We've looked at using AI to create and add UI components in prior posts. In this post I'll add a data visualization to a page. This figure shows a rendered Sales Funnel Summary page before making any changes: The goal in this post is to have AI add a data visualization of the sales funnel to the page. Prompt: Using css, add a Sales Funnel graphic from the data in the detail-table. Include the total value and the average age. Don't include ‘unknown’ or ‘closed lost’. Below is the response from the Claude 3.7 Sonnet Thinking model. Begin Response I'll add a CSS-based Sales Funnel visualization between your summary table and the details table. Here's how t...