<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Szilard Galambos</title>
    <description>The latest articles on DEV Community by Szilard Galambos (@xunil74).</description>
    <link>https://dev.to/xunil74</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3955898%2F9b143abc-ed44-4c31-ae67-40d32749cfab.png</url>
      <title>DEV Community: Szilard Galambos</title>
      <link>https://dev.to/xunil74</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/xunil74"/>
    <language>en</language>
    <item>
      <title>I Built a RAG Assistant for My Own Field, So I Could Tell When It Was Wrong</title>
      <dc:creator>Szilard Galambos</dc:creator>
      <pubDate>Fri, 28 Aug 2026 16:49:17 +0000</pubDate>
      <link>https://dev.to/xunil74/i-built-a-rag-assistant-for-my-own-field-so-i-could-tell-when-it-was-wrong-525m</link>
      <guid>https://dev.to/xunil74/i-built-a-rag-assistant-for-my-own-field-so-i-could-tell-when-it-was-wrong-525m</guid>
      <description>&lt;p&gt;I wanted to understand RAG properly, and reading about a technology is not the same as building one. Building one means choosing a document to build it on, and that choice turned out to matter more than I expected.&lt;/p&gt;

&lt;p&gt;I took a document from my own field: a roughly 170-page design guide for engineering plastics and injection moulding, the kind of reference I spent twenty years working alongside. That did two jobs at once. The result is useful to the people I come from, rather than a demonstration over a corpus nobody needed searched. More importantly, I could judge whether an answer was actually correct, which is exactly what you cannot do on material you do not know.&lt;/p&gt;

&lt;p&gt;That second point turned the project into an exercise in measurement rather than a demo, and it is why the things the measurements turned up are the most useful part of the story.&lt;/p&gt;

&lt;h2&gt;
  
  
  First, what RAG is
&lt;/h2&gt;

&lt;p&gt;One definition, because everything below depends on it. RAG, retrieval-augmented generation, means the language model does not answer from memory. Each question first triggers a search across your own documents, and the passages that come back are handed to the language model together with the question, with an instruction to answer from those and nothing else.&lt;/p&gt;

&lt;p&gt;Two things follow. Every answer can point at the part of the guide it came from, and anything the guide does not cover produces a refusal instead of an invention. The second consequence matters more: once the language model may only use what the search hands it, the search decides the quality of the answer. A capable language model given the wrong three paragraphs will not notice; it will simply write a more fluent wrong answer than a weaker one would. That is why most of what follows concerns the search rather than the language model.&lt;/p&gt;

&lt;h2&gt;
  
  
  How the search works, and what the system is made of
&lt;/h2&gt;

&lt;p&gt;Searching by meaning rather than by wording requires both sides of the comparison to exist in the same form. An embedding model provides that form: it converts a piece of text into a list of numbers arranged so that passages about the same topic land close to each other. The question goes through the same conversion, and the search then reduces to finding the stored pieces nearest to it.&lt;/p&gt;

&lt;p&gt;Because the guide has to be converted before anyone can ask anything, the system falls into two phases: once per document the guide is cut into pieces, each is embedded and stored, and then on every question the question is embedded and matched against that store. The same embedding model must serve both phases, since vectors from different embedding models cannot be compared.&lt;/p&gt;

&lt;p&gt;Those pieces are called chunks: 223 from the body text, plus 185 figure entries and 17 table entries, held in three collections in Qdrant, a database built for nearest-neighbour lookup. Keeping figures and tables apart mattered later, when the chat model had to be told which kind of content it was looking at. That chat model, Qwen3.5-9B, is the language model that writes the answers, and it runs alongside the embedding model on llama.cpp on a single GPU. Everything stays on that machine, which is not a technical footnote: a licensed design guide is not something you upload to a third party to make it searchable.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fp9xfu4x097vzp5e9hpgv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fp9xfu4x097vzp5e9hpgv.png" alt="Architecture diagram: the guide is chunked and embedded once, then every question is embedded and matched against the stored vectors before the chat model writes an answer" width="800" height="512"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One component sits in front of all this, because not every message is a design question and not every design question is covered by the guide. A classifier separates greetings and help requests from content questions, then a similarity threshold decides whether the nearest chunks are close enough to answer from.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F94jmulfdae9ihxolxo4p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F94jmulfdae9ihxolxo4p.png" alt="Query-processing flow: a question is classified, then either answered directly, or embedded, matched and passed to the chat model, or declined" width="800" height="604"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What an engineer gets out of it
&lt;/h2&gt;

