<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Log✍️ by Tea]]></title><description><![CDATA[Welcome to Log✍️️ by Tea. I am logging my learning notes and stray thoughts in this blog.]]></description><link>https://blog.teabuff.me</link><generator>RSS for Node</generator><lastBuildDate>Mon, 18 May 2026 11:54:23 GMT</lastBuildDate><atom:link href="https://blog.teabuff.me/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Clipboard Issue with NeoVim on remote Tmux  session]]></title><description><![CDATA[Recently I discovered a fix for the clipboard issue that bother me for years. And I want to log it here.
For context, my development flow is always:

remote ssh to my workstation

start/attach to a tmux session

sometimes open neovim to do some editi...]]></description><link>https://blog.teabuff.me/clipboard-issue-with-neovim-on-remote-tmux-session</link><guid isPermaLink="true">https://blog.teabuff.me/clipboard-issue-with-neovim-on-remote-tmux-session</guid><category><![CDATA[dev environment]]></category><category><![CDATA[neovim]]></category><category><![CDATA[tmux]]></category><dc:creator><![CDATA[Tea Buff]]></dc:creator><pubDate>Mon, 04 Aug 2025 06:27:30 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/4Mw7nkQDByk/upload/94fb7ed029a568326ba49ab9d202245b.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Recently I discovered a fix for the clipboard issue that bother me for years. And I want to log it here.</p>
<p>For context, my development flow is always:</p>
<ol>
<li><p>remote ssh to my workstation</p>
</li>
<li><p>start/attach to a tmux session</p>
</li>
<li><p>sometimes open neovim to do some editing work.</p>
</li>
</ol>
<p>Occasionally, I need to copy large chunk of context from my terminal/neovim content in remote server, and then search or record it to my note using my laptop client.</p>
<p>I usually had problems with the requirement, either within tmux session or content in the NeoVim. By default the copied content goes to the remote server's clipboard instead of my local client clipboard. In the past, I use tmux plugins / vim plugins (e.g. tmux-yank) to solve the issue, and later found the solution did not work well after some time (Might be due to software update). Or has to be configured differently in different OS. That brings a lot of headache as:</p>
<ul>
<li><p>Some plugins using X11 forwarding require configuring pbcopy/pbpaste, xclip, xsel, wl-clipboard in remote machines. This is not very easy to manage as it requires XWindow, Wayland environment. And you also need ssh -X/-Y to make it available.</p>
</li>
<li><p>In-compatibility issues might occur if my local client and remote server is not using the same OS. E.g. macos client and ubuntu server. Stange behavior like copy/paste can work in tmux, or NeoVim. But not NeoVim inside tmux.</p>
</li>
<li><p>Even if fallback to use mouse select terminal content, then use copy/paste shortcut some time conflict with terminal default function. E.g. iTerm has the mouse reporting feature. And if do above, you will see mouse reporting has prevented making a selection warnings.</p>
</li>
</ul>
<p>Recently I just found a more stable and easy way: <a target="_blank" href="https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands">ANSI OSC52</a> sequence.</p>
<h3 id="heading-how-it-works">How it works?</h3>
<p>You copy text in tmux or Neovim on the remote server. The application sends an OSC 52 escape sequence through the SSH connection. Your local terminal receives this sequence and updates your local system's clipboard.</p>
<h3 id="heading-requirements">Requirements:</h3>
<ul>
<li><p>A compatible local terminal emulator. Common examples include iTerm2, Kitty, WezTerm, Alacritty, and recent versions of GNOME Terminal.</p>
</li>
<li><p>tmux (version 2.6+) on the remote server.</p>
</li>
</ul>
<h3 id="heading-setup">Setup:</h3>
<ol>
<li><p>Add the following line to your ~/.tmux.conf file on the remote server:</p>
<pre><code class="lang-plaintext"> set-option -g set-clipboard on
</code></pre>
</li>
<li><p>In NeoVim init.lua</p>
<pre><code class="lang-plaintext"> vim.g.clipboard = 'osc52'
 vim.o.clipboard = 'unnamedplus' # optional if you don't want to overwrite default yank behavior.
</code></pre>
</li>
<li><p>Finally, after you reload tmux, you can use test the copy</p>
<pre><code class="lang-plaintext"> "+y to yank the NeoVim content into your local client clipboard.
 Or y if you set the 'unnamedplus'
