<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Concepts on yzma</title>
    <link>https://yzma.ai/docs/concepts/</link>
    <description>Recent content in Concepts on yzma</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <atom:link href="https://yzma.ai/docs/concepts/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Architecture</title>
      <link>https://yzma.ai/docs/concepts/architecture/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://yzma.ai/docs/concepts/architecture/</guid>
      <description>&lt;h2 id=&#34;overview&#34;&gt;Overview&lt;/h2&gt;&#xA;&lt;p&gt;yzma calls &lt;code&gt;llama.cpp&lt;/code&gt; in the same process as your Go program. There is no model server and there is no network connection.&lt;/p&gt;&#xA;&lt;pre class=&#34;mermaid&#34;&gt;flowchart TD&#xA;    subgraph app[&amp;#34;Your Go program&amp;#34;]&#xA;        code[&amp;#34;Application code&amp;#34;]&#xA;    end&#xA;    subgraph yzma&#xA;        llama[&amp;#34;pkg/llama&amp;#34;]&#xA;        mtmd[&amp;#34;pkg/mtmd&amp;#34;]&#xA;        loader[&amp;#34;pkg/loader&amp;#34;]&#xA;    end&#xA;    subgraph runtime[&amp;#34;Run time&amp;#34;]&#xA;        purego[&amp;#34;purego&amp;#34;]&#xA;        ffi[&amp;#34;libffi&amp;#34;]&#xA;    end&#xA;    subgraph native[&amp;#34;llama.cpp shared libraries&amp;#34;]&#xA;        libllama[&amp;#34;libllama&amp;#34;]&#xA;        libmtmd[&amp;#34;libmtmd&amp;#34;]&#xA;        ggml[&amp;#34;ggml backends&amp;#34;]&#xA;    end&#xA;    subgraph hw[&amp;#34;Hardware&amp;#34;]&#xA;        cpu[&amp;#34;CPU&amp;#34;]&#xA;        gpu[&amp;#34;GPU&amp;#34;]&#xA;    end&#xA;&#xA;    code --&amp;gt; llama&#xA;    code --&amp;gt; mtmd&#xA;    llama --&amp;gt; loader&#xA;    mtmd --&amp;gt; loader&#xA;    loader --&amp;gt; purego&#xA;    loader --&amp;gt; ffi&#xA;    purego --&amp;gt; libllama&#xA;    purego --&amp;gt; libmtmd&#xA;    ffi --&amp;gt; libllama&#xA;    ffi --&amp;gt; libmtmd&#xA;    libllama --&amp;gt; ggml&#xA;    libmtmd --&amp;gt; ggml&#xA;    ggml --&amp;gt; cpu&#xA;    ggml --&amp;gt; gpu&lt;/pre&gt;&#xA;&lt;h2 id=&#34;no-cgo&#34;&gt;No CGo&lt;/h2&gt;&#xA;&lt;p&gt;Most Go bindings for a C library use CGo. CGo needs a C compiler, and it makes cross compilation hard.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Models</title>
      <link>https://yzma.ai/docs/concepts/models/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://yzma.ai/docs/concepts/models/</guid>
      <description>&lt;h2 id=&#34;gguf&#34;&gt;GGUF&lt;/h2&gt;&#xA;&lt;p&gt;yzma uses models in the GGUF format. This is the format that &lt;code&gt;llama.cpp&lt;/code&gt; reads. A GGUF file holds the weights of the model and the metadata about it, such as the name, the size of the context, and the chat template.&lt;/p&gt;&#xA;&lt;p&gt;There are more than 201,000 GGUF models on Hugging Face:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://huggingface.co/models?library=gguf&amp;amp;sort=trending&#34;&gt;https://huggingface.co/models?library=gguf&amp;amp;sort=trending&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Read the metadata of a file with the &lt;code&gt;modelinfo&lt;/code&gt; example program.&lt;/p&gt;&#xA;&lt;h2 id=&#34;quantization&#34;&gt;Quantization&lt;/h2&gt;&#xA;&lt;p&gt;The name of a model file usually ends with a quantization code, such as &lt;code&gt;Q4_K_M&lt;/code&gt; or &lt;code&gt;Q8_0&lt;/code&gt; or &lt;code&gt;fp16&lt;/code&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Hardware acceleration</title>
      <link>https://yzma.ai/docs/concepts/acceleration/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://yzma.ai/docs/concepts/acceleration/</guid>
      <description>&lt;p&gt;&lt;code&gt;llama.cpp&lt;/code&gt; has a backend for each kind of processor. &lt;code&gt;yzma&lt;/code&gt; installs the backend that you name, and &lt;code&gt;llama.cpp&lt;/code&gt; uses it.&lt;/p&gt;&#xA;&lt;h2 id=&#34;what-each-platform-supports&#34;&gt;What each platform supports&lt;/h2&gt;&#xA;&lt;table&gt;&#xA;  &lt;thead&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;th style=&#34;text-align: left&#34;&gt;Operating system&lt;/th&gt;&#xA;          &lt;th style=&#34;text-align: left&#34;&gt;CPU&lt;/th&gt;&#xA;          &lt;th style=&#34;text-align: left&#34;&gt;GPU&lt;/th&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/thead&gt;&#xA;  &lt;tbody&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;Linux&lt;/td&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;amd64, arm64&lt;/td&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;CUDA, Vulkan, HIP, ROCm, SYCL&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;macOS&lt;/td&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;arm64&lt;/td&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;Metal&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;Windows&lt;/td&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;amd64&lt;/td&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;CUDA, Vulkan, HIP, SYCL, OpenCL&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;A browser is also a target:&lt;/p&gt;&#xA;&lt;table&gt;&#xA;  &lt;thead&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;th style=&#34;text-align: left&#34;&gt;Target&lt;/th&gt;&#xA;          &lt;th style=&#34;text-align: left&#34;&gt;CPU&lt;/th&gt;&#xA;          &lt;th style=&#34;text-align: left&#34;&gt;GPU&lt;/th&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/thead&gt;&#xA;  &lt;tbody&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;Browser&lt;/td&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;wasm32 SIMD, one or more threads&lt;/td&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;WebGPU&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;which-backend-to-choose&#34;&gt;Which backend to choose&lt;/h2&gt;&#xA;&lt;table&gt;&#xA;  &lt;thead&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;th style=&#34;text-align: left&#34;&gt;Backend&lt;/th&gt;&#xA;          &lt;th style=&#34;text-align: left&#34;&gt;Use it when&lt;/th&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/thead&gt;&#xA;  &lt;tbody&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;CPU&lt;/td&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;You have no GPU, or the model is small.&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;CUDA&lt;/td&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;You have an NVIDIA GPU. This is the fastest choice on NVIDIA hardware.&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;Metal&lt;/td&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;You have a Mac with Apple silicon. No installation is necessary.&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;ROCm&lt;/td&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;You have an AMD GPU and the ROCm 7.2 drivers.&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;Vulkan&lt;/td&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;You have a GPU but no vendor driver stack. Vulkan works on many cards.&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;WebGPU&lt;/td&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;Your program runs in a browser.&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Name the backend with the &lt;code&gt;--processor&lt;/code&gt; flag:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Packages</title>
      <link>https://yzma.ai/docs/concepts/packages/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://yzma.ai/docs/concepts/packages/</guid>
      <description>&lt;p&gt;yzma is a set of Go packages. Most programs use two or three of them.&lt;/p&gt;&#xA;&lt;table&gt;&#xA;  &lt;thead&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;th style=&#34;text-align: left&#34;&gt;Package&lt;/th&gt;&#xA;          &lt;th style=&#34;text-align: left&#34;&gt;What it does&lt;/th&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/thead&gt;&#xA;  &lt;tbody&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;&lt;a href=&#34;https://pkg.go.dev/github.com/hybridgroup/yzma/pkg/llama&#34;&gt;&lt;code&gt;pkg/llama&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;The main bindings. Models, contexts, tokens, batches, samplers, and the memory of a conversation.&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;&lt;a href=&#34;https://pkg.go.dev/github.com/hybridgroup/yzma/pkg/mtmd&#34;&gt;&lt;code&gt;pkg/mtmd&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;Multimodal input. Images, audio, and video.&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;&lt;a href=&#34;https://pkg.go.dev/github.com/hybridgroup/yzma/pkg/download&#34;&gt;&lt;code&gt;pkg/download&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;Downloads the &lt;code&gt;llama.cpp&lt;/code&gt; libraries and the models. Checks the digests.&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;&lt;a href=&#34;https://pkg.go.dev/github.com/hybridgroup/yzma/pkg/message&#34;&gt;&lt;code&gt;pkg/message&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;Chat messages and tool calls. Reads the tool call format of each model family.&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;&lt;a href=&#34;https://pkg.go.dev/github.com/hybridgroup/yzma/pkg/template&#34;&gt;&lt;code&gt;pkg/template&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;Jinja chat templates.&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;&lt;a href=&#34;https://pkg.go.dev/github.com/hybridgroup/yzma/pkg/llamawasm&#34;&gt;&lt;code&gt;pkg/llamawasm&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;The browser version of &lt;code&gt;pkg/llama&lt;/code&gt;. Build tag &lt;code&gt;js &amp;amp;&amp;amp; wasm&lt;/code&gt;.&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;&lt;a href=&#34;https://pkg.go.dev/github.com/hybridgroup/yzma/pkg/vlm&#34;&gt;&lt;code&gt;pkg/vlm&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;An experimental high level type for Vision Language Models.&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;&lt;a href=&#34;https://pkg.go.dev/github.com/hybridgroup/yzma/pkg/loader&#34;&gt;&lt;code&gt;pkg/loader&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;Opens a shared library and prepares a function call.&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;&lt;a href=&#34;https://pkg.go.dev/github.com/hybridgroup/yzma/pkg/utils&#34;&gt;&lt;code&gt;pkg/utils&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;&#xA;          &lt;td style=&#34;text-align: left&#34;&gt;Converts a Go string to a C string and back.&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;pkgllama&#34;&gt;pkg/llama&lt;/h2&gt;&#xA;&lt;p&gt;This is the package that most programs import. It gives about 250 functions, in these groups.&lt;/p&gt;</description>
    </item>
    <item>
      <title>WebAssembly</title>
      <link>https://yzma.ai/docs/concepts/webassembly/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://yzma.ai/docs/concepts/webassembly/</guid>
      <description>&lt;p&gt;yzma runs in a browser. The model stays on the machine of the reader, and no server does the work.&lt;/p&gt;&#xA;&lt;h2 id=&#34;two-modules&#34;&gt;Two modules&lt;/h2&gt;&#xA;&lt;p&gt;There are two WebAssembly modules in the page.&lt;/p&gt;&#xA;&lt;pre class=&#34;mermaid&#34;&gt;flowchart TD&#xA;    page[&amp;#34;page (index.html)&amp;#34;]&#xA;    worker[&amp;#34;Web Worker&amp;#34;]&#xA;    go[&amp;#34;Go program (TinyGo)&amp;#34;]&#xA;    cpp[&amp;#34;llama.cpp module (Emscripten)&amp;#34;]&#xA;&#xA;    page --&amp;gt;|postMessage| worker&#xA;    worker --&amp;gt; go&#xA;    worker --&amp;gt; cpp&#xA;    go --&amp;gt;|through JavaScript| cpp&lt;/pre&gt;&#xA;&lt;p&gt;On a native platform yzma calls &lt;code&gt;llama.cpp&lt;/code&gt; with libffi and opens the shared libraries at run time. A WebAssembly module has no &lt;code&gt;dlopen&lt;/code&gt; and no libffi, and TinyGo cannot compile the C++ of &lt;code&gt;llama.cpp&lt;/code&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Verification</title>
      <link>https://yzma.ai/docs/concepts/verification/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://yzma.ai/docs/concepts/verification/</guid>
      <description>&lt;p&gt;&lt;code&gt;yzma install&lt;/code&gt; downloads shared libraries and then runs them in your process. Thus yzma checks each file before it writes anything.&lt;/p&gt;&#xA;&lt;h2 id=&#34;digests&#34;&gt;Digests&lt;/h2&gt;&#xA;&lt;p&gt;&lt;code&gt;Install&lt;/code&gt; reads the SHA-256 of each asset and compares it with the expected value. The expected values come from the manifest that &lt;code&gt;llama-cpp-builder&lt;/code&gt; publishes for each release tag.&lt;/p&gt;&#xA;&lt;p&gt;The manifest is an asset of the release, and there is a copy beside the version files:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;https://github.com/hybridgroup/llama-cpp-builder/releases/download/b10783/b10783.json&#xA;https://hybridgroup.github.io/llama-cpp-builder/digests/b10783.json&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Both hold the same bytes. yzma reads the release asset first. It falls back to the copy.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