&lt;p&gt;None of that machinery is visible to the person using it. A designer types a concrete question, such as how thick a wall can be before the surface sinks, and the assistant answers from the guide while naming the section, figure or table it used. That citation is the point rather than a nicety, because an engineer about to commit a wall thickness to a steel mould has to check where the number came from. The refusal works the same way from the other direction: a confident answer to something the guide never addresses would be worse than none.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F64pyauq2h22kvjlvmu5k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F64pyauq2h22kvjlvmu5k.png" alt="The assistant's chat window: a plain-language design question, the answer generated from the guide, and the source sections it was drawn from" width="800" height="540"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So the value is not that the assistant saves you from reading 170 pages. It is that it finds the right two of those pages in seconds and shows you which two.&lt;/p&gt;

&lt;h2&gt;
  
  
  Round 1: where the guide gets cut
&lt;/h2&gt;

&lt;p&gt;The first link in that chain is the cutting, and it is easy to underestimate. A chunk spanning two unrelated subsections produces a vector that represents neither properly, and no amount of search quality afterwards recovers what the cut destroyed.&lt;/p&gt;

&lt;p&gt;Hierarchy-aware chunking follows the guide's own chapters and subheadings, so a boundary lands where the guide itself changes subject. The naive alternative cuts every N characters regardless. Which of the two wins was never really in doubt, so I did not build the naive pipeline to find that out. I built it to see the size of the difference, because "structure helps" is an intuition, and a number is something you can act on.&lt;/p&gt;

&lt;p&gt;The naive run produced 137 chunks against 223, and inspection showed why that mattered: 86.1% bridged two or more unrelated subsections, 77.4% began mid-sentence, and 31.4% exceeded the embedding model's token limit. These are not cosmetic flaws but chunks that do not correspond to a single coherent idea, which is exactly what the vector is meant to capture.&lt;/p&gt;

&lt;p&gt;The retrieval scores followed. One definition first, since these numbers recur: retrieval works like asking a librarian for the right page, so Recall@1 measures how often the first suggestion is correct, and Recall@5 counts a hit anywhere in the top five.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Recall@1: 0.843 for hierarchy-aware chunking against 0.708 for naive chunking, a gap of 13.5 percentage points.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fob5105zmwztz9nhwuv4i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fob5105zmwztz9nhwuv4i.png" alt="Bar chart comparing Recall@1 for hierarchy-aware chunking at 0.843 against naive fixed-size chunking at 0.708" width="800" height="587"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Round 2: which chat model follows the rules
&lt;/h2&gt;

&lt;p&gt;Putting the right chunks in front of the chat model does not guarantee that it stays inside them. Twice it did not: once inventing a formula for a table that exists in the guide only as a drawn image, and once claiming a figure was absent when it was plainly there. Both were settled with prompt rules that tell the model what to do when the context is incomplete instead of letting it improvise.&lt;/p&gt;

&lt;p&gt;Those rules are only worth writing if the chat model follows them consistently, which turned the next question into one about the model itself. My assumption was that the larger Qwen3-14B would be the safer default and the newer, smaller Qwen3.5-9B the speed option.&lt;/p&gt;

&lt;p&gt;Repeated runs said otherwise. At one prompt configuration the 14B model fell back into the already-fixed hallucination on 5 out of 5 attempts, while the 9B held steady across both of its checked runs. The deciding axis was therefore not raw capability but reliability under repetition, and the smaller model shipped.&lt;/p&gt;

&lt;h2&gt;
  
  
  Round 3: the questions I had not been asking
&lt;/h2&gt;

&lt;p&gt;Every improvement so far was measured with questions written in the guide's own vocabulary, which is a flattering test, because that is the one condition the system was tuned for. Real users do not write that way.&lt;/p&gt;

&lt;p&gt;Rephrased as a non-expert would type them, using "why do parts get weird dents" instead of the formal defect name, Recall@5 fell from 1.000 to 0.400. The content was unambiguously in the guide, so the failure lay entirely in the matching, and widening the search did not recover it. The problem is therefore not how many candidates are considered but how the question is represented in the first place.&lt;/p&gt;

&lt;p&gt;That leaves a documented limitation rather than a solved one. The obvious next steps stop relying on meaning-matching alone: rewriting the question into formal terms before searching, adding keyword matching to catch a specialist's exact wording, or re-ranking the closest candidates in a second pass.&lt;/p&gt;