</code></pre>
</li>
</ol>
<p>The second point is especially important, because my setup involves multiple layers (<code>Neovim</code> -&gt; <code>tmux</code> -&gt; <code>SSH</code> -&gt; <code>Your Terminal</code>), and NeoVim seems can't reliably auto-detect that it should use OSC 52. Most tutorial mentioned that NeoVim natively support OSC 52 since <a target="_blank" href="https://github.com/neovim/neovim/pull/25872">this PR</a>, and no setup is needed. But I found in my setup NeoVim content would not be copied to client clipboard, unless the step 2 is done.</p>
<p>Hopefully, this is helpful for people using similar situation as my setup.</p>
]]></content:encoded></item><item><title><![CDATA[How to estimate the materialized model size]]></title><description><![CDATA[When we heard about Large Language Models, we always hear about the parameter size of the model. E.g. GPT-3.5 has 175 billion parameters, Deepseek R-1 has 671 billion parameters and GPT-4 is rumored to even have 1.8 trillion parameters.
What exactly ...]]></description><link>https://blog.teabuff.me/how-to-estimate-the-materialized-model-size</link><guid isPermaLink="true">https://blog.teabuff.me/how-to-estimate-the-materialized-model-size</guid><category><![CDATA[LLM fundamental]]></category><dc:creator><![CDATA[Tea Buff]]></dc:creator><pubDate>Mon, 04 Aug 2025 06:00:17 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/unsplash/W8Qqn1PmQH0/upload/v1662190625488/nzCMzpDOj.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>When we heard about Large Language Models, we always hear about the parameter size of the model. E.g. GPT-3.5 has 175 billion parameters, Deepseek R-1 has 671 billion parameters and GPT-4 is rumored to even have 1.8 trillion parameters.</p>
<h2 id="heading-what-exactly-does-that-mean">What exactly does that mean?</h2>
<p>A fundamental knowledge is, for most part, the model is composed of the model's parameters (often called weights and biases). Each parameter is a numerical value that the model learned during training and the precision of these numbers dictates how much space they occupy.</p>
<p>Common data types used in LLM training and inference include:</p>
<ul>
<li><p>FP32 (32-bit floating point): each parameter takes 4 bytes</p>
</li>
<li><p>FP16 (16-bit floating point) or BF16 (BFloat16): each parameter takes 2 bytes</p>
</li>
<li><p>INT8 (8-bit integer): each parameter takes 1 byte</p>
</li>
<li><p>INT4 (4-bit integer): each parameter takes 0.5 bytes</p>
</li>
</ul>
<p>NOTE: Detail explanation of these data types refer to this <a target="_blank" href="https://moocaholic.medium.com/fp64-fp32-fp16-bfloat16-tf32-and-other-members-of-the-zoo-a1ca7897d407">guide</a></p>
<p>With above knowledge, it is very easy to estimate the model size using this formula:</p>
<p>$$\text{model_size} = \text{number_of_parameters} \times \text{bytes_per_parameter}$$</p><h2 id="heading-how-do-we-calculate-the-estimated-size">How do we calculate the estimated size?</h2>
<p>Take an example of Deepseek R1 from <a target="_blank" href="https://ollama.com/library/deepseek-r1:671b">Ollama</a></p>
<p><img src="https://github.com/user-attachments/assets/7686a864-df8b-47d6-bd66-a91a60f059bc" alt="Deepseek R1" /></p>
<p>We know that:</p>
<ol>
<li><p>There is 671 billion parameters</p>
</li>
<li><p>It is using Q4_K_M quantization, that means 0.5 bytes per parameter</p>
</li>
</ol>
<p>Therefore, we can calculate the space usage using</p>
<p>$$671,000,000,000 \text{ parameters} \times 0.5 \text{ bytes/parameter} = 335,500,000,000 \text{ bytes}$$</p><p>And the final result is around <code>312.4GiB</code>, this is closer to the 404 GiB size. The additional size in the actual file can be attributed to the overhead of the Q4_K_M quantization (the scaling factors and other metadata that add to the size) and the model's architecture itself, which includes more than just the parameters.</p>
<p>Overall, using above method should give us a rough estimated scale of the model size, and help us design the system using LLM.</p>
]]></content:encoded></item></channel></rss>