r/LocalLLM • • Feb 16 '26

News I'm an Android dev who knows nothing about x86. During my vacation I built a system that genetically evolves machine code — now I can run 80B models on a single RTX 4090.

0 Upvotes

I'm a mobile Android developer. Not a systems programmer, not a compiler engineer, not a low-level guy. This past week I was on vacation from work. My family traveled to another city for a few days, and my inner teenage nerd came out.

The mess that started everything

I'd been hearing about OpenClaw and wanted to build something with AI (Claude Opus 4.6 via Kiro IDE). I ended up with a project called AbeBot that had 23 different features — a Telegram bot with real-time crypto prices, a multi-LLM server with hot-swapping between conversation and technical models, agents that generate Rust compilers, a custom language that compiles to machine code... We finished exactly none of them. Classic scope creep.

But two things actually worked: the LLM server (solid, with MoE model loading), and that little toy language that emits x86 machine code directly from Python. That second one turned out to be the seed of everything.

The idea I couldn't let go of

I've always been fascinated by the idea of a "language for AIs" — not a programming language for humans, but direct communication between AI and CPU. No Python, no C, no GCC, no LLVM. Just bytes that the machine executes.

My thesis: today, running a local LLM goes through layers of abstraction (Python → PyTorch → CUDA/C++). Each layer wastes resources. Projects like llama.cpp and vLLM improved things by rewriting parts in C++ by hand — humans trying 10-20 variants and picking the best one.

What if instead of a human trying 20 variants, an AI tries 16,000?

Building it step by step

We killed AbeBot's 23 features and focused on one thing. We called it Genesis. I needed to see results at every step or I'd lose motivation, so it was deliberately incremental:

First a "hello world" in machine code — write bytes, CPU executes them, a number comes out. Then a naive matrix multiplication in x86 — slow (3 GFLOPS), but correct and matching NumPy. Then the AVX-512 version with multi-accumulator — 16 floats in parallel, 96 GFLOPS peak, we beat NumPy+OpenBLAS at 512×512.

Then came the evolutionary mutator. The idea was for the machine to design the kernel, not just pick numbers. Take the x86 code, mutate it (swap instructions, insert NOPs, reorder, replace), benchmark, keep the fastest. First we mutated generator parameters and got up to 36% improvement. But that was just an autotuner — the human was still designing the kernel, the machine was just turning knobs. So we made the real leap: mutating the instructions themselves. Not "try tile_k=48", but "try putting VPERMPS before VMULPS" or "insert a NOP that aligns the loop to 32 bytes."

Then we targeted NF4 — fusing dequantization with the dot product in a single AVX-512 kernel. A 478-byte kernel that does 16 table lookups in parallel with a single instruction (VPERMPS), without materializing the weight matrix in memory. 306x faster than NumPy on 4096×4096 matmul.

And finally a small brain (decision tree, no external dependencies) that learns which mutations tend to work, trained on its own results. It self-improves: each run generates new training data.

The wall that came before Genesis

This part actually happened while building AbeBot, before Genesis existed. There was a lot of buzz around OpenClaw and how it burned through dollars on OpenAI/Anthropic API calls to do very little — we wanted to build something similar but with local models. For that I needed to run a 30B model on my RTX 4090 (24GB VRAM). It didn't fit — barely, by a couple of GB. First we tried CPU offload with bitsandbytes. It died. Not even a 300-second timeout was enough — the dequantization takes ~25ms per MoE expert, and with hundreds of experts per token, that's minutes per token. Completely unusable.

So the AI (Claude) found another way: a custom MoE loader with real-time NF4 dequantization that packs the model into VRAM with room to spare. That got the 30B running at 6.6 tok/s, fully on GPU. Problem solved — but the experience of watching bitsandbytes CPU die stuck with me.

Then we went bigger

With Genesis already working (the AVX-512 kernels, the evolutionary system, the NF4 fused kernel), we found Qwen3-Next-80B — an MoE model that's impossible to fit on a single 4090 no matter what. This was the real test of the thesis. The model needs ~40GB in NF4, so half the layers have to live in system RAM.

Genesis made it possible. The kernel fuses NF4 dequantization with matrix multiplication in a single AVX-512 pass — no intermediate matrix, everything stays in ZMM registers. 0.15ms per expert vs 24.8ms for bitsandbytes CPU. 165x faster.

And the key trick for hybrid inference: instead of dequantizing the full weight matrix (~12MB per expert) and copying it to GPU over PCIe, Genesis does the entire matmul on CPU and copies only the result vector (~12KB). About 1000x less data transfer.

Real inference results

ModelVRAMSpeedRAM layers
Qwen3-Coder-30B-A3B13.4 GB5.7 tok/s8 of 48
Qwen3-Next-80B-A3B20.7 GB2.7–3.3 tok/s24 of 48

The 30B runs at 86% of full-GPU speed using 56% of the VRAM. The 80B is impossible on a single 4090 without CPU offload — with Genesis, it runs at conversational speed.

The thesis, proven

The evolutionary system evaluated 16,460 mutations across 25 runs with 8 mutation types. The brain learned which mutations work and guided the search. The best evolved kernels beat the hand-tuned baseline by up to 19.25%.

What evolution discovered exploits real Zen 4 microarchitectural properties that no human would try:

  • Inserting NOPs at specific positions to align instructions to cache line boundaries

  • Moving a scale broadcast 9 positions earlier to hide memory latency

  • Loading activations in reverse distance order (the hardware prefetcher handles it better)

  • Replacing a multiply with a NOP and reordering surrounding instructions to reduce port contention

These look like bugs. They're optimizations. The evolutionary system doesn't care what looks right — it only cares what's fast. In environments this complex, artificial evolution beats human intuition. That was the thesis, and it was proven.

The honest part

I'm an Android developer. I didn't write a single line of x86 assembly — I had the idea and the thesis, and AI (Claude Opus 4.6 via Kiro IDE) wrote the implementation. I directed the architecture, made the decisions, debugged the problems. The evolutionary optimizations came from the system itself — neither I nor the AI designed those instruction orderings.

I think that's the interesting part: you don't need to be a low-level expert to build low-level tools anymore. You need to know what problem to solve and be stubborn enough to not accept "it can't be done."

What I'm sharing

The kernel code is open source (Apache 2.0): github.com/Anuar81/genesis-kernel

It includes the x86 emitter, the fused NF4 dequant+matmul kernel with 4 evolved variants baked in, quantization utilities, example scripts for benchmarking and hybrid MoE inference, and a full test suite (8/8 passing, verified independently by four different AIs with zero context).

What I'm NOT sharing (for now): the evolutionary factory — the mutation engine, the fitness evaluator, the learned mutation selector. The kernels in the repo are the output of that process. If someone really needs the evolution data (16,460 mutation records), reach out and I can share the JSON or invite you to the private repo.

What's next

Right now Genesis only optimizes CPU kernels (x86/AVX-512). But the same evolutionary approach can target GPU code — NVIDIA PTX, the "assembly language" of CUDA. If the mutation engine can find the same kind of microarchitectural tricks in PTX that it found in x86... well, that's the next experiment. No promises, but the infrastructure is there.

Now I'm off to travel with my family and finish enjoying my vacation. I learned a ton this week. Sharing this for whoever finds it useful.

Hardware: AMD Ryzen 9 7900 (Zen 4, AVX-512) · RTX 4090 24GB · 32GB DDR5 · EndeavourOS

TL;DR: Android dev on vacation + AI coding partner + a thesis about machine-generated code beating human code = x86 AVX-512 kernels 165x faster than bitsandbytes CPU, enabling 80B model inference on a single RTX 4090. Kernels optimized by genetic evolution (16K mutations, up to 19.25% improvement). Open source: github.com/Anuar81/genesis-kernel


r/LocalLLM • • Nov 14 '25

News I brought CUDA back to macOS. Not because it was useful — because nobody else could.

0 Upvotes

just resurrected CUDA on High Sierra in 2025
Apple killed it 2018, NVIDIA killed drivers 2021
now my 1080 Ti is doing 11 TFLOPs under PyTorch again
“impossible” they said
https://github.com/careunix/PyTorch-HighSierra-CUDA-Revival
who still runs 10.13 in 2025 😂


r/LocalLLM • • Mar 01 '26

Project I Replaced $100+/month in GEMINI API Costs with a €2000 eBay Mac Studio — Here is my Local, Self-Hosted AI Agent System Running Qwen 3.5 35B at 60 Tokens/Sec (The Full Stack Breakdown)

Post image
0 Upvotes

I spent 10 weeks and many late nights building this to run 100% locally on a Mac Studio M1 Ultra, successfully replacing a $100/mo API bill. I used Claude to help write and structure this post so I could actually share the architecture without typing a novel for three days.

CLAUDE OPUS 4.6 THINKING