&lt;h2&gt;
  
  
  How all of this was measured
&lt;/h2&gt;

&lt;p&gt;None of those findings would have surfaced without something to measure against, so the evaluation ran on three levels.&lt;/p&gt;

&lt;p&gt;Retrieval was scored across 425 synthetic questions, giving Recall@1 of 0.899, Recall@5 of 0.995 and an MRR of 0.943, where MRR rewards the correct answer for landing near the top rather than merely appearing somewhere.&lt;/p&gt;

&lt;p&gt;Answer quality was scored by an external LLM-as-Judge, deliberately not the chat model that writes the answers, since a language model grading its own output is not evidence.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxde6lf3xh9kbvq3zap9m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxde6lf3xh9kbvq3zap9m.png" alt="Bar chart of LLM-as-Judge scores by dimension: faithfulness 4.44, relevance 4.96, completeness 4.64 and conciseness 4.08, out of a maximum of 5" width="800" height="517"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Faithfulness at 4.44 and conciseness at 4.08 sit lowest, consistent with the hallucination work above, while relevance at 4.96 sits near the ceiling, which is what good retrieval should produce.&lt;/p&gt;

&lt;p&gt;End to end, 10 of 10 scripted user journeys passed at roughly 18 seconds per answer, a figure that tracks answer length rather than slowness. Three simulated personas of rising expertise were then scored for satisfaction.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcwmvjlpzev720lfrvqkn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcwmvjlpzev720lfrvqkn.png" alt="Bar chart of simulated persona satisfaction: novice 3.50, intermediate 3.83 and expert 4.67, out of 5" width="800" height="593"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The most expert persona was the most satisfied, reassuring precisely because that was the expected direction. Several of these figures rest on small samples, which is worth naming: 5 runs against 2 in the chat-model comparison, three personas here. They are directional evidence, enough to act on but not proof at any rigorous confidence level.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Recall@1, hierarchy-aware against naive chunking (body-text subset)&lt;/td&gt;
&lt;td&gt;0.843 against 0.708&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Recall@1 / Recall@5 / MRR (all 425 questions)&lt;/td&gt;
&lt;td&gt;0.899 / 0.995 / 0.943&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Recall@5, formal against colloquial phrasing&lt;/td&gt;
&lt;td&gt;1.000 against 0.400&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LLM-as-Judge, 1 to 5: faithfulness / relevance / completeness / conciseness&lt;/td&gt;
&lt;td&gt;4.44 / 4.96 / 4.64 / 4.08&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;User journeys passed, average response time&lt;/td&gt;
&lt;td&gt;10 of 10, roughly 18 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Persona satisfaction, 1 to 5 (novice / intermediate / expert)&lt;/td&gt;
&lt;td&gt;3.50 / 3.83 / 4.67&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Runs that fell back into the fixed hallucination, one prompt setup&lt;/td&gt;
&lt;td&gt;Qwen3-14B 5 of 5, Qwen3.5-9B 0 of 2&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Where a document gets cut decides how well it can ever be searched.&lt;/strong&gt; The 13.5-point gap came from nothing more than respecting the guide's own outline.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A bigger language model is not automatically a safer one.&lt;/strong&gt; Reliability under repetition proved worth more than raw capability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A system tested only in its own vocabulary looks better than it is.&lt;/strong&gt; The 60-point collapse on plain-language phrasing is invisible to any demo, because demos are written by whoever built the thing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Building on ground I already knew is what made the measurement possible. On an unfamiliar document I could have collected exactly the same numbers and still not known which answers were right, and every finding above came from being able to tell the difference.&lt;/p&gt;

&lt;p&gt;The colloquial-phrasing gap is still open, and it is the first thread I would pull next.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Side note: a multilingual variant exists, but it is not the subject here. It depends on a cloud translation service, which breaks the fully local property everything above rests on, and it has not been through this evaluation. Every number here refers to the local, English-language system.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  About the Author
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Szilárd Galambos&lt;/strong&gt; spent 20 years as a mechanical engineering group lead at Robert Bosch, and is currently on a deliberate career break to build expertise in data science and AI. With a background in engineering mathematics and hands-on experience in n8n workflow automation, Linux server administration, and AI integration, he bridges the gap between traditional engineering thinking and modern data-driven approaches.&lt;/p&gt;

