<?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" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by 李縉丞 on Medium]]></title>
        <description><![CDATA[Stories by 李縉丞 on Medium]]></description>
        <link>https://medium.com/@leeeo1211?source=rss-bcfcf6fa6eff------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*JEonj5LyAJFeqkIk</url>
            <title>Stories by 李縉丞 on Medium</title>
            <link>https://medium.com/@leeeo1211?source=rss-bcfcf6fa6eff------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 16:56:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@leeeo1211/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Dissecting LLM Jargon: Chain-of-Thought (CoT), Self-Consistency, and In-Context Learning (ICL)]]></title>
            <link>https://medium.com/@leeeo1211/dissecting-llm-jargon-chain-of-thought-cot-self-consistency-and-in-context-learning-icl-880820030da9?source=rss-bcfcf6fa6eff------2</link>
            <guid isPermaLink="false">https://medium.com/p/880820030da9</guid>
            <category><![CDATA[chain-of-thought]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[李縉丞]]></dc:creator>
            <pubDate>Mon, 06 Apr 2026 14:42:54 GMT</pubDate>
            <atom:updated>2026-04-06T14:45:04.548Z</atom:updated>
            <content:encoded><![CDATA[<p>The thought-provoking vid <a href="https://www.youtube.com/watch?v=s00fy5RkCHc">【人工智能】推理的本质 | Denny Zhou斯坦福讲座 | 什么是推理 | 思考的必要性 | 思维链提示 | 贪婪解码 | 置信度 | step-by-step | SFT | 验证器</a> explores how LLM reason. This article unpacks the mentioned concepts and, more importantly, explores how they interact and differ — especially when compared to traditional fine-tuning.</p><h3>1. Chain-of-Thought (CoT): Teaching Models to “Think Out Loud”</h3><p><strong>Chain-of-Thought prompting</strong> encourages an LLM to generate intermediate reasoning steps before arriving at a final answer.</p><p>Instead of:</p><blockquote><em>“What is 17 × 24?”</em></blockquote><p>You prompt:</p><blockquote><em>“What is 17 × 24? Let’s think step by step.”</em></blockquote><p>The model might respond:</p><blockquote><em>17 × 24 = (17 × 20) + (17 × 4) = 340 + 68 = 408</em></blockquote><h3>Why CoT Works</h3><ul><li>It <strong>decomposes complex problems</strong> into manageable steps</li><li>It <strong>reduces reasoning errors</strong> by making the process explicit</li><li>It aligns with how humans solve problems — iteratively and logically</li></ul><p>However, CoT alone isn’t perfect. Sometimes, the model produces <em>plausible but incorrect</em> reasoning paths.</p><h3>2. Self-Consistency: From One Thought to Many</h3><p><strong>Self-Consistency</strong> builds on CoT by introducing <em>diversity in reasoning</em>.</p><p>Instead of relying on a single reasoning path, the model:</p><ol><li>Generates <strong>multiple CoT responses</strong> (via sampling)</li><li>Extracts the <strong>final answer from each</strong></li><li>Selects the <strong>most consistent (majority) answer</strong></li></ol><h3>Intuition</h3><p>If multiple independent reasoning paths converge to the same answer, it’s more likely to be correct.</p><h3>3. The Power Combo: CoT + Self-Consistency</h3><p>Individually, CoT improves reasoning clarity, while Self-Consistency improves reliability. Together, they form a powerful combination.</p><h3>How They Complement Each Other</h3><p>TechniqueStrengthWeaknessCoTStructured reasoningSensitive to single-path errorsSelf-ConsistencyRobust answer selectionNeeds diverse reasoning samples</p><h3>Combined Workflow</h3><ol><li>Prompt the model with <strong>Chain-of-Thought</strong></li><li>Sample <strong>multiple reasoning paths</strong></li><li>Aggregate answers via <strong>Self-Consistency</strong></li></ol><h3>Why This Works So Well</h3><ul><li>CoT introduces <strong>structured exploration</strong></li><li>Self-Consistency introduces <strong>statistical validation</strong></li></ul><p>This mirrors ensemble learning in machine learning:</p><blockquote><em>Multiple weak reasoning paths → one strong final answer</em></blockquote><h3>Practical Impact</h3><p>This combination has shown strong improvements in:</p><ul><li>Mathematical reasoning</li><li>Logical inference tasks</li><li>Multi-step problem solving</li></ul><h3>4. In-Context Learning (ICL): Learning Without Updating Weights</h3><p><strong>ICL</strong> is analogy and pattern recognition, allowing an LLM to learn from examples <em>within the prompt itself</em>, without modifying its parameters. When you provide examples, the <strong>Attention Mechanism</strong> of the Transformer identifies patterns within those examples.</p><h3>Example</h3><p><strong>Technical Intuition</strong>: Research suggests that “Induction Heads” within the model recognize repetitive patterns in the input sequence. For instance, if it sees Apple -&gt; 蘋果, Banana -&gt; 香蕉, it automatically infers a mapping rule of &quot;English Word -&gt; Chinese Translation&quot; for subsequent tokens.</p><h3>Key Idea</h3><p>The model uses the prompt as a <strong>temporary training set</strong>.</p><h3>5. ICL vs Fine-Tuning: Two Paths to Adaptation</h3><p>Both ICL and fine-tuning adapt models to tasks — but they operate very differently.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*YvVS4A4hP24KttDOuYarNw.png" /><figcaption>Fundamental Differences: ICL vs Fine-Tuning</figcaption></figure><h3>When to Use What?</h3><p><strong>Use ICL when:</strong></p><ul><li>You need <strong>quick adaptation</strong></li><li>You have <strong>limited examples</strong></li><li>You want <strong>flexibility across tasks</strong></li></ul><p><strong>Use Fine-Tuning when:</strong></p><ul><li>You need <strong>consistent, production-level performance</strong></li><li>The task is <strong>well-defined and repeated</strong></li><li>You have <strong>sufficient labeled data</strong></li></ul><h3>6. A Deeper Insight: Why ICL Even Works</h3><p>ICL is not “learning” in the traditional sense. Instead, LLMs:</p><ul><li>Recognize <strong>patterns in the prompt</strong></li><li>Simulate <strong>task-specific behavior</strong></li><li>Leverage <strong>latent knowledge learned during pretraining</strong></li></ul><p>Some researchers describe this as:</p><blockquote><em>“Meta-learning encoded in the model weights”</em></blockquote><h3>Final Thoughts</h3><p>The “secret” of LLMs isn’t just scale — it’s how we <em>interact</em> with them.</p><ul><li><strong>Chain-of-Thought</strong> gives models a reasoning scaffold</li><li><strong>Self-Consistency</strong> adds robustness through diversity</li><li><strong>In-Context Learning</strong> enables flexible, zero-training adaptation</li></ul><p>Together, these techniques transform LLMs from passive text generators into <strong>adaptive problem solvers</strong>.</p><p>As research continues, the boundary between prompting and training keeps blurring — hinting at a future where <em>how we ask</em> becomes just as important as <em>what the model knows</em>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=880820030da9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Compare Membership Checks in Python Dictionaries]]></title>
            <link>https://medium.com/@leeeo1211/compare-membership-checks-in-python-dictionaries-8f535d1c00a5?source=rss-bcfcf6fa6eff------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f535d1c00a5</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[dictionary]]></category>
            <category><![CDATA[hash]]></category>
            <dc:creator><![CDATA[李縉丞]]></dc:creator>
            <pubDate>Wed, 25 Feb 2026 12:53:07 GMT</pubDate>
            <atom:updated>2026-03-02T10:40:56.638Z</atom:updated>
            <content:encoded><![CDATA[<p>Python dictionaries are implemented using <strong>hash tables</strong>, which give them powerful average-case lookup performance of <strong>O(1)</strong>.</p><p>But not all membership checks against a dictionary behave the same way. Let’s analyze the following code:</p><p><strong>num_dict</strong> is a dictionary with 3 key-value pairs. In the 1:0 pair, <strong>1 is key, 0 is the mapping value. </strong>(2,0) is a tuple contains the 2:0 key-value pair. Below 3 if statements will all print yes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/470/1*qa_pOeP6p8HrdcO9aAZB0A.png" /><figcaption>Python codes</figcaption></figure><p>Quick Answer</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*gpkpY9Gp3dmxtBTPFlLuiw.png" /></figure><h4>&lt;1&gt;What happens “ if 1 in num_dict( ): ?</h4><ul><li>Python hashes the key 1</li><li>Uses the hash to locate the correct bucket</li><li>Performs direct lookup in the hash table</li></ul><p>Since dictionaries are hash tables:</p><ul><li><strong>Average time complexity: O(1)</strong></li><li>No iteration required</li><li>No additional objects created</li></ul><p>This is the most direct way to leverage the dictionary’s hash structure.</p><h4>&lt;2&gt; if 1 in num_dict.keys( ): ?</h4><p>Returns a dict_keys view object</p><p>This view is backed by the original dictionary</p><p>Membership checks still use the dictionary’s hash table</p><p>So:</p><ul><li><strong>Average time complexity: O(1)</strong></li><li>Still uses hashing internally</li></ul><p>However:</p><ul><li>Creates an unnecessary view object</li><li>Redundant because in dict already checks keys by default</li></ul><h4>&lt;3&gt; if (2, 0) in num_dict.items( ): ?</h4><ul><li>Returns a dict_items view</li><li>Contains (key, value) tuples</li><li>Does NOT maintain a hash index for pairs</li></ul><p>To check membership:</p><ul><li>Python must iterate through items</li><li>Compare each (key, value) tuple. Stop if a match is found</li></ul><p>This results in:</p><ul><li>Linear search with <strong>Time complexity: O(n)</strong></li><li>No direct hash lookup for pairs</li></ul><p>Even though keys are hashed internally, the (key, value) tuple itself is not used as a hashed lookup entry in the dictionary structure. So this does <strong>not</strong> utilize the hash structure for O(1) membership testing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f535d1c00a5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CD-HIT用於資料前處理的3種方式]]></title>
            <link>https://medium.com/@leeeo1211/cd-hit%E7%94%A8%E6%96%BC%E8%B3%87%E6%96%99%E5%89%8D%E8%99%95%E7%90%86%E7%9A%843%E7%A8%AE%E6%96%B9%E5%BC%8F-00da98dc1832?source=rss-bcfcf6fa6eff------2</link>
            <guid isPermaLink="false">https://medium.com/p/00da98dc1832</guid>
            <category><![CDATA[cd-hit]]></category>
            <category><![CDATA[data-pre-processing]]></category>
            <dc:creator><![CDATA[李縉丞]]></dc:creator>
            <pubDate>Tue, 24 Feb 2026 02:24:48 GMT</pubDate>
            <atom:updated>2026-02-24T02:24:48.668Z</atom:updated>
            <content:encoded><![CDATA[<p>CD-HIT專門用於比較基因或蛋白質序列相似度的工具，舉例在分類模型中(classifier)，會把過於相似的正負樣本的序列去除，避免訓練時誤導模型，而其中CD-HIT依演算法又分成1D mode和2Dmode，本文分析如何用1D、2D、1D+2D用於二元分類的資料前處理。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=00da98dc1832" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fantasy Baseball Review — Perez’s 2025 H2H point league]]></title>
            <link>https://medium.com/@leeeo1211/fantasy-baseball-review-perezs-2025-h2h-point-league-11f9d7f93574?source=rss-bcfcf6fa6eff------2</link>
            <guid isPermaLink="false">https://medium.com/p/11f9d7f93574</guid>
            <category><![CDATA[sports-predictions]]></category>
            <category><![CDATA[fantasy-sports]]></category>
            <category><![CDATA[evaluation]]></category>
            <category><![CDATA[fantasy-baseball-draft]]></category>
            <category><![CDATA[fantasy-baseball]]></category>
            <dc:creator><![CDATA[李縉丞]]></dc:creator>
            <pubDate>Mon, 23 Feb 2026 14:49:30 GMT</pubDate>
            <atom:updated>2026-02-26T08:55:17.059Z</atom:updated>
            <content:encoded><![CDATA[<p>head-to-head point league with custom evaluation</p><p>League ID#:<strong>38154 </strong>League Name:科羅拉多裴瑞汁聯盟</p><p>這是H2H對戰積分盟，14玩家每位預算300$選位27球員(unit salary=11.1)，積分定義如下圖，這是重視打者與投手基本功(三振保送比)的評分標準，2025年MLB打者平均k%與BB%為22.2%和8.4%，套用下圖評分的話，聯盟平均水平打者的三振保送比的期望值會是負分的( -(0.6+0.2)*0.222 + 0.7*0.084 &lt; 0 )。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/574/1*loxbfzsdZfyGfeJ1Fc4QVw.png" /></figure><p>回顧2025賽季玩家們選秀花費與球員表現的關係，探討哪些「投資」是眼光精準，我整理打者群與投手群如下兩張圖。</p><p>先說結論:</p><blockquote>1.場均分數前百名打者中，1.15是中間水平，&gt;1.25是all-star水平，&gt;1.35已經是MVP級的水平了</blockquote><blockquote>2.屬於物超所值(第二象限)的打者有19位: C.Raleigh, N.Kurtz, G.Springer, B.Buxton, G.Perdomo, S.Langeliers, J.Peña, L.Keaschall, J.Marsee, C.Jensen, J.Profar, J.Caminero, K.Stowers, M.Garcia, V.Pasquantino, J.Polanco, M.Busch, N.Hoerner, J.Wilson</blockquote><blockquote>3.場均分數前百名投手中，5.1是中間水平，&gt;5.9是all-star水平，&gt;6.7可說是Cy Yong級的水平</blockquote><blockquote>4.屬於物超所值(第二象限)的投手也有19位: Trevor Rogers, Connelly Early, Kyle Bradish, Nolan McLean, Trevor McDonald, Logan Henderson, Ranger Suárez, Kris Bubic, Brandon Walter, Parker Messick, Jose Espada, Emmet Sheehan, Hurston Waldrep, Matthew Boyd, Merrill Kelly, Andrew Abbott, Tyler Mahle, Tyler Wells, Shane Bieber</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NvUJtgaQXGFOyHRDF0GTow.png" /></figure><p>挑選場均貢獻≥1分的打者來分析，一共92位，先定義何謂場均分數(points/games)，若打者一場出賽5AB內可擊出2支1B，則獲得1.4分(2*1.2–0.2*5=1.4)，若本季每一場出賽都如此表現，則他的(points/games)也會是1.4分。以Y.Alvarez為例，他的(points/games)是1.15，選秀時被玩家競標選中的花費(薪資)為58$，可知買他場均分數1分的貢獻的花費(salary/(points/games)) 會是50.4$ (58/1.15=50.4)。</p><p>(points/games)的中位數和平均數分別是1.14, 1.21; (salary/(points/games)) 的中位數和平均數分別是5.79, 16.04，圖中粉色點線代表中位數。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xMLOqsDZFWgcPeu2YxKWZQ.png" /></figure><p>投手部分則挑選場均貢獻≥4分的來畫圖，一共101位，無一例外都是先發投手。</p><p>(points/games)的中位數和平均數分別是5.12, 0.24; (salary/(points/games)) 的中位數和平均數分別是5.39, 1.55，圖中粉色點線代表中位數。</p><p>下一篇會依本文分佈圖的發現，來設計選秀時的價格評估公式</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=11f9d7f93574" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stack(data structure) in Gene Sequence]]></title>
            <link>https://medium.com/@leeeo1211/stack-data-structure-in-gene-sequence-3f777e7f7f2e?source=rss-bcfcf6fa6eff------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f777e7f7f2e</guid>
            <category><![CDATA[stack-data-structure]]></category>
            <category><![CDATA[data-structure-algorithm]]></category>
            <category><![CDATA[bioinformatics]]></category>
            <dc:creator><![CDATA[李縉丞]]></dc:creator>
            <pubDate>Mon, 12 Jan 2026 09:22:47 GMT</pubDate>
            <atom:updated>2026-01-13T02:48:35.828Z</atom:updated>
            <content:encoded><![CDATA[<p>Stack and Queue are basic data structures. This’s a simple example of using a stack to annotate pairing locations in RNA secondary structures. (will be updated)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BOf-o9KUopER7Hx9MvKkwg.png" /><figcaption>source: <a href="https://www.nursinghero.com/study-guides/microbiology/structure-and-function-of-rna">Structure and Function of RNA | Microbiology | Study Guides</a></figcaption></figure><pre>#suggest Python3.7+<br>from dataclasses import dataclass<br>from typing import List, Tuple<br><br><br>@dataclass<br>class ParseResult:<br>    pairs: List[Tuple[int, int]]  # (open_index, close_index)<br>    unmatched_closers: List[int]  # indices of &#39;&gt;&#39; that had no matching &#39;&lt;&#39;<br>    unmatched_openers: List[int]  # indices of &#39;&lt;&#39; left in stack at the end<br><br><br>def pair_secondary_structure(structure: str) -&gt; ParseResult:<br>    &quot;&quot;&quot;<br>    Parse a simplified RNA secondary structure string.<br><br>    Rules:<br>      - &#39;&lt;&#39; opening base-pair position (push its index).<br>      - &#39;&gt;&#39; closing base-pair position (pop and pair with it).<br>      - &#39;.&#39; unpaired position.<br><br>    Returns:<br>      - pairs: list of (open_index, close_index) in the order they were found<br>      - unmatched_closers: indices of &#39;&gt;&#39; that couldn&#39;t be matched<br>      - unmatched_openers: indices of &#39;&lt;&#39; remaining at end<br>    &quot;&quot;&quot;<br>    stack: List[int] = []<br>    pairs: List[Tuple[int, int]] = []<br>    unmatched_closers: List[int] = []<br><br>    for i, ch in enumerate(structure):<br>        if ch == &quot;&lt;&quot;:<br>            stack.append(i) # PUSH<br>        elif ch == &quot;&gt;&quot;:<br>            if stack:<br>                j = stack.pop() # POP<br>                pairs.append((j, i))<br>            else:<br>                unmatched_closers.append(i)<br><br>    unmatched_openers = stack[:]  # whatever is left<br>    return ParseResult(pairs=pairs,<br>                       unmatched_closers=unmatched_closers,<br>                       unmatched_openers=unmatched_openers)<br><br><br>def render_pairs(structure: str, pairs: List[Tuple[int, int]]) -&gt; str:<br>    &quot;&quot;&quot;<br>    Pretty print: show the pairs and also a &quot;partner index&quot; line.<br>    &quot;&quot;&quot;<br>    partner = [&quot;-&quot;] * len(structure)<br>    for a, b in pairs:<br>        partner[a] = str(b)<br>        partner[b] = str(a)<br><br>    # make partner line aligned even for multi-digit indices<br>    width = max(1, max((len(x) for x in partner if x != &quot;-&quot;), default=1))<br>    partner_line = &quot; &quot;.join(x.rjust(width) for x in partner)<br>    idx_line = &quot; &quot;.join(str(i).rjust(width) for i in range(len(structure)))<br>    struct_line = &quot; &quot;.join(ch.rjust(width) for ch in structure)<br>    return f&quot;idx:   {idx_line}\nstruct:{struct_line}\nmate:  {partner_line}&quot;<br><br><br>def main():<br>    examples = [<br>        &quot;...&lt;&lt;&gt;&gt;..&quot;,     # valid<br>        &quot;&lt;&lt;.&lt;.&gt;&gt;&quot;,       # valid<br>        &quot;&gt;&lt;..&quot;,          # starts with unmatched closer<br>        &quot;&lt;&lt;..&gt;&quot;,         # leftover opener<br>        &quot;&lt;&lt;&gt;&gt;&lt;&gt;&quot;,        # valid (nested + separate)<br>    ]<br><br>    for s in examples:<br>        result = pair_secondary_structure(s)<br>        print(&quot;=&quot; * 60)<br>        print(&quot;structure:&quot;, s)<br>        print(&quot;pairs:&quot;, result.pairs)<br>        if result.unmatched_closers:<br>            print(&quot;unmatched closers at:&quot;, result.unmatched_closers)<br>        if result.unmatched_openers:<br>            print(&quot;unmatched openers at:&quot;, result.unmatched_openers)<br>        print(render_pairs(s, result.pairs))<br><br><br>if __name__ == &quot;__main__&quot;:<br>    main()</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f777e7f7f2e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>