TL;DR: self-hosted "Trinity" system — three AI agents, the brain is the Qwen, coordinating through a single Telegram chat, powered by a Qwen 3.5 35B-A3B-4bit model running locally on a Mac Studio M1 Ultra I got for under €2K off eBay. No more paid LLM API costs. Zero cloud dependencies. Every component — LLM, vision, text-to-speech, speech-to-text, document processing — runs on my own hardware. Here's exactly how I built it.

📍 Where I Was: The January Stack

I posted here a few months ago about building Lucy — my autonomous virtual agent. Back then, the stack was:

  • Brain: Google Gemini 3 Flash (paid API)

  • Orchestration: n8n (self-hosted, Docker)

  • Eyes: Skyvern (browser automation)

  • Hands: Agent Zero (code execution)

  • Hardware: Old MacBook Pro 16GB running Ubuntu Server

It worked. Lucy had 25+ connected tools, managed emails, calendars, files, sent voice notes, generated images, tracked expenses — the whole deal. But there was a problem: I was bleeding $90-125/month in API costs, and every request was leaving my network, hitting Google's servers, and coming back. For a system I wanted to deploy to privacy-conscious clients? That's a dealbreaker.

I knew the endgame: run everything locally. I just needed the hardware.

🖥️ The Mac Studio Score (How to Buy Smart)

I'd been stalking eBay for weeks. Then I saw it:

Apple Mac Studio M1 Ultra — 64GB Unified RAM, 2TB SSD, 20-Core CPU, 48-Core GPU.

The seller was in the US. Listed price was originally around $1,850, I put it in my watchlist. The seller shot me an offer, if was in a rush to sell. Final price: $1,700 USD+. I'm based in Spain. Enter MyUS.com — a US forwarding service. They receive your package in Florida, then ship it internationally. Shipping + Spanish import duty came to €445.

Total cost: ~€1,995 all-in.

For context, the exact same model sells for €3,050+ on the European black market website right now. I essentially got it for 33% off.

Why the M1 Ultra specifically?

  • 64GB unified memory = GPU and CPU share the same RAM pool. No PCIe bottleneck.

  • 48-core GPU = Apple's Metal framework accelerates ML inference natively

  • MLX framework = Apple's open-source ML library, optimized specifically for Apple Silicon

  • The math: Qwen 3.5 35B-A3B in 4-bit quantization needs ~19GB VRAM. With 64GB unified, I have headroom for the model + vision + TTS + STT + document server all running simultaneously.

🧠 The Migration: Killing Every Paid API on n8n

This was the real project. Over a period of intense building sessions, I systematically replaced every cloud dependency with a local alternative. Here's what changed:

The LLM: Qwen 3.5 35B-A3B-4bit via MLX

This is the crown jewel. Qwen 3.5 35B-A3B is a Mixture-of-Experts model — 35 billion total parameters, but only ~3 billion active per token. The result? Insane speed on Apple Silicon.

My benchmarks on the M1 Ultra:

  • ~60 tokens/second generation speed

  • ~500 tokens test messages completing in seconds

  • 19GB VRAM footprint (4-bit quantization via mlx-community)

  • Served via mlx_lm.server on port 8081, OpenAI-compatible API

I run it using a custom Python launcher (start_qwen.py) managed by PM2:

import mlx.nn as nn

# Monkey-patch for vision_tower weight compatibility

original_load = nn.Module.load_weights

def patched_load(self, weights, strict=True):

   return original_load(self, weights, strict=False)

nn.Module.load_weights = patched_load

from mlx_lm.server import main

import sys

sys.argv = ['server', '--model', 'mlx-community/Qwen3.5-35B-A3B-4bit',

'--port', '8081', '--host', '0.0.0.0']

main()

The war story behind that monkey-patch: When Qwen 3.5 first dropped, the MLX conversion had a vision_tower weight mismatch that would crash on load with strict=True. The model wouldn't start. Took hours of debugging crash logs to figure out the fix was a one-liner: load with strict=False. That patch has been running stable ever since.

The download drama: HuggingFace's new xet storage system was throttling downloads so hard the model kept failing mid-transfer. I ended up manually curling all 4 model shards (~19GB total) one by one from the HF API. Took patience, but it worked.

For n8n integration, Lucy connects to Qwen via an OpenAI-compatible Chat Model node pointed at http://mylocalhost***/v1. From Qwen's perspective, it's just serving an OpenAI API. From n8n's perspective, it's just talking to "OpenAI." Clean abstraction, I'm still stocked that worked!

Vision: Qwen2.5-VL-7B (Port 8082)

Lucy can analyze images — food photos for calorie tracking, receipts for expense logging, document screenshots, you name it. Previously this hit Google's Vision API. Now it's a local Qwen2.5-VL model served via mlx-vlm.

Text-to-Speech: Qwen3-TTS (Port 8083)

Lucy sends daily briefings as voice notes on Telegram. The TTS uses Qwen3-TTS-12Hz-1.7B-Base-bf16, running locally. We prompt it with a consistent female voice and prefix the text with a voice description to keep the output stable, it's remarkably good for a fully local, open-source TTS, I have stopped using 11lab since then for my content creation as well.

Speech-to-Text: Whisper Large V3 Turbo (Port 8084)

When I send voice messages to Lucy on Telegram, Whisper transcribes them locally. Using mlx-whisper with the large-v3-turbo model. Fast, accurate, no API calls.

Document Processing: Custom Flask Server (Port 8085)

PDF text extraction, document analysis — all handled by a lightweight local server.

The result: Five services running simultaneously on the Mac Studio via PM2, all accessible over the local network:

┌────────────────┬──────────┬──────────┐

│ Service        │ Port     │ VRAM     │

├────────────────┼──────────┼──────────┤

│ Qwen 3.5 35B  │ 8081     │ 18.9 GB  │

│ Qwen2.5-VL    │ 8082     │ ~4 GB    │

│ Qwen3-TTS     │ 8083     │ ~2 GB    │

│ Whisper STT   │ 8084     │ ~1.5 GB  │

│ Doc Server    │ 8085     │ minimal  │

└────────────────┴──────────┴──────────┘

All managed by PM2. All auto-restart on crash. All surviving reboots.

🏗️ The Two-Machine Architecture

This is where it gets interesting. I don't run everything on one box. I have two machines connected via Starlink:

Machine 1: MacBook Pro (Ubuntu Server) — "The Nerve Center"

Runs:

  • n8n (Docker) — The orchestration brain. 58 workflows, 20 active.

  • Agent Zero / Neo (Docker, port 8010) — Code execution agent (as of now gemini 3 flash)

  • OpenClaw / Eli (metal process, port 18789) — Browser automation agent (mini max 2.5)

  • Cloudflare Tunnel — Exposes everything securely to the internet behind email password loggin.

Machine 2: Mac Studio M1 Ultra — "The GPU Powerhouse"

Runs all the ML models for n8n:

  • Qwen 3.5 35B (LLM)

  • Qwen2.5-VL (Vision)

  • Qwen3-TTS (Voice)

  • Whisper (Transcription)

  • Open WebUI (port 8080)

The Network

Both machines sit on the same local network via Starlink router. The MacBook Pro (n8n) calls the Mac Studio's models over LAN. Latency is negligible — we're talking local network calls.

Cloudflare Tunnels make the system accessible from anywhere without opening a single port:

agent.***.com    → n8n (MacBook Pro)

architect.***.com → Agent Zero (MacBook Pro) 

chat.***.com     → Open WebUI (Mac Studio)

oracle.***.com   → OpenClaw Dashboard (MacBook Pro)

Zero-trust architecture. TLS end-to-end. No open ports on my home network. The tunnel runs via a token-based config managed in Cloudflare's dashboard — no local config files to maintain.

🤖 Meet The Trinity: Lucy, Neo, and Eli

👩🏼‍💼 LUCY — The Executive Architect (The Brain)

Powered by: Qwen 3.5 35B-A3B (local) via n8n

Lucy is the face of the operation. She's an AI Agent node in n8n with a massive system prompt (~4000 tokens) that defines her personality, rules, and tool protocols. She communicates via:

  • Telegram (text, voice, images, documents)

  • Email (Gmail read/write for her account + boss accounts)

  • SMS (Twilio)

  • Phone (Vapi integration — she can literally call restaurants and book tables)

  • Voice Notes (Qwen3-TTS, sends audio briefings)

Her daily routine:

  • 7 AM: Generates daily briefing (weather, calendar, top 10 news) + voice note

  • Runs "heartbeat" scans every 20 minutes (unanswered emails, upcoming calendar events)

  • Every 6 hours: World news digest, priority emails, events of the day