&lt;p&gt;Connect on &lt;a href="https://www.linkedin.com/in/szil%C3%A1rd-galambos-77a8333b8/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>rag</category>
      <category>injectionmoulding</category>
      <category>engineering</category>
      <category>ai</category>
    </item>
    <item>
      <title>I Made Local AI Faster Than the Cloud - A Complete Home Automation Voice Control Journey</title>
      <dc:creator>Szilard Galambos</dc:creator>
      <pubDate>Thu, 28 May 2026 08:59:21 +0000</pubDate>
      <link>https://dev.to/xunil74/i-made-local-ai-faster-than-the-cloud-a-complete-home-automation-voice-control-journey-2cko</link>
      <guid>https://dev.to/xunil74/i-made-local-ai-faster-than-the-cloud-a-complete-home-automation-voice-control-journey-2cko</guid>
      <description>&lt;p&gt;What if your home could understand you, without sending a single word to the cloud?&lt;/p&gt;

&lt;p&gt;That question started this project. I wanted to control my smart home with voice commands in Hungarian, a language that sits far outside the English-centric comfort zone of most voice assistants. I wanted context awareness: the system should know which lights are already on, what time of day it is. And I wanted it to be private: no audio recordings uploaded to someone else's servers, no device state telemetry leaving my network.&lt;/p&gt;

&lt;p&gt;What I did not expect was that the journey from cloud to local AI would end with my local setup outperforming the cloud version. This is the full story, with the raw numbers to prove it.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Problem and Motivation
&lt;/h2&gt;

&lt;p&gt;The cloud version worked. Groq's Whisper API transcribed Hungarian speech reliably, OpenAI's GPT interpreted the commands, and my lights responded in about four seconds. But four seconds is actually the good news. The bad news is in the variance: the same system took anywhere from 2.7 to 9.2 seconds depending on cloud load and network conditions. On a bad day, it felt slow. On a very bad day - like the one data point at 9.2 seconds - it felt broken.&lt;/p&gt;

&lt;p&gt;More fundamentally, I was uncomfortable with what was being sent out. Every voice command I spoke, along with the full list of my smart home devices (names, locations, current states), went to Groq and OpenAI. That is not a privacy disaster, but it is a privacy trade-off I did not need to make.&lt;/p&gt;

&lt;p&gt;The other motivation was simply learning. I worked as a mechanical engineering group lead and I am using a career break to build hands-on AI and data science skills. Running local LLMs and STT models myself, understanding where the bottlenecks are, benchmarking performance, this was exactly the kind of project that teaches things you cannot learn from tutorials alone.&lt;/p&gt;




&lt;h2&gt;
  
  
  System Architecture
&lt;/h2&gt;

&lt;p&gt;The setup spans two machines on a wired home LAN.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Home Server&lt;/strong&gt; is a passive-cooled Intel Celeron N3150 box running Debian 12. It has no GPU, runs 24/7, and hosts the orchestration layer: n8n for workflow automation, Domoticz as the smart home controller, and a Mosquitto MQTT broker. Think of it as the brain that coordinates but never does heavy computation.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Desktop PC&lt;/strong&gt; is an Intel Core i7-4770 machine running Ubuntu 22.04. This is the AI inference machine. Its GPU changed over the course of the project, first a GTX 1050 Ti with 4 GB VRAM, later an RTX 4060 Ti with 16 GB, and that GPU upgrade is the turning point of the story.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1ym9rov3ffqs6xdryb58.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1ym9rov3ffqs6xdryb58.png" alt="System components — what runs where" width="800" height="388"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is what happens when I press record on my phone:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbkdmp6ss6b7ojmeqcsqj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbkdmp6ss6b7ojmeqcsqj.png" alt="Communication flow — voice command to smart device" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;I speak a Hungarian command into the &lt;strong&gt;Webhook Audio Recorder&lt;/strong&gt; app, which sends the audio file via HTTP POST to n8n&lt;/li&gt;
&lt;li&gt;n8n sends the audio to &lt;strong&gt;faster-whisper&lt;/strong&gt; for speech-to-text transcription&lt;/li&gt;
&lt;li&gt;In parallel, n8n queries &lt;strong&gt;Domoticz&lt;/strong&gt; for the current device list and their states&lt;/li&gt;
&lt;li&gt;The transcribed text, device list, and current time are passed to &lt;strong&gt;Ollama&lt;/strong&gt; (Qwen2.5:7b), which interprets the command and returns a JSON control payload&lt;/li&gt;
&lt;li&gt;n8n publishes that JSON to the &lt;strong&gt;MQTT broker&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Domoticz receives the MQTT message and executes the command, lights go on, blinds move&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The AI models I used throughout: &lt;strong&gt;Qwen2.5:7b&lt;/strong&gt; (Q4_K_M quantization, 4.7 GB) for language understanding and JSON generation, and &lt;strong&gt;Systran/faster-whisper-small&lt;/strong&gt; (~500 MB) for Hungarian speech recognition.&lt;/p&gt;




