{"id":9100,"date":"2025-12-11T04:03:44","date_gmt":"2025-12-11T04:03:44","guid":{"rendered":"https:\/\/serisec.com\/index.php\/2025\/12\/11\/32556\/"},"modified":"2025-12-11T04:03:44","modified_gmt":"2025-12-11T04:03:44","slug":"32556","status":"publish","type":"post","link":"https:\/\/serisec.com\/index.php\/2025\/12\/11\/32556\/","title":{"rendered":"Using AI Gemma 3 Locally with a Single CPU , (Wed, Dec 10th)"},"content":{"rendered":"<p>    Using AI Gemma 3 Locally with a Single CPU , (Wed, Dec 10th)<br \/>\n \t<BR><br \/>\n<BR><\/BR><br \/>\n    <!-- no image --><br \/>\n \t<BR><br \/>\n<BR><\/BR><\/p>\n<div>\n<p>Several months ago, I got a Nucbox K8 Plus minicomputer to use as a <a href=\"https:\/\/pve.proxmox.com\/wiki\/Main_Page\">Proxmox 9<\/a> server. At the time of this acquisition, I didn&#8217;t realize this minicomputer had an artificial intelligence (AI) engine [<a href=\"https:\/\/www.amd.com\/en\/products\/processors\/laptop\/ryzen\/8000-series\/amd-ryzen-7-8845hs.html\">1<\/a>] build in the CPU that could be used to run AI applications locally. A coworker recommended that I try <a href=\"https:\/\/deepmind.google\/models\/gemma\/gemma-3\/\">Google Gemma 3<\/a> as a local AI open model to work with my use cases.<\/p>\n<p>&#8220;Gemma is a family of generative artificial intelligence (AI) models and you can use them in a wide variety of generation tasks, including question answering, summarization, and reasoning.&#8221; [<a href=\"https:\/\/ai.google.dev\/gemma\/docs\/core\">2<\/a>], a review of the Gemma 3 key features is also posted on this page. This page [<a href=\"https:\/\/ai.google.dev\/gemma\/docs\/core#sizes\">3<\/a>] lists the minimum requirements for the 5 Gemma 3 models 270M, 1B, 4B, 12B, and 27B.<\/p>\n<p><span style=\"font-size:16px;\"><strong>Default Open WebUI<\/strong><\/span><\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" alt=\"\" src=\"https:\/\/i0.wp.com\/isc.sans.edu\/diaryimages\/images\/gemma3_intro_page.png?ssl=1\" style=\"width: 751px; height: 366px;\"><\/p>\n<p><span style=\"font-size:16px;\"><strong>My Setup with Open WebUI<\/strong><\/span><\/p>\n<ul>\n<li><span style=\"font-family:Courier New,Courier,monospace;\">OS is a Linux Container (LXC) Ubuntu 24.04<\/span><\/li>\n<li><span style=\"font-family:Courier New,Courier,monospace;\">Ollama with gemma3:12b [<a href=\"https:\/\/deepmind.google\/models\/gemma\/gemma-3\/\">4<\/a>]<\/span><\/li>\n<li><span style=\"font-family:Courier New,Courier,monospace;\">Open WebUI [<a href=\"https:\/\/github.com\/open-webui\/open-webui\">5<\/a>]<\/span><\/li>\n<\/ul>\n<p><span style=\"font-size:16px;\"><strong>Installing Ollama with Gemma 3<\/strong><\/span><\/p>\n<p>I used these steps to get Gemma setup. First review the requirements for RAM [<a href=\"https:\/\/ai.google.dev\/gemma\/docs\/core#sizes\">3<\/a>] before deciding with Gemma 3 model to install. You can start small (i.e. 4B or smaller) for testing before using a larger model. I&#8217;m using\u00a0 4B and 12B with 16 GB of RAM with my installation.\u00a0<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" alt=\"\" src=\"https:\/\/i0.wp.com\/isc.sans.edu\/diaryimages\/images\/gemma3_installation.png?ssl=1\" style=\"width: 509px; height: 93px;\"><\/p>\n<p>If you want to test some queries before installing the WebUI, this last command will open the interpreter:<\/p>\n<p><span style=\"font-family:Courier New,Courier,monospace;\">ollama run gemma3:4b<\/span><\/p>\n<p>Since I have a Ryzen 7 CPU, my next step was to install the admgpu [7] software to use the AI features of the CPU. The last step is to install the graphical interface to work from a browser using the Open WebUI [5] and there are several models listed here to get the WebUI running. I had to try a few combinations; in the end this is what I used:<\/p>\n<p><span style=\"font-family:Courier New,Courier,monospace;\">sudo docker run -d -p 80:8080 -v ollama:\/root\/.ollama &#8211;add-host=host.docker.internal:host-gateway -v open-webui:\/app\/backend\/data &#8211;name open-webui &#8211;restart always ghcr.io\/open-webui\/open-webui:main<\/span><\/p>\n<p><strong><span style=\"font-size:16px;\">Bugs in Proxmox 9 for LXC and AppArmor<\/span><\/strong><\/p>\n<p>For the Linux Container to run correctly, I had to edit the edit the LXC config file (114 is the container number) and add those two lines:<\/p>\n<p>vi \/etc\/pve\/lxc\/114.conf<\/p>\n<ul>\n<li><span style=\"font-family:Courier New,Courier,monospace;\">lxc.apparmor.profile: unconfined<\/span><\/li>\n<li><span style=\"font-family:Courier New,Courier,monospace;\">lxc.mount.entry: \/dev\/null sys\/module\/apparmor\/parameters\/enabled none bind 0 0<\/span><\/li>\n<\/ul>\n<p>And it may also be necessary to add this as well in the sudo command before installing the docker: &#8211;security-opt apparmor:unconfined<\/p>\n<p><span style=\"font-size:16px;\"><strong>Login WebUI Interface<\/strong><\/span><\/p>\n<p>After the installation of the WebUI, you need to create the first admin account before being able to login.My first query asked my AI to describe the IPv4 header:<br \/>\n<img data-recalc-dims=\"1\" decoding=\"async\" alt=\"\" src=\"https:\/\/i0.wp.com\/isc.sans.edu\/diaryimages\/images\/gemma3_ip_question.png?ssl=1\" style=\"width: 740px; height: 665px;\"><\/p>\n<p><span style=\"font-size:14px;\"><span style=\"line-height:115%\"><span style='font-family:\"Aptos\",sans-serif'>Gemma 3 offers the ability to work with large files with its 128K context, work with images and has multilingual support which is practical if you know multiple languages. Finally, it can run locally in PC, laptop and smartphone on a single GPU or TPU and smaller devices. If you have experience using Gemma 3, what are the use cases you are using it? You can add your comments in our <a href=\"https:\/\/isc.sans.edu\/contact.html\">contact form<\/a>.<\/span><\/span><\/span><\/p>\n<p>[1] https:\/\/www.amd.com\/en\/products\/processors\/laptop\/ryzen\/8000-series\/amd-ryzen-7-8845hs.html<br \/>\n[2] https:\/\/ai.google.dev\/gemma\/docs\/core<br \/>\n[3] https:\/\/ai.google.dev\/gemma\/docs\/core#sizes<br \/>\n[4] https:\/\/deepmind.google\/models\/gemma\/gemma-3\/<br \/>\n[5] https:\/\/github.com\/open-webui\/open-webui<br \/>\n[6] https:\/\/ai.google.dev\/gemma\/docs\/integrations\/ollama?utm_source=deepmind.google&amp;utm_medium=referral&amp;utm_campaign=gdm&amp;utm_content<br \/>\n[7] https:\/\/rocm.docs.amd.com\/projects\/radeon-ryzen\/en\/latest\/docs\/install\/installryz\/native_linux\/install-ryzen.html<br \/>\n[8] https:\/\/forum.proxmox.com\/threads\/priviledge-container-disabling-apparmor-does-not-work.122168\/<br \/>\n[9] https:\/\/blog.ktz.me\/apparmors-awkward-aftermath-atop-proxmox-9\/<br \/>\n[10] https:\/\/docs.openwebui.com\/<\/p>\n<p>&#8212;&#8212;&#8212;&#8211;<br \/>\nGuy Bruneau <a href=\"http:\/\/www.ipss.ca\/\">IPSS Inc.<\/a><br \/>\n<a href=\"https:\/\/github.com\/bruneaug\/\">My GitHub Page<\/a><br \/>\nTwitter: <a href=\"https:\/\/twitter.com\/guybruneau\">GuyBruneau<\/a><br \/>\ngbruneau at isc dot sans dot edu<\/p>\n<p> (c) SANS Internet Storm Center. https:\/\/isc.sans.edu Creative Commons Attribution-Noncommercial 3.0 United States License.<\/p><\/div>\n<p> \t<BR><br \/>\n <BR><\/BR><\/p>\n<p> \t<BR><br \/>\n<BR><\/BR><br \/>\n<a href=\"https:\/\/isc.sans.edu\/diary\/rss\/32556\">Go to isc.sans.edu<\/a><br \/>\n \t<BR><br \/>\n <BR><\/BR><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Using AI Gemma 3 Locally with a Single CPU , (Wed, Dec 10th) Several months ago, I got a Nucbox K8 Plus minicomputer to use as a Proxmox 9 server. At the time of this acquisition, I didn&#8217;t realize this minicomputer had an artificial intelligence (AI) engine [1] build in the CPU that could be [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[56],"tags":[69],"class_list":["post-9100","post","type-post","status-publish","format-standard","hentry","category-isc-sans-edu","tag-isc-sans-edu"],"_links":{"self":[{"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/posts\/9100"}],"collection":[{"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/comments?post=9100"}],"version-history":[{"count":0,"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/posts\/9100\/revisions"}],"wp:attachment":[{"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/media?parent=9100"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/categories?post=9100"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/serisec.com\/index.php\/wp-json\/wp\/v2\/tags?post=9100"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}