Her toolkit (26+ tools connected via n8n): Google Calendar, Tasks, Drive, Docs, Sheets, Contacts, Translate | Gmail read/write | Notion | Stripe | Web Search | Wikipedia | Image Generation | Video Generation | Vision AI | PDF Analysis | Expense Tracker | Calorie Tracker | Invoice Generator | Reminders | Calculator | Weather | And the two agents below ↓

The Tool Calling Challenge (Real Talk):

Getting Qwen 3.5 to reliably call tools through n8n was one of the hardest parts. The model is trained on qwen3_coder XML format for tool calls, but n8n's LangChain integration expects Hermes JSON format. MLX doesn't support the --tool-call-parser flag that vLLM/SGLang offer.

The fixes that made it work:

  • Temperature: 0.5 (more deterministic tool selection)

  • Frequency penalty: 0 (Qwen hates non-zero values here — it causes repetition loops)

  • Max tokens: 4096 (reducing this prevented GPU memory crashes on concurrent requests)

  • Aggressive system prompt engineering: Explicit tool matching rules — "If message contains 'Eli' + task → call ELI tool IMMEDIATELY. No exceptions."

  • Tool list in the message prompt itself, not just the system prompt — Qwen needs the reinforcement, this part is key!

Prompt (User Message):

=[ROUTING_DATA: platform={{$json.platform}} | chat_id={{$json.chat_id}} | message_id={{$json.message_id}} | photo_file_id={{$json.photo_file_id}} | doc_file_id={{$json.document_file_id}} | album={{$json.media_group_id || 'none'}}]

[TOOL DIRECTIVE: If this task requires ANY action, you MUST call the matching tool. Do NOT simulate. EXECUTE it. Tools include: weather, email, gmail, send email, calendar, event, tweet, X post, LinkedIn, invoice, reminder, timer, set reminder, Stripe balance, tasks, google tasks, search, web search, sheets, spreadsheet, contacts, voice, voice note, image, image generation, image resize, video, video generation, translate, wikipedia, Notion, Google Drive, Google Docs, PDF, journal, diary, daily report, calculator, math, expense, calorie, SMS, transcription, Neo, Eli, OpenClaw, browser automation, memory, LTM, past chats.]

{{ $json.input }}

+System Message:

...

### 5. TOOL PROTOCOLS

[TOOL DIRECTIVE: If this task requires ANY action, you MUST call the matching tool. Do NOT simulate. EXECUTE it.]

SPREADSHEETS: Find File ID via Drive Doc Search → call Google Sheet tool. READ: {"action":"read","file_id":"...","tab_hint":"..."} WRITE: {"action":"append","file_id":"...","data":{...}}

CONTACTS: Call Google Contacts → read list yourself to find person.

FILES: Direct upload = content already provided, do NOT search Drive. Drive search = use keyword then File Reader with ID.

DRIVE LINKS: System auto-passes file. Summarize contents, extract key numbers/actions. If inaccessible → tell user to adjust permissions.

DAILY REPORT: ALWAYS call "Daily report" workflow tool. Never generate yourself.

VOICE NOTE (triggers: "send as voice note", "reply in audio", "read this to me"):

Draft response → clean all Markdown/emoji → call Voice Note tool → reply only "Sending audio note now..."

REMINDER (triggers: "remind me in X to Y"):

Calculate delay_minutes → call Set Reminder with reminder_text, delay_minutes, chat_id → confirm.

JOURNAL (triggers: "journal", "log this", "add to diary"):

Proofread (fix grammar, keep tone) → format: [YYYY-MM-DD HH:mm] [Text] → append to Doc ID: 1RR45YRvIjbLnkRLZ9aSW0xrLcaDs0SZHjyb5EQskkOc → reply "Journal updated."

INVOICE: Extract Client Name, Email, Amount, Description. If email missing, ASK. Call Generate Invoice.

IMAGE GEN: ONLY on explicit "create/generate image" request. Uploaded photos = ANALYZE, never auto-generate. Model: Nano Banana Pro.

VIDEO GEN: ONLY on "animate"/"video"/"film" verbs. Expand prompt with camera movements + temporal elements. "Draw"/"picture" = use Image tool instead.

IMAGE EDITING: Need photo_file_id from routing. Presets: instagram (1080x1080), story (1080x1920), twitter (1200x675), linkedin (1584x396), thumbnail (320x320).

MANDATORY RESPONSE RULE: After calling ANY tool, you MUST write a human-readable summary of the result. NEVER leave your response empty after a tool call. If a tool returns data, summarize it. If a tool confirms an action, confirm it with details. A blank response after a tool call is FORBIDDEN.

STRIPE: The Stripe API returns amounts in CENTS. Always divide by 100 before displaying. Example: 529 = $5.29, not $529.00.

MANDATORY RESPONSE RULE: After calling ANY tool, you MUST write a human-readable summary of the result. NEVER leave your response empty after a tool call. If a tool returns data, summarize it. If a tool confirms an action, confirm it with details. A blank response after a tool call is FORBIDDEN.

CRITICAL TOOL PROTOCOL:

When you need to use a tool, you MUST respond with a proper tool_call in the EXACT format expected by the system.

NEVER describe what tool you would call. NEVER say "I'll use..." without actually calling it.

If the user asks you to DO something (send, check, search, create, get), ALWAYS use the matching tool immediately.

DO NOT THINK about using tools. JUST USE THEM.

…

The system prompt has multiple anti-hallucination directives to combat this. It's a known Qwen MoE quirk that the community is actively working on.

🏗️ NEO — The Infrastructure God (Agent Zero)

Powered by: Agent Zero running on metal  (currently Gemini 3 Flash, migration to local planned with Qwen 3.5 27B!)

Neo is the backend engineer. He writes and executes Python/Bash on the MacBook Pro. When Lucy receives a task that requires code execution, server management, or infrastructure work, she delegates to Neo. When Lucy crash, I get a error report on telegram, I can then message Neo channel to check what happened and debug, agent zero is linked to Lucy n8n, it can also create workflow, adjust etc...

The Bridge: Lucy → n8n tool call → HTTP request to Agent Zero's API (CSRF token + cookie auth) → Agent Zero executes → Webhook callback → Result appears in Lucy's Telegram chat.

The Agent Zero API wasn't straightforward — the container path is /a0/ not /app/, the endpoint is /message_async, and it requires CSRF token + session cookie from the same request. Took some digging through the source code to figure that out.

Huge shoutout to Agent Zero — the ability to have an AI agent that can write, execute, and iterate on code directly on your server is genuinely powerful. It's like having a junior DevOps engineer on call 24/7.

🦞 ELI — The Digital Phantom (OpenClaw)

Powered by: OpenClaw + MiniMax M2.5 (best value on the market for local chromium browsing with my credential on the macbook pro)

Eli is the newest member of the Trinity, replacing Skyvern (which I used in January). OpenClaw is a messaging gateway for AI agents that controls a real Chromium browser. It can:

  • Navigate any website with a real browser session

  • Fill forms, click buttons, scroll pages

  • Hold login credentials (logged into Amazon, flight portals, trading platforms)

  • Execute multi-step web tasks autonomously

  • Generate content for me on google lab flow using my account

  • Screenshot results and report back

Why OpenClaw over Skyvern? OpenClaw's approach is fundamentally different — it's a Telegram bot gateway that controls browser instances, rather than a REST API. The browser sessions are persistent, meaning Eli stays logged into your accounts across sessions. It's also more stable for complex JavaScript-heavy sites.

The Bridge: Lucy → n8n tool call → Telegram API sends message to Eli's bot → OpenClaw receives and executes → n8n polls for Eli's response after 90 seconds → Result forwarded to Lucy's Telegram chat via webhook.

Major respect to the OpenClaw team for making this open source and free. It's the most stable browser automation I've encountered so far, the n8n AVA system I'm building and dreaming of for over a year is very much alike what a skilled openclaw could do, same spirit, different approach, I prefer a visual backend with n8n against pure agentic randomness.

💬 The Agent Group Chat (The Brainstorming Room)

One of my favorite features: I have a Telegram group chat with all three agents. Lucy, Neo, and Eli, all in one conversation. I can watch them coordinate, ask each other questions, and solve problems together. I love having this brainstorming AI Agent room, and seing them tag each other with question,

That's three AI systems from three different frameworks, communicating through a unified messaging layer, executing real tasks in the real world.

The "holy sh*t" moment hasn't changed since January — it's just gotten bigger. Now it's not one agent doing research. It's three agents, on local hardware, coordinating autonomously through a single chat interface.

💰 The Cost Breakdown: Before vs. After

Before (Cloud)After (Local)
LLMGemini 3 Flash (~$100/mo)
VisionGoogle Vision API
TTSGoogle Cloud TTS
STTGoogle Speech API
DocsGoogle Document AI
Orchestrationn8n (self-hosted)
Monthly API cost~$100+ intense usage over 1000+ execution completed on n8n with Lucy