&lt;h2&gt;
  
  
  Version 1 - Cloud Baseline
&lt;/h2&gt;

&lt;p&gt;The cloud version was straightforward to set up. In n8n, an HTTP Request node calls the Groq Whisper API with the audio file, and an OpenAI Chat Model node handles the LLM side. Domoticz provides the device list, the workflow builds a system prompt, and the AI returns a JSON array of commands.&lt;/p&gt;

&lt;p&gt;It worked well. Both the STT and the LLM coped with Hungarian syntax and device names without special tuning, better than I expected. The median end-to-end latency across 21 test runs was &lt;strong&gt;4.0 seconds&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The catch: that 4.0 seconds is the median, not the ceiling. The cloud had a wide spread. OpenAI's response time ranged from 1.6 to 8.2 seconds in my measurements, dragging the total anywhere from 2.7 to 9.2 seconds. Cloud services have their own load and queuing behavior, and my home automation latency was subject to it.&lt;/p&gt;

&lt;p&gt;The other catches: cost (paid API subscriptions), internet dependency (no voice control during outages), and the privacy trade-off described above.&lt;/p&gt;




&lt;h2&gt;
  
  
  Version 2 - Going Local with GTX 1050 Ti
&lt;/h2&gt;

&lt;p&gt;The GTX 1050 Ti has 4 GB of VRAM. That sounds like enough, the Qwen2.5:7b model is 4.7 GB in Q4_K_M quantization. It is not enough.&lt;/p&gt;

&lt;p&gt;Ollama loaded approximately 24 of the model's 29 layers into VRAM (~3,500 MiB used). The remaining 5 layers ran on CPU and RAM. This hybrid mode works, but it means every inference cycle crosses the VRAM/RAM boundary repeatedly. The LLM ran at about &lt;strong&gt;3,100 ms&lt;/strong&gt; per request in warm state, measurable, but acceptable.&lt;/p&gt;

&lt;p&gt;The real problem was faster-whisper. After Ollama took 3,500 of the 4,096 MiB available, there was only ~535 MiB of free VRAM left, not enough for the faster-whisper model. I tried the CUDA image anyway and got an immediate "CUDA out of memory" error. There was no other option: faster-whisper ran on CPU.&lt;/p&gt;

&lt;p&gt;On this machine, CPU-mode STT took about &lt;strong&gt;2,800–3,500 ms&lt;/strong&gt; per request. That single constraint, no room in VRAM for the second model, doubled the latency of every request.&lt;/p&gt;

&lt;p&gt;The first measurement run with both models running showed a median end-to-end time of &lt;strong&gt;13.3 seconds&lt;/strong&gt;. Usable, but not satisfying.&lt;/p&gt;

&lt;h3&gt;
  
  
  The KEEP_ALIVE Discovery
&lt;/h3&gt;

&lt;p&gt;Then I found the single configuration change that cut the response time nearly in half.&lt;/p&gt;

&lt;p&gt;By default, Ollama loads the model into VRAM on the first request and unloads it after 5 minutes of inactivity. Every "cold" request, the first one after a quiet period, paid a ~12 second loading penalty. Setting &lt;code&gt;OLLAMA_KEEP_ALIVE=-1&lt;/code&gt; keeps the model permanently resident in VRAM.&lt;/p&gt;

&lt;p&gt;With static loading, the median end-to-end latency dropped to &lt;strong&gt;6.9 seconds&lt;/strong&gt;. Same hardware, same models, one environment variable. The lesson: configuration matters as much as hardware.&lt;/p&gt;

&lt;p&gt;The trade-off is that VRAM stays permanently occupied. On the GTX 1050 Ti, that meant zero headroom for any other GPU workload. On a 16 GB card, it would not be a concern.&lt;/p&gt;




&lt;h2&gt;
  
  
  Version 3 - GPU Upgrade, RTX 4060 Ti
