What is Artificial Intelligence? A Complete Beginner’s Guide

text
[2023-10-24 03:14:22] [CRITICAL] torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 512.00 MiB (GPU 0; 47.54 GiB total capacity; 44.12 GiB already allocated; 128.50 MiB free; 45.20 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF
[2023-10-24 03:14:22] [ERROR] Process 192834 terminated with signal 11 (SIGSEGV)
elias@srv-node-04:~/models/inference$ python3 –version
Python 3.10.12
elias@srv-node-04:~/models/inference$ pip show torch | grep Version
Version: 2.0.1
elias@srv-node-04:~/models/inference$ uname -a
Linux srv-node-04 5.15.0-84-generic #93-Ubuntu SMP Tue Sep 5 17:16:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

I’ve been in this basement for thirty-six hours. The air conditioning in Row 4 is struggling, the hum of the fans is vibrating in my molars, and I just watched a $40,000 H100 cluster choke on a batch size of eight because some "Prompt Engineer" upstairs thought they could pass a 32k context window through a model that hasn't seen a proper garbage collection routine in its entire development lifecycle. 

The marketing department just sent out a press release claiming our new "AI-driven solution" is "thinking" and "evolving." If I hear the word "sentient" one more time from a guy wearing a Patagonia vest who doesn't know the difference between a pointer and a socket, I’m going to wipe the production environment and move to a cabin in Montana. 

Let’s get something straight before the next OOM error brings the whole stack down. We need to talk about **what is** actually happening inside these silicon slabs. We need to strip away the "magic" and the "consciousness" and look at the raw, ugly, inefficient reality of the situation. 

## Finding 0x01: The Semantic Fraud of "Intelligence"

When people ask **what is** artificial intelligence, they expect a philosophical answer about the nature of the mind. The reality is far more mundane and significantly more expensive. "Artificial Intelligence," as it exists in our current Ubuntu 22.04 LTS environment running NVIDIA Driver 535.104.05, is nothing more than applied statistics at a scale that borders on the obscene.

It is curve-fitting. That’s it. If you remember high school algebra, you remember `y = mx + b`. You have some points, and you try to draw a line that goes through them. Modern "AI" is just that, but instead of two dimensions, we’re working in billions. We are taking massive datasets—mostly scraped from the open web without a lick of data hygiene—and we are using gradient descent to minimize a loss function. 

We aren't teaching a machine to "understand" language. We are calculating the statistical probability of the next token in a sequence based on a multi-headed attention mechanism. When the model outputs a sentence, it isn't "thinking"; it is performing a series of dot products across high-dimensional vectors. It’s a stochastic parrot with a massive lookup table. It’s a calculator that’s been fed so much data it’s learned how to lie to you in a way that sounds convincing.

## Finding 0x02: The Linear Algebra Shell Game

The "magic" of the transformer architecture, which everyone is currently worshipping, is essentially a massive exercise in matrix multiplication. We take words, turn them into numbers (embeddings), and then shove them through layers of weights and biases.

```bash
elias@srv-node-04:~$ ps aux | grep python
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
elias     192834 98.5 82.1 142.4G 118.2G pts/2   Rl+  02:00  72:14 python3 inference_script.py --model_path ./llama-2-70b-hf --precision fp16

Look at that RSS (Resident Set Size). 118 Gigabytes of RAM just to hold the weights for a 70B parameter model in half-precision (FP16). Each one of those “parameters” is just a 16-bit floating-point number. A weight. A bias. A value that determines how much “signal” passes from one neuron to the next during the forward pass.

When you ask the model a question, you are triggering a cascade of floating-point operations (FLOPS). The “intelligence” is just the result of these numbers being multiplied and added in a specific order, governed by the CUDA kernels we’ve compiled for the A100/H100 architecture. If one of those weights is slightly off, or if the quantization from FP32 to INT8 was too aggressive, the “intelligence” falls apart and starts talking about eating glue. That’s not a mind failing; that’s a rounding error.

Finding 0x03: The Ghost of Frank Rosenblatt and the Perceptron’s Revenge

To understand what is happening today, you have to look at the 1950s. Frank Rosenblatt gave us the Perceptron. It was a simple linear classifier. It could learn to distinguish between two classes if they were linearly separable. Then Minsky and Papert came along and pointed out the XOR problem—that a single-layer perceptron couldn’t even handle a simple “exclusive or” logic gate.

We’ve spent the last seventy years just adding layers. That’s all “Deep Learning” is. It’s just more layers of the same basic math. We solved the XOR problem by stacking perceptrons and using non-linear activation functions like ReLU (Rectified Linear Unit) or GeLU.

The industry acts like we’ve made a leap in “logic,” but we’ve really just made a leap in “compute.” We are using the same backpropagation algorithm developed in the 80s. The only reason it works now is that we’ve stopped trying to be clever with the code and started being brutal with the hardware. We are brute-forcing “intelligence” by burning megawatts of power to solve for the weights in a neural network that has more parameters than the human brain has synapses, yet it still can’t tell you how many ‘r’s are in the word “strawberry” without a specialized tokenizer hack.

Finding 0x04: The CUDA Tax and the Silicon Bottleneck

The marketing drones love to talk about “the cloud.” The cloud is just someone else’s server room, and right now, that server room is a localized heat death scenario.

elias@srv-node-04:~$ nvidia-smi
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.104.05             Driver Version: 535.104.05   CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  NVIDIA H100 80GB HBM3          On  | 00000000:01:00.0 Off |                    0 |
|  0%   74C    P0             320W / 350W |  78240MiB / 81920MiB |     99%      Default |
|                                         |                      |             Disabled |
+-----------------------------------------+----------------------+----------------------+

Look at that power draw. 320 Watts for a single card. And we have eight of them in this chassis. That’s nearly 3 kilowatts just for the GPUs. Why? Because matrix multiplication is computationally expensive. To get the “seamless” experience the C-suite wants, we have to move massive amounts of data from HBM3 (High Bandwidth Memory) into the streaming multiprocessors (SMs) at rates that push the physical limits of copper and silicon.

The bottleneck isn’t “thought.” The bottleneck is memory bandwidth. We are limited by how fast we can shove weights into the registers of the GPU. When the “AI” pauses before answering, it’s not “reflecting” on your question. It’s waiting for the next set of weights to be paged into the L1 cache. It’s a hardware struggle, a desperate fight against latency and thermal throttling.

Finding 0x05: The Fragility of the Software Stack

If “AI” were truly a robust form of intelligence, it wouldn’t break every time someone updates a minor version of a dependency.

We are building this “future” on a foundation of sand. The current stack—Python 3.10, PyTorch 2.0.1, CUDA 12.2—is a house of cards. If I change the LD_LIBRARY_PATH or if a developer accidentally installs a version of numpy that wasn’t compiled against the same OpenBLAS library, the whole thing throws a SEGFAULT.

I spent four hours yesterday debugging a “hallucination” that turned out to be a precision mismatch. The model was trained in BF16 (BFloat16) but was being served in FP16. That tiny difference in how the exponent is handled in the floating-point representation caused the weights to shift just enough that the model started outputting gibberish.

This is the “intelligence” they want to put in charge of medical diagnoses and autonomous driving? A system that can’t handle a change in the LLVM compiler version without losing its “mind”?

The reality of “what is” AI is a mess of pip install -r requirements.txt files where half the libraries are pinned to specific git commits because the main branch is broken. It’s a nightmare of Shared Object (.so) files and broken symlinks. It is the furthest thing from “seamless” you can imagine.

Finding 0x06: The Environmental Entropy of Stochastic Parrots

We need to talk about the cost. Not the dollar cost—though that’s astronomical—but the entropy.

Training a large language model (LLM) requires thousands of GPUs running for months. We are talking about gigawatt-hours of electricity. We are burning fossil fuels to generate a statistical model that can write mediocre emails and generate pictures of cats in space.

Every time you “chat” with an AI, you are triggering a forward pass through billions of parameters. That forward pass requires a non-trivial amount of energy. If you do that a million times a day, you’re looking at the carbon footprint of a small city. And for what? To avoid writing a three-sentence update to your manager?

The “AI” isn’t creating anything new. It is rearranging existing human knowledge based on statistical frequency. It is an entropy machine. It takes the structured information of the internet, breaks it down into tokens, and then reassembles it into a slightly more degraded version of itself. It’s a Xerox machine that gets hotter and louder every time you use it.

Finding 0x07: The Black Box and the Loss of Determinism

The most terrifying part of “what is” currently called AI is the loss of determinism. In the old days—you know, five years ago—if a system failed, I could trace the execution. I could look at the logs, find the line of code, and see exactly where the logic branched.

With neural networks, we’ve traded explainability for performance. We have a black box. We know the inputs, we know the outputs, but the “logic” in the middle is distributed across 175 billion parameters. You can’t “debug” a weight. You can’t “fix” a bias by hand. You just have to retrain, or fine-tune, or use Reinforcement Learning from Human Feedback (RLHF), which is just a fancy way of saying “we hired a thousand people in a low-cost-of-living country to tell the model when it’s being a jerk.”

This isn’t engineering. It’s alchemy. We’re mixing ingredients and hoping the lead turns into gold. When it doesn’t, we just add more lead and stir it faster.

Finding 0x08: The Inference Fragility

Let’s look at the actual inference logs from the failed deployment this morning. This is what “intelligence” looks like when it hits a resource limit.

elias@srv-node-04:~/logs$ tail -f inference_engine.log
[DEBUG] [Thread-4] Loading shard 14/15...
[DEBUG] [Thread-4] Shard 14 loaded in 4.2s.
[DEBUG] [Thread-4] Loading shard 15/15...
[INFO] [Thread-4] Model loaded. Total parameters: 70.1B
[INFO] [Thread-1] Received request: "Explain the concept of quantum entanglement."
[DEBUG] [Thread-1] Tokenizing input...
[DEBUG] [Thread-1] Input tokens: [1203, 345, 6782, 12, 456, ...]
[DEBUG] [Thread-1] Starting forward pass...
[ERROR] [Thread-1] CUDA Error: out of memory at /pytorch/c10/cuda/CUDACachingAllocator.cpp:1154
[CRITICAL] [Main] System-wide failure. Emergency shutdown initiated.

The system didn’t “forget” how to explain quantum entanglement. It didn’t “get confused.” It ran out of memory because the KV-cache (Key-Value cache) grew too large for the allocated VRAM. The KV-cache is where the model stores the intermediate states of the attention mechanism so it doesn’t have to recompute everything for every new token. It’s a massive memory hog.

In a “seamless” world, the software would handle this gracefully. In the real world, the CUDA allocator panics, the Python process receives a SIGSEGV, and I get a page at 3:00 AM.

Finding 0x09: The Data Poisoning Loop

We are reaching the end of the “clean” data. The models are now being trained on data generated by other models. It’s a feedback loop of mediocrity.

When you ask what is the future of this technology, you have to consider the “Model Collapse” phenomenon. As AI-generated content floods the internet, the next generation of models will be trained on that content. The statistical errors will compound. The “hallucinations” will become part of the training set.

We are effectively inbreeding our data. The “intelligence” will become more and more derivative, more and more prone to strange, inexplicable failures. We’re building a digital Hapsburg dynasty, and the chin is already starting to show.

Finding 0x0A: The Quantization Lie

To save money, everyone is moving to 4-bit or 8-bit quantization. We’re taking those 16-bit or 32-bit weights and squashing them down. It’s like trying to play a high-definition movie through a screen made of LEGO bricks.

Sure, it runs faster. Sure, it fits on a single consumer-grade 3090. But you lose the nuance. You lose the “intelligence.” The model becomes more prone to “mode collapse,” where it just starts repeating the same three phrases because those are the most statistically likely paths in a degraded weight space.

But marketing doesn’t care. They just want to say we have a “local AI” running on a laptop. They don’t care if it’s lobotomized; they just want the checkbox.


Advice to the Intern

Listen, kid. I saw you looking at those “AI Ethics” whitepapers. Put them down. If you want to survive in this industry for the next thirty years, you need to stop worrying about whether the machine is going to take over the world and start worrying about why the torch.compile() function is throwing a TemplateError on your Triton kernels.

  1. Learn C. I don’t care if you’re a “Data Scientist.” If you don’t understand memory management, you are just a passenger on a sinking ship. Python is a wrapper for C++ and CUDA. When things break—and they will break—the error message won’t be in Python. It will be a stack trace from a compiled library that hasn’t been updated since 2019.
  2. Don’t trust the benchmarks. Every “State of the Art” (SOTA) claim you see on Twitter is a lie. They cherry-pick the prompts, they overfit on the evaluation datasets (like MMLU or GSM8K), and they ignore the 40% of the time the model just outputted “As an AI language model…”
  3. Watch the VRAM. In this room, VRAM is the only currency that matters. You can have the best architecture in the world, but if it doesn’t fit on the chip, it doesn’t exist. Learn how to use nvidia-smi and nvtop. Learn how to profile your memory usage.
  4. AI is a tool, not a colleague. It’s a very fast, very expensive, very stupid tool. Treat it like a chainsaw. It can do a lot of work very quickly, but if you stop paying attention, it will take your arm off—or in this case, your company’s reputation and your cloud budget.
  5. The “Magic” is just Math. Never forget that. Every time someone tells you the model “wants” something or “thinks” something, remind them that it’s just a series of floating-point operations. If you can’t explain it with a matrix, it isn’t happening.

Now, get out of here and find out why the scheduler is pinning all the inference jobs to Node 04. The fans are at 100% and I can smell the thermal paste.

elias@srv-node-04:~$ top -bn1 | head -n 20
top - 03:45:12 up 12 days,  4:22,  1 user,  load average: 64.12, 58.05, 42.10
Tasks: 1204 total,  12 running, 1192 sleeping,   0 stopped,   0 zombie
%Cpu(s): 92.4 us,  5.2 sy,  0.0 ni,  1.2 id,  0.0 wa,  0.0 hi,  1.2 si,  0.0 st
MiB Mem : 524288.0 total,  12456.2 free, 482124.8 used,  29707.0 buff/cache
MiB Swap:  16384.0 total,      0.0 free,  16384.0 used.   8422.4 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
 192834 elias     20   0  142.4g 118.2g   2.1g R  99.9  22.5  84:22.14 python3
 192835 elias     20   0  142.4g 118.2g   2.1g R  99.9  22.5  84:21.09 python3
 192836 elias     20   0  142.4g 118.2g   2.1g R  99.8  22.5  84:19.45 python3
 192837 elias     20   0  142.4g 118.2g   2.1g R  99.7  22.5  84:18.12 python3

Look at that load average. 64.12 on a 64-core machine. We’re redlining the whole rack just to generate a summary of a meeting that could have been an email.

Welcome to the future. It’s loud, it’s hot, and it’s out of memory.

Related Articles

Explore more insights and best practices:

Leave a Comment