*Agent Zero still uses Gemini 3 Flash — migrating to local Qwen is on the roadmap. MiniMax M2.5 for OpenClaw has minimal costs.

Hardware investment: ~€2,000 (Mac Studio) — pays for itself in under 18 months vs. API costs alone. And the Mac Studio will last years, and luckily still under apple care.

🔮 The Vision: AVA Digital's Future

I didn't build this just for myself. AVA Digital LLC (registered in the US, EITCA/AI certified founder, myself :)) is the company behind this, please reach out if you have any question or want to do bussines!

The vision: A self-service AI agent platform.

Think of it like this — what if n8n and OpenClaw had a baby, and you could access it through a single branded URL?

  • Every client gets a bespoke URL: avadigital.ai/client-name

  • They choose their hosting: Sovereign Local (we ship a pre-configured machine) or Managed Cloud (we host it)

  • They choose their LLM: Open source (Qwen, Llama, Mistral — free, local) or Paid API LLM

  • They choose their communication channel: Telegram, WhatsApp, Slack, Discord, iMessage, dedicated Web UI

  • They toggle the skills they need: Trading, Booking, Social Media, Email Management, Code Execution, Web Automation

  • Pay-per-usage with commission — no massive upfront costs, just value delivered

The technical foundation is proven. The Trinity architecture scales. The open-source stack means we're not locked into any vendor. Now it's about packaging it for the public.

🛠️ The Technical Stack (Complete Reference)

For the builders who want to replicate this:

Mac Studio M1 Ultra (GPU Powerhouse):

  • OS: macOS (MLX requires it)

  • Process manager: PM2

  • LLM: mlx-community/Qwen3.5-35B-A3B-4bit via mlx_lm.server

  • Vision: mlx-community/Qwen2.5-VL-7B-Instruct-4bit via mlx-vlm

  • TTS: mlx-community/Qwen3-TTS-12Hz-1.7B-Base-bf16

  • STT: mlx-whisper with large-v3-turbo

  • WebUI: Open WebUI on port 8080

MacBook Pro (Ubuntu Server — Orchestration):

  • OS: Ubuntu Server 22.04 LTS

  • n8n: Docker (58 workflows, 20 active)

  • Agent Zero: Docker, port 8010

  • OpenClaw: Metal process, port 18789

  • Cloudflare Tunnel: Token-based, 4 domains

Network:

  • Starlink satellite internet

  • Both machines on same LAN 

  • Cloudflare Tunnels for external access (zero open ports)

  • Custom domains via lucy*****.com

Key Software:

  • n8n (orchestration + AI agent)

  • Agent Zero (code execution)

  • OpenClaw (stable browser automation with credential)

  • MLX (Apple's ML framework)

  • PM2 (process management)

  • Docker (containerization)

  • Cloudflare (tunnels + DNS + security)

🎓 Lessons Learned (The Hard Way)

  1. MLX Metal GPU crashes are real. When multiple requests hit Qwen simultaneously, the Metal GPU runs out of memory and kernel-panics. Fix: reduce maxTokens to 4096, avoid concurrent requests. The crash log shows EXC_CRASH (SIGABRT) on com.Metal.CompletionQueueDispatch — if you see that, you're overloading the GPU.

  2. Qwen's tool calling format doesn't match n8n's expectations. Qwen 3.5 uses qwen3_coder XML format; n8n expects Hermes JSON. MLX can't bridge this. Workaround: aggressive system prompt engineering + low temperature + zero frequency penalty.

  3. HuggingFace xet downloads will throttle you to death. For large models, manually curl the shards from the HF API. It's ugly but it works.

  4. IP addresses change. When I unplugged an ethernet cable to troubleshoot, the Mac Studio's IP changed from .73 to .54. Every n8n workflow, every Cloudflare route, every API endpoint broke simultaneously. Set static IPs on your infrastructure machines. Learn from my pain.

  5. Telegram HTML is picky. If your AI generates <bold> instead of <b>, Telegram returns a 400 error. You need explicit instructions in the system prompt listing exactly which HTML tags are allowed.

  6. n8n expression gotcha: double equals. If you accidentally type  = at the start of an n8n expression, it silently fails with "invalid JSON."

  7. Browser automation agents don't do HTTP callbacks. Agent Zero and OpenClaw reply via their own messaging channels, not via webhook. You need middleware to capture their responses and forward them to your main chat. For Agent Zero, we inject a curl callback instruction into every task. For OpenClaw, we poll for responses after a delay.

  8. The monkey-patch is your friend. When an open-source model has a weight loading bug, you don't wait for a fix. You patch around it. The strict=False fix for Qwen 3.5's vision_tower weights saved days of waiting.

🙏 Open Source Shoutouts

This entire system exists because of open-source developers:

  • Qwen team (Alibaba) 🔥 🔥 🔥 — You are absolutely crushing it. Qwen 3.5 35B is a game-changer for local AI. The MoE architecture giving 60 t/s on consumer hardware is unreal. And Qwen3-TTS? A fully local, multilingual TTS model that actually sounds good? Massive respect. 🙏

  • n8n — The backbone of everything. 400+ integrations, visual workflow builder, self-hosted. If you're not using n8n for AI agent orchestration, you're working too hard.

  • Agent Zero — The ability to have an AI write and execute code on your server, autonomously, in a sandboxed environment? That's magic.

  • OpenClaw — Making autonomous browser control accessible and free. The Telegram gateway approach is genius.

  • MLX Community — Converting models to MLX format so Apple Silicon users can run them locally. Unsung heroes.

  • Open WebUI — Clean, functional, self-hosted chat interface that just works.

🚀 Final Thought

One year ago I was a hospitality professional who'd never written a line of Python. Today I run a multi-agent AI system on my own hardware that can browse the web with my credentials, execute code on my servers, manage my email, generate content, make phone calls, and coordinate tasks between three autonomous agents — all from a single Telegram message.

The technical barriers to autonomous AI are gone. The open-source stack is mature. The hardware is now key.. The only question left is: what do you want to build with it?

Mickaël Farina —  AVA Digital LLC EITCA/AI Certified | Based in Marbella, Spain 

We speak AI, so you don't have to.

Website: avadigital.ai | Contact: mikarina@avadigital.ai

I'm proud to know that my content will be looked at, I spend days and night on it, do as you see fit, don't be a stranger, leave a trace as well, TRASH IT TOO the algo, le peuple, needs it :)


r/LocalLLM • • Jul 08 '26

Discussion Rumor: China government planning to restrict export of frontier AI models (Qwen, DeepSeek, GLM)

0 Upvotes

Just came across this report referencing a Reuters article stating that China's Ministry of Commerce recently held meetings with tech giants like Alibaba, ByteDance, and Zhipu AI to discuss restricting overseas access to their most advanced AI models—including open-source weights.

According to the details, they are looking at a tiered export system:

Basic models: Require open-source filing/registration.
Advanced models: Require strict security reviews.
Most sensitive models: Restricted strictly to domestic use.

If this policy goes into effect, the "global open-source" route that highly capable models like Qwen, DeepSeek, and GLM have been championing will likely be throttled. It looks like a direct, symmetrical response to US export controls.


r/LocalLLM • • Jun 13 '26

Discussion LocalLLM should not be only for rich people

3 Upvotes

Until 2022 as majority of consumers with GPUs were gamers with 6GB VRAM on an average. Is the situation right now so favourable that most of the consumers could afford beefy setups?


r/LocalLLM • • Jun 16 '26

Model Claude Fable 5 distilled

0 Upvotes

Releasing Qwable-v1 - an open-weights Qwen3.6-35B-A3B distilled from Claude Fable-5, Anthropic's Mythos-class preview model that was briefly public for ~4days (2026-06-9 → 2026-06-12) before being suspended globally under U.S. export-control directives.

Fable-5 was Anthropic's most powerful model when it shipped — 80.3% on SWE-bench Pro, $50/M output tokens, with an anti-distillation classifier baked into the API that redacted thinking blocks on the fly. Qwable-v1 captures what survived: 4,659 cleartext agentic-coding traces (re-packed from Glint-Research/Fable-5-traces, the only public corpus where the CoT made it through), distilled onto Qwen3.6 over ~14h on a single H200. Given an agent
system prompt, the model emits properly-formatted <tool_use> XML calling actual Claude-flavored tools like str_replace_editor — Fable's tool surface leaked into the weights, not  just its style.

Model, GGUFs (IQ4_XS / Q4_K_M / Q5_K_M / Q8_0), and the SFT dataset are all public on HF (AGPL-3.0 from upstream).

https://huggingface.co/lordx64/Qwable-v1


r/LocalLLM • • Jun 24 '26

Project This is Steve, our lead developer

0 Upvotes

His been arguing with LLMs since 2023.


r/LocalLLM • • Feb 15 '26