&lt;/h2&gt;

&lt;p&gt;The GTX 1050 Ti taught me that the bottleneck was VRAM, not the CPU. The RTX 4060 Ti has 16 GB. That changes everything.&lt;/p&gt;

&lt;p&gt;With 16 GB available, both models fit comfortably on the GPU simultaneously:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foyin5jsba98gohg7xurd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foyin5jsba98gohg7xurd.png" alt="VRAM usage comparison — GTX 1050 Ti vs RTX 4060 Ti" width="800" height="494"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The LLM loaded all 29/29 layers into VRAM, confirmed in the Ollama logs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;load_tensors: offloading 28 repeating layers to GPU
load_tensors: offloading output layer to GPU
load_tensors: offloaded 29/29 layers to GPU
load_tensors:        CUDA0 model buffer size =  4168.09 MiB
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;faster-whisper moved from the CPU image to the CUDA image, and VRAM allocation after both models are loaded: Ollama at 4,892 MiB, faster-whisper at 754 MiB, total 5,654 MiB, leaving 10,426 MiB free. The card is barely breaking a sweat.&lt;/p&gt;

&lt;p&gt;The results were immediate. GPU-mode STT dropped from ~2,800 ms to &lt;strong&gt;279 ms&lt;/strong&gt; (static mode, from standalone benchmark), a 10x speedup. LLM inference dropped from ~3,100 ms to &lt;strong&gt;586 ms&lt;/strong&gt; (static mode), a 5x speedup. With static loading enabled, the median end-to-end latency from the n8n measurements was &lt;strong&gt;1.6 seconds&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The cloud baseline was 4.0 seconds. Local AI, on hardware I already owned plus a mid-range GPU upgrade, is now &lt;strong&gt;2.4× faster&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Benchmark Results
&lt;/h2&gt;

&lt;p&gt;All measurements come from real n8n workflow runs, not synthetic benchmarks. The workflow measured the actual time between sending the audio file and receiving the JSON command back, including all network hops between Home Server and Desktop PC.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6uojp9u9v5un97s43snw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6uojp9u9v5un97s43snw.png" alt="Endtoend latency by configuration" width="800" height="401"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Full statistics from the raw JSONL data:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Configuration&lt;/th&gt;
&lt;th&gt;n&lt;/th&gt;
&lt;th&gt;STT median&lt;/th&gt;
&lt;th&gt;LLM median&lt;/th&gt;
&lt;th&gt;Total median&lt;/th&gt;
&lt;th&gt;Total range&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Cloud (Groq + OpenAI)&lt;/td&gt;
&lt;td&gt;21&lt;/td&gt;
&lt;td&gt;0.44 s&lt;/td&gt;
&lt;td&gt;2.98 s&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;4.0 s&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;2.7 – 9.2 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GTX 1050 Ti · dynamic LLM&lt;/td&gt;
&lt;td&gt;17&lt;/td&gt;
&lt;td&gt;3.54 s&lt;/td&gt;
&lt;td&gt;9.26 s&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;13.3 s&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;13.2 – 14.3 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GTX 1050 Ti · static LLM&lt;/td&gt;
&lt;td&gt;16&lt;/td&gt;
&lt;td&gt;2.76 s&lt;/td&gt;
&lt;td&gt;3.48 s&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;6.9 s&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;6.7 – 7.5 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RTX 4060 Ti · dynamic LLM&lt;/td&gt;
&lt;td&gt;16&lt;/td&gt;
&lt;td&gt;0.86 s&lt;/td&gt;
&lt;td&gt;2.97 s&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;4.4 s&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;4.2 – 4.9 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RTX 4060 Ti · static LLM&lt;/td&gt;
&lt;td&gt;58&lt;/td&gt;
&lt;td&gt;0.34 s&lt;/td&gt;
&lt;td&gt;0.82 s&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1.6 s&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;1.5 – 2.1 s&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A few things stand out:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cloud variance is real.&lt;/strong&gt; The local GTX configurations had extremely tight variance, the GTX dynamic spread was only 1.1 seconds across 17 measurements. The cloud had a 6.5-second spread. A home automation command that might take 3 seconds or 9 seconds is a different user experience than one that reliably takes 6–7 seconds.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The RTX dynamic mode is interesting.&lt;/strong&gt; With the RTX 4060 Ti but without static loading, the LLM median was 2.97 seconds, nearly identical to the cloud's 2.98 seconds. The GPU is fast enough that even with model loading overhead amortized across a few requests, you are in the same ballpark as cloud. Enable static loading and you leave cloud performance far behind.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The ~0.5 second overhead is consistent.&lt;/strong&gt; Across all five configurations, the difference between (STT + LLM) and the total end-to-end time was 0.47–0.63 seconds. That is the n8n workflow overhead plus the local network round-trip. It does not scale with model speed, it is a fixed cost.&lt;/p&gt;