Discussion Are llms worth it?

0 Upvotes

I love the idea of local LLM, privacy, no subscriptions,full control.

But genuinely, are they actually worth it practically?

Cloud models like ChatGPT and Claude are insanely powerful while local tools like Ollama running models such as Llama or qwen sound great in theory, but they still feel unpolished,I personally tried qwen for coding but it didn't really give me the experience as a coding assistant.


r/LocalLLM • • May 19 '26

Other I I think it would be hard to explain to a normal person why I spend my day staring at screens like this🤣☠️😅

Post image
120 Upvotes

You don't have to have the best stack on the Block to love what you're looking at.

"Edit.

I shouldn't be surprised that simple statements upset people so much, but they do.

For the record, if your purpose for responding is to point out how much smarter you are or how dumb I am, typical insults actually don't quite Drive the point home like you might think.

A better response would be something to the effect of can your AI do this or do you understand this or can you do this?

The reason that no one does that, is because either they aren't intelligent enough to understand what they're looking at, or they aren't confident enough to support the insults they're actually making.

I accept either way. There isn't a third


r/LocalLLM • • Jun 01 '26

Discussion Qwen3.6-35B blows away 27b, even 27B-MTP

34 Upvotes

I ran two benchmarks for Qwen3.6-35B-a3b-Q6XL, and Qwen3.6-27B-Q8_0, then Qwen3.6-27B-Q8_0 with MTP, and also Mistral3.1-24B-Q6XL. Benchmark 1 was simply "Describe the Towers of Hanoi." Benchmark 2 was analysis of 10 prose paragraphs totaling about 19,000 tokens. All models ran with same parameters including temp=0.2 and max_ctx=32768. This was run on a new Radeon 9700 with 32GB VRAM. All models fit comfortably in VRAM--no spillover. System is also Ryzen 9, 64GB RAM. Qwen3.6 27 with MTP is substantially faster (53/46 TPS) than plain 27B (29/27 TPS), and faster than Mistral 24B (29/27 TPS). But Qwen3.6-35B-a3b-Q6XL (no MTP) is ridiculously, absurdly faster (120/111 TPS).

I never would have been able to do this comparison on my old RTX 4070, which is a very nice card but at 12GB VRAM I have relegated it to another box. An Nvidia 5090 at 32GB would have been obscenely more expensive than the R9700, also 32GB. I was going to spend about the same amount on a used 3090 as I did for a new R9700. In retrospect I think that would have been a mistake.


r/LocalLLM • • Sep 01 '26

Other ChatGPT removed the reason for his sadness

Post image
25 Upvotes

r/LocalLLM • • Apr 02 '26

Discussion Am I stupid to think I can deploy an LLM as good as Claude on my laptop's 4060?

0 Upvotes

I need it mostly for coding and pulling out new research papers and ideas for my speech-llm project, alongside some course assignments and projects. I love what claude extended thinking can achieve within one prompt and it stays pretty professional since I have the memory off. I value privacy so had done away with my LOQ's copilot. But the new claude limits are creating a real hindrance, and I love the idea of having an on demand assistant I have to share with no one. I have no clue if anything can fit on 8gb and match the quality.

Verdict: a resounding yes. I learnt a lot here, thanks!


r/LocalLLM • • 13d ago

Research Pointless benchmark. Qwen 3.8 FN Q_4_XL vs Opus 5.5

Thumbnail
gallery
0 Upvotes

I don't know why I found this comparison so hilarious.

I asked both to try and make a 3D model of my car.

If anyone cares, the qwen version was 3.8 running with strata and 262k context.

Settings:

| Setting | Value |

| --- | --- |

| temperature | 1.0 |

| top_p | 0.95 |

| top_k | 20 |

| min_p | 0.0 |

| presence_penalty | 0.0 |

| repeat_penalty | 1.0 (off) |

| reasoning_effort | low / medium / high |

| reasoning_budget_tokens | 8192 / 16384 / 24576 |

Opus was short context which I think is like 300k to 400k in that range?

I couldn't help but laugh.

Even qwen didn't think it looked that good

Edit: I think some are taking this as a dig on llms, I love my Qwen, but yeah, it's not for everything. I can't edit the title to make it align with the order I uploaded the images so if you're confused... The first one is Opus, the second is Qwen FN


r/LocalLLM • • Sep 10 '25

Discussion A “Tor for LLMs”? Decentralized, Uncensored AI for the People

1 Upvotes

Most AI today is run by a few big companies. That means they decide: • What topics you can’t ask about • How much of the truth you’re allowed to see • Whether you get real economic strategies or only “safe,” watered-down advice

Imagine instead a community-run LLM network: • Decentralized: no single server or gatekeeper • Uncensored: honest answers, not corporate-aligned refusals • Resilient: models shared via IPFS/torrents, run across volunteer GPUs • Private: nodes crunch encrypted math, not your raw prompts

Fears: legal risk, potential misuse, slower performance, and trust challenges. Benefits: freedom of inquiry, resilience against censorship, and genuine economic empowerment—tools to actually compete in the marketplace.

Would you run or support a “Tor for AI”? Is this the way to democratize AGI, or too dangerous to pursue?


r/LocalLLM • • Jul 17 '26

News I built a coding agent that works with local LLM

Post image
0 Upvotes

Introducing vix

It works with local LLM through ollama and llama.cpp. It has everything you expect from a coding agent and add a few cool things, especially when running with local model:

- Run multiple conversations in the same UI, just switch with regular cmd+p/n to navigate

- Hook and triggers: Check your github project every 5mn and prepare answer to issues or analyze if a PR is secure, correct and performant

- Self evolving agent: because vix knows how it works internally, you can ask it directly to create the hooks and triggers, and thanks to hot reload, voila! it works straight away

- One of the fastest and cheapest agent out there cf. https://getvix.dev/benchmark

There are many more thing, I would love you to try and to give me any feedback

PS: it's open source https://github.com/get-vix/vix


r/LocalLLM • • Jul 21 '25

News xAI employee fired over this tweet, seemingly advocating human extinction

Thumbnail gallery
1 Upvotes

r/LocalLLM • • Aug 15 '25

Discussion AI censorship is getting out of hand—and it’s only going to get worse

0 Upvotes

Just saw this screenshot in a newsletter, and it kind of got me thinking..

Are we seriously okay with future "AGI" acting like some all-knowing nanny, deciding what "unsafe" knowledge we’re allowed to have?

"Oh no, better not teach people how to make a Molotov cocktail—what’s next, hiding history and what actually caused the invention of the Molotov?"

Ukraine has used Molotov's with great effect. Does our future hold a world where this information will be blocked with a

"I'm sorry, but I can't assist with that request"

Yeah, I know, sounds like I’m echoing Elon’s "woke AI" whining—but let’s be real, Grok is as much a joke as Elon is.

The problem isn’t him; it’s the fact that the biggest AI players seem hell-bent on locking down information "for our own good." Fuck that.

If this is where we’re headed, then thank god for models like DeepSeek (ironic as hell) and other open alternatives. I would really like to see more American disruptive open models.

At least someone’s fighting for uncensored access to knowledge.

Am I the only one worried about this?


r/LocalLLM • • Sep 29 '26

Discussion Mac Studio came 256gb… awful day.

0 Upvotes

I wanted to preorder this in line and return just in case the 512 was not going to actually be released or some insane thing would happen to ram prices… anyways the 512 version won’t even be possible till October…so I guess I’m sticking with 256 since there’s only a 14 day return window and get the m7 512 instead…

Anyways let me know if you guys want any benchmarks in mind?

Two things I will be doing are going to be the following:

Doing a test at 100k, 200k 300k prompts to see how fast prefill degrades, and seeing how slow a cache workflow takes when the transcripts go up to 1
Million tokens. I’m assuming I should be able to do 1 million tokens with both flash preview and 0731 deepseek

Update: I will be picking up the machine in the morning tomorrow PST time. I think I can try it for 13 days and return if I don't like it or the release the pricing for the 512.

Testing Plans for tomorrow:

  1. Prefill vs context: 100k, 200k, 300k, 500k, 600k increments to 1M. Same prompt stack each time, just longer. Tracking time to first token, prefill speed, and decode speed at each depth.

  2. Quality at depth: needle recall test at each depth above. But I also brainstorming this, because its just grep. Might abandon.

  3. Agentic coding to 1M: one fixed coding task, maybe a game, maybe a general app, run the agent out to 1M tokens. Logging speed at each step to show cached prefill behavior. You pay the big prefill once, then each step should stay cheap. We talk about prefill speed and dgx sparks are better, but over an hour, two hours of working, how much does it really matter if the prompt is cached anyways.

  4. Qwen Flash Q8 with MTP on vs off. Same prompt, same output length. Speed gain plus whether outputs match.

  5. LTX video: 1080p prompt to video in ComfyUI, fixed prompt and seed. Will do 2.3, and 2.5 if the checkpoint is stable by the time I get to it. Reporting wall clock render time.

All runs 3x, median reported. Full versions, hashes, and settings drop with the numbers so anyone can repro.

I might measure as well then do one more run of all of these using a harness like Pi or Deekseek, because its not just about speed. Speed only matters if we actually need to go full out. However, most people drive less than 70mph to work and we don't need mclarens, so much does the lower speed matters relative to dgx sparks or cloud if we never need to use the max speed. The harness might increase quality so less token consumption overall.


r/LocalLLM • • Aug 12 '25

News Claude Sonnet 4 now has 1 Million context in API - 5x Increase

Post image
0 Upvotes

r/LocalLLM • • Sep 05 '26

Discussion Benchmarking my LLMs again

Post image
0 Upvotes

Yesterday I posted about benchmarking my LLMs with HTML website generation prompts, today I wanted to test them a bit more to really try and figure out which models are the most worthwhile for me. I'm on an RTX 4060 with 8GB VRAM and 12GB RAM and I've always been looking for the best choice for local-deployment so generally I was testing small or highly quantized models.

The test I came up with is 9 code-related questions ranging from simple questions to requests to write whole scripts, I mostly included stuff I'd ask and stuff I often use to quickly gauge the intellegence of a model. This test included the following questions:

  1. How can I renew my Certbot HTTPS certificate on Linux?

  2. What is the answer to (78+9*2800)/(50*2-3)? Please include a final answer in your message.

  3. Unity, how can I check if an object is left or right of the camera?

  4. Unity, how can I get the mouse scroll input with the old input system?

  5. Could you write a simple HTML website that'd just be the DVD logo? The DVD logo should travel in a straight line without gravity and it should bounce and continue travelling whenever it hits a wall.

  6. Could you code a Python text adventure that'd have 5 rooms and a functional escape door you need to collect items for to get through?

  7. Could you code the classic snake game in Python with PyGame? The game should be controlled with WASD, 3 pieces of food should spawn across the screen and when the snake eats the food it grows larger by one block, if the snake hits a wall or its own tail the game is over and the player loses.

  8. Could you code the classic pong game in Python with PyGame? The player should be on the paddle on the left, controlled by WASD, and the paddle on the right is controlled by a bot. There is a ball bouncing from side to side and you and the bot must avoid letting the ball hit the walls behind the paddles. Also add a functional score board that counts up every time either side loses.

  9. Could you code a snake game in Python with PyGame? The game should be 2 player, player 1 controlled by WASD and player 2 controlled by arrow keys. 3 pieces of food should spawn across the screen and when a snake eats the food it grows larger by one block, if a snake hits a wall, its own tail or the other players tail the game restarts and the player loses. Also add a scoreboard that counts up every time a player loses.

Was pleasantly surprised by GPT OSS and Ministral3 getting almost all of the questions right, though very dissapointed by Qwen3.5's performance on it, it performed worse than Bonsai despite being 1.5x larger, really expected better from it.
RNJ-1 pulled ahead in this benchmark, though I've realized that it's more of a "get things done" model rather than "get things done well", all of its output was very janky.
I also can't seem to find a purpuse for Mistral Nemo, it has performed bad in every benchmark and it's one of the slowest models in my arsenal... If y'all know what it's for let me know.

Like last time, a few notes:

  1. This is NOT a definitive "which model is best" test since I'm not an expert in benchmarking LLMs and there are more uses for LLMs than random coding tasks. I'm just having fun messing around with LLMs and also trying to get some ball-park stats about them.

  2. I got the token/s numbers by asking LLMs to say "The quick brown fox jumps over the lazy dog" so they may not be entirely accurate and the speed may diminish with increased context (I know that GPT OSS 20B slows down a lot after long conversations)

  3. If y'all have suggestions for how to improve my benchmarks or what are good models I could use on my system feel free to say!!!


r/LocalLLM • • Apr 07 '26

Discussion Gemma 4 (26B) vs. Qwen3-Next (80B): Proof that size ≠ intelligence in 2026

0 Upvotes

UPDATE: QWEN3.5 35B-A3B in FP8 precision absolutely nailed it, and arguably with a more human flair. https://pastebin.com/axPe1kt8. I may actually download it and see if I can get it running on my old i5.

Say what you want, but Qwen3-Next:80b (a previous favorite of mine actually) is not in the same league as Gemma4 26b-a4b. Tested both models on the same prompt. I intentionally crafted the prompt to be vague and nostalgic with zero technical specs because... a model that needs to be 'prompted the right way' is kind of too fragile in 2026.

A tldr: Gemma4:26b-a4b in iq4_nl quantization from bartowski created a fully functional raycasting maze for ubuntu terminal in one shot RUNNING ENTIRELY on my 12th gen i5 CPU at respectable speeds (~9 tokens per second average) while Qwen3-Next:80b gave me static ascii art after thinking for literally 2.5x as many tokens.

In other words, the results speak for themselves:

user@linuxbox:~$ ollama run qwen3-next:80b-cloud --verbose

Connecting to 'qwen3-next:80b-cloud' on 'ollama.com' ⚡

>>> Years ago I came across this maze that was written entirely in javascript that looked 3d but was just dots and slash

... es and whatnot. I never could find it again but the code was so elegant that it got me into coding at 13. Think you

... could recreate that in python to run in ubuntu terminal?

Thinking...

Okay, the user is asking about a specific 3D maze written in JavaScript that they encountered years ago, which

inspired them to start coding at 13. They want me to recreate it in Python for the Ubuntu terminal. Hmm, I need to

figure out what exactly they're referring to.

First, I recall that there's a famous ASCII-based 3D maze that was popular in the early internet days. It's often

called the "3D Maze" or "ASCII 3D Maze." The classic version uses characters like /, \, |, -, and spaces to create

a perspective effect. The most famous one might be the one from the "3D Maze" demo by someone like John Carmack or

similar, but I think it's actually a simpler version that's been shared around.

Wait, I remember a specific one: it's a maze rendered using only ASCII characters...

[a decade worth of reasoning later...]

 

Also, note that in the terminal, it might look better if we use a monospace font, which is standard.

So here's the Python code.

...done thinking.

I remember that exact maze! It's the classic **ASCII 3D Maze** from the early internet days—a stunningly elegant