&lt;h3&gt;
  
  
  Component-Level Numbers
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;GTX 1050 Ti&lt;/th&gt;
&lt;th&gt;RTX 4060 Ti&lt;/th&gt;
&lt;th&gt;Speedup&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;STT (faster-whisper-small)&lt;/td&gt;
&lt;td&gt;2,957 ms (CPU)&lt;/td&gt;
&lt;td&gt;279 ms (GPU)&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;~10.6×&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LLM static (Qwen2.5:7b)&lt;/td&gt;
&lt;td&gt;3,079 ms (hybrid)&lt;/td&gt;
&lt;td&gt;586 ms (full GPU)&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;~5.3×&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;VRAM used (both models)&lt;/td&gt;
&lt;td&gt;~3,500 MiB / 4,096 total&lt;/td&gt;
&lt;td&gt;5,654 MiB / 16,380 total&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Component times from direct benchmark scripts; end-to-end totals from n8n measurement JSONL files.&lt;/p&gt;




&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;VRAM is the main bottleneck, not the model.&lt;/strong&gt; The same Qwen2.5:7b model ran in 3,100 ms on GTX (hybrid mode) and 586 ms on RTX (full GPU). The model did not change. The hardware headroom did.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Configuration matters as much as hardware.&lt;/strong&gt; The single &lt;code&gt;OLLAMA_KEEP_ALIVE=-1&lt;/code&gt; setting cut response time from 13.3 to 6.9 seconds on the GTX, without any hardware change. If you are running Ollama and wondering why it feels slow, check this setting first.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Local AI can beat cloud with the right setup.&lt;/strong&gt; The RTX 4060 Ti with static loading achieves 1.6 seconds median end-to-end. Cloud median was 4.0 seconds. Local is 2.4× faster, and far more consistent.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Privacy is not a trade-off here.&lt;/strong&gt; Every voice command, every device state query, every AI inference step stays on the local network. Nothing leaves the house. This is not "good enough for a home project" privacy, it is architecturally private by design.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Open-source models handle minority languages better than expected.&lt;/strong&gt; Qwen2.5:7b correctly interpreted Hungarian voice commands and in most cases generated valid JSON control payloads across all test configurations. faster-whisper-small transcribed Hungarian speech accurately enough for a smart home context. Neither model was fine-tuned for Hungarian, they work out of the box.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This started as a learning project with modest ambitions: replace cloud APIs with local models, see how the numbers compare, write it up. It ended with a home automation system that responds to Hungarian voice commands in 1.6 seconds, runs entirely offline, and costs nothing per query.&lt;/p&gt;

&lt;p&gt;The hardware path matters. A 4 GB GPU creates forced trade-offs; a 16 GB GPU removes them. But the path from 4 GB to 16 GB taught me more about bottlenecks, configuration, and the gap between "it runs" and "it runs well" than any tutorial could.&lt;/p&gt;

&lt;p&gt;If you are thinking about building something similar: start with whatever hardware you have. The constraints will teach you something. Then upgrade only what the data tells you to.&lt;/p&gt;

&lt;p&gt;If you have questions, suggestions, or a similar build of your own, I would love to hear about it in the comments.&lt;/p&gt;




&lt;h2&gt;
  
  
  About the Author
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Szilárd Galambos&lt;/strong&gt; spent 20 years as a mechanical engineering group lead at Robert Bosch, and is currently on a deliberate career break to build expertise in data science and AI. With a background in engineering mathematics and hands-on experience in n8n workflow automation, Linux server administration, and AI integration, he bridges the gap between traditional engineering thinking and modern data-driven approaches.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Interests: home automation, AI-powered workflows, and making technology work in the real world.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.linkedin.com/in/szil%C3%A1rd-galambos-77a8333b8" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/p&gt;

</description>
      <category>localai</category>
      <category>homeautomation</category>
      <category>n8n</category>
      <category>docker</category>
    </item>
  </channel>
</rss>