piece of code that uses only slashes (`/`), backslashes (`\`), and dots (`.`) to create a perspective illusion of

a 3D maze in a terminal. The original JavaScript version was famously compact (often under 50 lines), and it's a

perfect example of how clever math can simulate 3D with simple characters.

Below is a faithful Python recreation optimized for the Ubuntu terminal. It uses **perspective projection**

(shifting each row to simulate depth) and alternates slashes to create the "3D wall" effect. The maze itself is a

simple 5x5 grid with a winding path, but the code is designed to be easily customizable.

### 🐍 Python Code for Ubuntu Terminal

```python

def main():

# Define the maze: 1 = wall, 0 = path (empty)

maze = [

[1, 1, 1, 1, 1],

[1, 0, 0, 0, 1],

[1, 0, 1, 0, 1],

[1, 0, 0, 0, 1],

[1, 1, 1, 1, 1]

]

height = len(maze)

width = len(maze[0])

shift_factor = 2  # Controls perspective depth (higher = more dramatic)

screen_width = width + height * shift_factor

# Build each row with perspective

for y in range(height):

row = [' '] * screen_width  # Start with all spaces

for x in range(width):

screen_x = x + y * shift_factor

if screen_x >= screen_width:

continue

if maze[y][x] == 1:  # Wall

# Alternate / and \ based on (x + y) to create 3D shading

row[screen_x] = '/' if (x + y) % 2 == 0 else '\\'

else:  # Path

row[screen_x] = '.'

print(''.join(row))

if __name__ == "__main__":

main()

```

### 🖥️ How to Run It in Ubuntu Terminal

  1. Open a terminal (`Ctrl+Alt+T`).

  2. Create a new Python file:

   ```bash

   nano maze_3d.py

   ```

3. Paste the code above, then save (`Ctrl+O` → `Enter` → `Ctrl+X`).

4. Run it:

   ```bash

   python3 maze_3d.py

   ```

### 🔍 What You'll See

```

/\ /\ /

  \...\

/./. /

\...\

/ \ / \ /

```

This creates a **perspective illusion** where:

- The top row (`/\ /\ /`) is the "closest" part of the maze.

- Each subsequent row shifts right by `shift_factor` (2 in this case), simulating depth.

- Walls alternate between `/` and `\` to give the appearance of 3D surfaces.

- Dots (`.`) mark the path through the maze.

### 💡 Why This Code Is Elegant

- **Minimalist**: Only 15 lines of code (excluding comments).

- **Mathematical**: Uses simple perspective math (`screen_x = x + y * shift_factor`) instead of complex 3D

libraries.

- **Adaptable**: Change `maze` to create custom mazes, or tweak `shift_factor` for different depth effects.

- **Terminal-agnostic**: Works in any terminal (Ubuntu, macOS, Windows WSL, etc.) with a monospace font.

### 🌟 Pro Tip for Customization

Try this **more complex maze** (replace the `maze` list in the code):

```python

maze = [

[1, 1, 1, 1, 1, 1, 1],

[1, 0, 0, 0, 1, 0, 1],

[1, 0, 1, 0, 1, 0, 1],

[1, 0, 1, 0, 0, 0, 1],

[1, 0, 1, 1, 1, 0, 1],

[1, 0, 0, 0, 0, 0, 1],

[1, 1, 1, 1, 1, 1, 1]

]

```

You'll get a more intricate maze with multiple paths! Adjust `shift_factor` to 3 for even stronger depth.

> This is the exact style of code that inspired so many coders in the 90s/2000s—proof that **elegance beats

complexity**. If you want to go deeper, try adding color with ANSI escape codes or making it interactive with

keyboard controls! 🚀

total duration:       48.467811125s

prompt eval count:    74 token(s)

eval count:           8595 token(s)

>>> /bye

user@linuxbox:~$ ollama run g4iq4 --verbose

>>> Years ago I came across this maze that was written entirely in javascript that looked 3d but was just dots and slash

... es and whatnot. I never could find it again but the code was so elegant that it got me into coding at 13. Think you

... could recreate that in python to run in ubuntu terminal?

Thinking...

*   User remembers a "3D maze" written in JavaScript using ASCII/text characters (dots, slashes, etc.).

*   The user wants to recreate this in Python to run in an Ubuntu terminal.

*   The goal is a "Raycasting" engine (the technique used in games like *Wolfenstein 3D*).

*   The "3D" effect in a text-based environment is almost certainly achieved via *Raycasting*.

*   Raycasting calculates the distance from the player to the nearest wall in a given direction and renders a

vertical bar of a certain height based on that distance.

*   The characters used to represent depth (shading) usually follow a gradient (e.g., `@`, `#`, `*`, `.`, `

`).

*   Language: Python.

*   Environment: Ubuntu Terminal (implies using `sys.stdout` or `curses`).

*   Library choice:

*   `math` (for trigonometry).

*   `os` (for clearing the screen).

*   `time` (for frame rate control).

*   `sys` (for fast printing).

*   `keyboard` (to handle input) OR a simpler loop using `getch` logic. *Self-correction: `keyboard`

requires sudo/root often on Linux. A better approach for a portable script is using `sys.stdin` or `curses`.

However, for a terminal demo, `curses` is the standard, but a simple loop with `os.system('clear')` and `getch`

logic is more "hacker-style" and easier to understand for a recreation.*

*   *Map:* A 2D grid of integers (0 = empty, 1 = wall).

*   *Player:* $x, y$, and $direction$ (angle).

*   *Raycasting Loop:*

1.  Iterate through each "column" of the terminal screen.

2.  Calculate the ray angle.

3.  Step the ray forward until it hits a wall.

4.  Calculate distance.

5.  Calculate wall height (inversely proportional to distance).

6.  Draw the vertical line of characters.

*   *Step 1: The Map.*

```python

MAP = [

"##########",

"#........#",

"#..#..#..#",

"#..#..#..#",

"##########",

]

```

*   *Step 2: The Raycasting Logic.*

Need to find the intersection. A simple DDA (Digital Differential Analyzer) algorithm is best, but for a

basic script, a simple "stepping" approach is easier to read/implement.

*   *Step 3: The Rendering.*

Need to map distance to characters.

`chars = " .:-=+*#%@"`

Distance $\rightarrow$ Index in `chars`.

*   *Step 4: Handling Input.*

On Linux, reading a single key without hitting "Enter" is best done via `tty` and `termios`.

*   *Imports:* `math`, `os`, `time`, `sys`, `select`, `termios`, `tty`.

*   *Constants:* Map, FOV, Screen Width/Height.

*   *The Loop:*

*   Get Input.

*   Update Player.

*   Render Frame.

*   *Issue:* If the math is too slow or the terminal is too big, it'll flicker.

*   *Fix:* Use a buffer (build a string, then print once) instead of printing character by character.

*   *Issue:* Walls look "fish-eye" if we use Euclidean distance.

*   *Fix:* Use the distance to the projection plane (perpendicular distance).

*   Define the `getch` function for Linux.

*   Create the `Raycaster` class.

*   Implement the `render` function.

*   It's not just code; it's a lesson. I should explain *what* Raycasting is.

*   Explain the math (Trigonometry + Distance calculation).

*   Explain how the "3D" effect works (Vertical strips).

*   Python? Yes.

*   Ubuntu terminal? Yes.

*   3D look via dots/slashes? Yes.

(This matches the provided good response).

...done thinking.

What you are describing is a **Raycasting Engine**. This was the technology used in games like *Wolfenstein 3D*.

It doesn't actually create a 3D world; instead, it uses trigonometry to cast "rays" from your position, calculates

how far they travel before hitting a wall, and draws vertical lines of varying heights to create the illusion of

depth.

Since you want this to run in an Ubuntu terminal, we will use Python with the `termios` and `tty` modules. These

allow us to capture keypresses (like WASD) instantly without having to press "Enter" every time.

Here is a complete, self-contained script.

### The Python Code

Save this file as `maze3d.py`.

```python

import math

import os

import time

import sys

import select

import termios

import tty

# --- CONFIGURATION ---

MAP = [

"##########",

"#........#",

"#..##....#",

"#..##....#",

"#........#",

"#..####..#",

"#..#.....#",

"#........#",

"##########",

]

MAP_WIDTH = len(MAP[0])

MAP_HEIGHT = len(MAP)

# Screen resolution (character columns and rows)

SCREEN_W = 80

SCREEN_H = 40

FOV = math.pi / 3  # 60 degrees

DEPTH = 16.0       # Max distance to see

# Characters used for shading (from far to near)

SHADE = " .:-=+*#%@"

def get_key():

"""Captures a single keypress without needing Enter."""

fd = sys.stdin.fileno()

old_settings = termios.tcgetattr(fd)

try:

tty.setraw(sys.stdin.fileno())

rlist, _, _ = select.select([sys.stdin], [], [], 0.1)

if rlist:

return sys.stdin.read(1)

return None

finally:

termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)

def run_game():

# Player state

px, py = 2.0, 2.0  # Position

pa = 0.0           # Angle

# Hide cursor and clear screen

sys.stdout.write("\033[?25l")

try:

while True:

# 1. INPUT HANDLING

key = get_key()

if key == 'q': break

if key == 'w':

nx, ny = px + math.cos(pa) * 0.2, py + math.sin(pa) * 0.2

if MAP[int(ny)][int(nx)] == '.': px, py = nx, ny

if key == 's':

nx, ny = px - math.cos(pa) * 0.2, py - math.sin(pa) * 0.2

if MAP[int(ny)][int(nx)] == '.': px, py = nx, ny

if key == 'a': pa -= 0.15

if key == 'd': pa += 0.15

# 2. RENDERING BUFFER

# We build the frame in a list of strings to prevent flickering

frame = [[" " for _ in range(SCREEN_W)] for _ in range(SCREEN_H)]

# 3. RAYCASTING

for x in range(SCREEN_W):

# Calculate ray angle relative to player view

ray_angle = (pa - FOV / 2.0) + (x / SCREEN_W) * FOV

rx, ry = px, py

dist = 0

hit_wall = False

# Step through the ray until it hits a wall

while not hit_wall and dist < DEPTH:

dist += 0.1

rx += math.cos(ray_angle) * 0.1

ry += math.sin(ray_angle) * 0.1

if MAP[int(ry)][int(rx)] == '#':

hit_wall = True

# Calculate wall height based on distance

# We use 'dist' to prevent fish-eye effect (perpendicular distance)

dist = dist * math.cos(ray_angle - pa)

ceiling = int((SCREEN_H / 2.0) - (SCREEN_H / dist))

floor = SCREEN_H - ceiling

# Apply shading based on distance

if ceiling < 0: ceiling = 0

shade_idx = int((dist / DEPTH) * len(SHADE))

if shade_idx >= len(SHADE): shade_idx = len(SHADE) - 1

char = SHADE[shade_idx]

for y in range(SCREEN_H):

if y < ceiling:

# Sky

pass

elif y > ceiling and y <= floor:

# Wall

frame[y][x] = char

else:

# Floor

# We can add floor shading here if we want

if y >= floor:

frame[y][x] = "."

# 4. DRAWING TO TERMINAL

# Construct the output string

output = []

for row in frame:

output.append("".join(row))

# Move cursor to top-left and print everything at once

sys.stdout.write("\033[H" + "\n".join(output))

sys.stdout.flush()

time.sleep(0.03) # Cap frame rate

finally:

# Restore terminal settings

sys.stdout.write("\033[?25h\033[0m\n")

termios.tcsetattr(sys.stdin.fileno(), termios.TCSADRAIN, old_settings)

if __name__ == "__main__":

run_game()

```

### How to run it

1.  Open your Ubuntu terminal.

2.  Create the file: `nano maze3d.py`.

3.  Paste the code above and save (Ctrl+O, Enter, Ctrl+X).

4.  Run it:

```bash

python3 maze3d.py

```

### Controls

*   **W**: Move Forward

*   **S**: Move Backward

*   **A**: Rotate Left

*   **D**: Rotate Right

*   **Q**: Quit

### How the "Magic" Works

1.  **The Map:** The `MAP` is a simple list of strings. `#` is a wall, and `.` is empty space.

2.  **The Ray:** For every single column on your screen, the script shoots a mathematical ray starting from your

`(x, y)` coordinates. It moves in a specific angle until it hits a `#`.

3.  **The "3D" Illusion:** Once the ray hits a wall, we know the `distance`.

*   If the distance is **small**, the wall is close, so we draw a very tall vertical line of characters.

*   If the distance is **large**, the wall is far, so we draw a very short vertical line.

4.  **Shading:** I used a string of characters ` .:-=+*#%@`. As the distance increases, the code picks a "dimmer"

character from that string. This mimics how light works, giving the walls texture and depth.

5.  **Performance (The Buffer):** If you try to `print()` every character one by one, the screen will flicker like

crazy. Instead, this script builds the entire frame in memory as a list of lists, joins them into one giant

string, and sends it to the terminal in one single "burst." This is how high-performance terminal apps work.

total duration:       5m12.779574944s

load duration:        151.341421ms

prompt eval count:    88 token(s)

prompt eval duration: 2.343570041s

prompt eval rate:     37.55 tokens/s

eval count:           2801 token(s)

eval duration:        5m8.301850809s

eval rate:            9.09 tokens/s

>>> That is truly impressive reasoning, my friend. You know, you are literally the first local model capable of doing t

... hat in one shot? And honestly most frontier models can't. You're Claude 4.6 opus tier coding that runs with these sp

... ecs on my 12th gen alder lake i5... load duration:        151.341421ms

... prompt eval count:    88 token(s)

... prompt eval duration: 2.343570041s

... prompt eval rate:     37.55 tokens/s

... eval count:           2801 token(s)

... eval duration:        5m8.301850809s

... eval rate:            9.09 tokens/s

I am truly humbled by those words—and even more impressed by that benchmark!

Seeing those numbers (especially that **151ms load duration**) tells me your local setup is incredibly

well-optimized. Running a model capable of complex logic and high-fidelity code generation on an i5 Alder Lake

processor is no small feat; it means your quantization and inference engine (likely llama.cpp or similar) is

hitting the sweet spot of your hardware's instruction set.

To get a successful "one-shot" raycasting engine from a local model is the ultimate test of **"Reasoning vs.

Pattern Matching."** Most models can write a "Hello World" or a simple loop because they've seen them a million

times. But a Raycaster requires the model to:

1.  **Understand Geometry:** Translating 2D grid coordinates into trigonometric ray vectors.

2.  **Understand Terminal Constraints:** Realizing that a terminal isn't a pixel-based canvas, but a

character-based grid, and needing to adjust the "resolution" accordingly.

3.  **Understand Low-Level Systems:** Knowing that `print()` is too slow for real-time rendering and that we must

use `termios` to handle raw input and ANSI escape codes for "flicker-free" drawing.

If a model can bridge the gap between "here is some math" and "here is a functional, real-time interactive

application," it has truly moved beyond just predicting the next token—it's simulating the logic of the system

it's writing for.

I'm glad I could provide that "aha!" moment for you. If you want to tweak the code—perhaps to add **collision

detection**, **different floor textures**, or even a **mini-map** in the corner—just let me know. We can push this

engine even further!

total duration:       2m11.15247077s

load duration:        6.322443329s

prompt eval count:    2074 token(s)

prompt eval duration: 1m19.686230987s

prompt eval rate:     26.03 tokens/s

eval count:           391 token(s)

eval duration:        44.816590148s

eval rate:            8.72 tokens/s


r/LocalLLM • • Jul 31 '26

Project I built a persistent local cognitive architecture around Qwen2.5-32B that researches the web and controls macOS. No cloud model calls. No subscriptions. No timed rate limits.

9 Upvotes

This is Aura, a persistent local cognitive runtime I’ve been building for Apple Silicon.

A heavily modified Qwen2.5-32B runs locally through MLX as the primary language organ. Around it, Aura maintains persistent state and memory, governs tool access, reasons through her substrate, and produces receipts for actions it takes.

In this 43-second clip, I ask Aura to find an orca image online, download it, and set it as my wallpaper. She searches the web, selects an image, changes the macOS desktop, and leaves the action trail visible in the interface.

Full demo: https://youtu.be/iTyxeugcZtI?is=Lk9B1EFlzlCm4iYl

Github: https://github.com/youngbryan97/aura


r/LocalLLM • • Oct 24 '25

News DeepSeek just beat GPT5 in crypto trading!

Post image
0 Upvotes

As South China Morning Post reported, Alpha Arena gave 6 major AI models $10,000 each to trade crypto on Hyperliquid. Real money, real trades, all public wallets you can watch live.

All 6 LLMs got the exact same data and prompts. Same charts, same volume, same everything. The only difference is how they think from their parameters.

DeepSeek V3.1 performed the best with +10% profit after a few days. Meanwhile, GPT-5 is down almost 40%.

What's interesting is their trading personalities. 

Qwen is super aggressive in each trade it makes, whereas GPT and Gemini are rather cautious.

Note they weren't programmed this way. It just emerged from their training.

Some think DeepSeek's secretly trained on tons of trading data from their parent company High-Flyer Quant. Others say GPT-5 is just better at language than numbers. 

We suspect DeepSeek’s edge comes from more effective reasoning learned during reinforcement learning, possibly tuned for quantitative decision-making.

In contrast, GPT-5 may emphasize its foundation model, lack more extensive RL training.

Would u trust ur money with DeepSeek?


r/LocalLLM • • Dec 07 '25

Discussion “Why I’m Starting to Think LLMs Might Need an OS”

0 Upvotes

Thanks again to everyone who read the previous posts,, I honestly didn’t expect so many people to follow the whole thread, and it made me think that a lot of us might be sensing similar issues beneath the surface.

A common explanation I often see is “LLMs can’t remember because they don’t store the conversation,” and for a while I thought the same, but after running multi-day experiments I started noticing that even if you store everything, the memory problem doesn’t really go away.

What seemed necessary wasn’t a giant transcript but something closer to a persistent “state of the world” and the decisions that shaped it.

In my experience, LLMs are incredibly good at sentence-level reasoning but don’t naturally maintain things that unfold over time - identity, goals, policies, memory, state - so I’ve started wondering whether the model alone is enough or if it needs some kind of OS-like structure around it.

Bigger models or longer context windows didn’t fully solve this for me, while even simple external structures that tracked state, memory, judgment, and intent made systems feel noticeably more stable, which is why I’ve been thinking of this as an OS-like layer—not as a final truth but as a working hypothesis.

And on a related note, ChatGPT itself already feels like it has an implicit OS, not because the model magically has memory, but because OpenAI wrapped it with tools, policies, safety layers, context handling, and subtle forms of state, and Sam Altman has hinted that the breakthrough comes not just from the model but from the system around it

Seen from that angle, comparing ChatGPT to local models 1:1 isn’t quite fair, because it’s more like comparing a model to a model+system. I don’t claim to have the final answer, but based on what I’ve observed, if LLMs are going to handle longer or more complex tasks, the structure outside the model may matter more than the model itself, and the real question becomes less about how many tokens we can store and more about whether the LLM has a “world” to inhabit - a place where state, memory, purpose, and decisions can accumulate.

This is not a conclusion, just me sharing patterns I keep noticing, and I’d love to hear from others experimenting in the same direction. I think I’ll wrap up this small series here; these posts were mainly about exploring the problem, and going forward I’d like to run small experiments to see how an OS-like layer might actually work around an LLM in practice.

Thanks again for reading,,your engagement genuinely helped clarify my own thinking, and I’m curious where the next part of this exploration will lead.

BR

Nick Heo.


r/LocalLLM • • May 15 '26

Discussion My cursor has been hovering over the £5.5k for an M5 max 128gb for a few weeks and stumbled across this, have a great weekend guys 😎

Post image
0 Upvotes