<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>artificial intelligence - Hard Wired</title>
	<atom:link href="https://www.hardwired.dev/tag/artificial-intelligence/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.hardwired.dev</link>
	<description></description>
	<lastBuildDate>Sat, 11 Apr 2026 16:09:02 +0000</lastBuildDate>
	<language>cs</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://www.hardwired.dev/wp-content/uploads/2022/10/android-chrome-256x256-1-150x150.png</url>
	<title>artificial intelligence - Hard Wired</title>
	<link>https://www.hardwired.dev</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Multimodal Embedding &#038; Reranker Models with Sentence Transformers</title>
		<link>https://www.hardwired.dev/2026/04/10/multimodal-embedding-reranker-models-with-sentence-transformers/</link>
		
		<dc:creator><![CDATA[Yukiko Hesse]]></dc:creator>
		<pubDate>Fri, 10 Apr 2026 20:32:42 +0000</pubDate>
				<category><![CDATA[AI]]></category>
		<category><![CDATA[artificial intelligence]]></category>
		<category><![CDATA[computer vision]]></category>
		<category><![CDATA[cross-modal search]]></category>
		<category><![CDATA[embedding models]]></category>
		<category><![CDATA[image retrieval]]></category>
		<category><![CDATA[machine learning]]></category>
		<category><![CDATA[multimodal models]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[RAG]]></category>
		<category><![CDATA[reranker]]></category>
		<category><![CDATA[Semantic search]]></category>
		<category><![CDATA[sentence transformers]]></category>
		<guid isPermaLink="false">https://www.hardwired.dev/?p=3030</guid>

					<description><![CDATA[<p>Multimodal Embedding &#38; Reranker Models with Sentence Transformers Sentence Transformers is a Python library for using and training embedding and &#62;&#62;&#62;</p>
<p>The post <a href="https://www.hardwired.dev/2026/04/10/multimodal-embedding-reranker-models-with-sentence-transformers/">Multimodal Embedding & Reranker Models with Sentence Transformers</a> first appeared on <a href="https://www.hardwired.dev">Hard Wired</a>.</p>]]></description>
										<content:encoded><![CDATA[<div id="bsf_rt_marker"></div><h1>Multimodal Embedding &amp; Reranker Models with Sentence Transformers</h1>
<p>Sentence Transformers is a Python library for using and training embedding and reranker models for applications like retrieval augmented generation, semantic search, and more. With the v5.4 update, you can now encode and compare texts, images, audio, and videos using the same familiar API. In this blogpost, I'll show you how to use these new multimodal capabilities for both embedding and reranking.</p>
</p>
<p>Multimodal embedding models map inputs from different modalities into a shared embedding space, while multimodal reranker models score the relevance of mixed-modality pairs. This opens up use cases like visual document retrieval, cross-modal search, and multimodal RAG pipelines.</p>
<h2>Table of Contents</h2>
<ul>
<li><a href="#what-are-multimodal-models">What are Multimodal Models?</a></li>
<li><a href="#installation">Installation</a></li>
<li><a href="#multimodal-embedding-models">Multimodal Embedding Models</a></li>
<li><a href="#loading-a-model">Loading a Model</a></li>
<li><a href="#encoding-images">Encoding Images</a></li>
<li><a href="#cross-modal-similarity">Cross-Modal Similarity</a></li>
<li><a href="#encoding-queries-and-documents">Encoding Queries and Documents</a></li>
<li><a href="#multimodal-reranker-models">Multimodal Reranker Models</a></li>
<li><a href="#ranking-mixed-modality-documents">Ranking Mixed-Modality Documents</a></li>
<li><a href="#predicting-pair-scores">Predicting Pair Scores</a></li>
<li><a href="#retrieve-and-rerank">Retrieve and Rerank</a></li>
<li><a href="#input-formats-and-configuration">Input Formats and Configuration</a></li>
<li><a href="#supported-input-types">Supported Input Types</a></li>
<li><a href="#checking-modality-support">Checking Modality Support</a></li>
<li><a href="#processor-and-model-kwargs">Processor and Model kwargs</a></li>
<li><a href="#supported-models">Supported Models</a></li>
<li><a href="#additional-resources">Additional Resources</a></li>
</ul>
<h2>What are Multimodal Models?</h2>
<p>Traditional embedding models convert text into fixed-size vectors. Multimodal embedding models extend this by mapping inputs from different modalities (text, images, audio, or video) into a shared embedding space. This means you can compare a text query against image documents (or vice versa) using the same similarity functions you're already familiar with.</p>
<p>Similarly, traditional reranker (Cross Encoder) models compute relevance scores between pairs of texts. Multimodal rerankers can score pairs where one or both elements are images, combined text-image documents, or other modalities.</p>
<p>For example, you can compare a text query against image documents, find video clips matching a description, or build RAG pipelines that work across modalities.</p>
<h2>Installation</h2>
<p>Multimodal models require some extra dependencies. Install the extras for the modalities you need (see <a href="https://sbert.net/docs/installation.html">Installation</a> for more details):</p>
<div class="codehilite">
<pre><span></span><code><span class="c1"># For image support</span>
pip<span class="w"> </span>install<span class="w"> </span>-U<span class="w"> </span><span class="s2">&quot;sentence-transformers[image]&quot;</span>

<span class="c1"># For audio support</span>
pip<span class="w"> </span>install<span class="w"> </span>-U<span class="w"> </span><span class="s2">&quot;sentence-transformers&quot;</span>

<span class="c1"># For video support</span>
pip<span class="w"> </span>install<span class="w"> </span>-U<span class="w"> </span><span class="s2">&quot;sentence-transformers&quot;</span>

<span class="c1"># Mix and match as needed</span>
pip<span class="w"> </span>install<span class="w"> </span>-U<span class="w"> </span><span class="s2">&quot;sentence-transformers[image,video,train]&quot;</span>
</code></pre>
</div>
<p>VLM-based models like Qwen3-VL-2B require a GPU with at least ~8 GB of VRAM. For the 8B variants, expect ~20 GB. If you don't have a local GPU, consider using a cloud GPU service or Google Colab. On CPU, these models will be extremely slow; text-only or CLIP models are better suited for CPU inference.</p>
<h2>Multimodal Embedding Models</h2>
<h3>Loading a Model</h3>
<p>Loading a multimodal embedding model works exactly like loading a text-only model:</p>
<div class="codehilite">
<pre><span></span><code><span class="kn">from</span> <span class="nn">sentence_transformers</span> <span class="kn">import</span> <span class="n">SentenceTransformer</span>

<span class="n">model</span> <span class="o">=</span> <span class="n">SentenceTransformer</span><span class="p">(</span><span class="s2">&quot;Qwen/Qwen3-VL-Embedding-2B&quot;</span><span class="p">,</span> <span class="n">revision</span><span class="o">=</span><span class="s2">&quot;refs/pr/23&quot;</span><span class="p">)</span>
</code></pre>
</div>
<p>The revision argument is required for now because the integration pull requests for these models are still pending. Once they're merged, you'll be able to load them without specifying a revision.</p>
<p>The model automatically detects which modalities it supports, so there's nothing extra to configure. See <a href="#processor-and-model-kwargs">Processor and Model kwargs</a> if you want to control things like image resolution or model precision.</p>
<h3>Encoding Images</h3>
<p>With a multimodal model loaded, <code>model.encode()</code> accepts images alongside text. Images can be provided as URLs, local file paths, or PIL Image objects (see <a href="#supported-input-types">Supported Input Types</a> for all accepted formats):</p>
<div class="codehilite">
<pre><span></span><code><span class="kn">from</span> <span class="nn">sentence_transformers</span> <span class="kn">import</span> <span class="n">SentenceTransformer</span>

<span class="n">model</span> <span class="o">=</span> <span class="n">SentenceTransformer</span><span class="p">(</span><span class="s2">&quot;Qwen/Qwen3-VL-Embedding-2B&quot;</span><span class="p">,</span> <span class="n">revision</span><span class="o">=</span><span class="s2">&quot;refs/pr/23&quot;</span><span class="p">)</span>

<span class="c1"># Encode images from URLs</span>
<span class="n">img_embeddings</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">encode</span><span class="p">([</span>
 <span class="s2">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/car.jpg&quot;</span><span class="p">,</span>
 <span class="s2">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/bee.jpg&quot;</span><span class="p">,</span>
<span class="p">])</span>
<span class="nb">print</span><span class="p">(</span><span class="n">img_embeddings</span><span class="o">.</span><span class="n">shape</span><span class="p">)</span>
<span class="c1"># (2, 2048)</span>
</code></pre>
</div>
<h3>Cross-Modal Similarity</h3>
<p>You can compute similarities between text embeddings and image embeddings, since the model maps both into the same space:</p>
<div class="codehilite">
<pre><span></span><code><span class="kn">from</span> <span class="nn">sentence_transformers</span> <span class="kn">import</span> <span class="n">SentenceTransformer</span>

<span class="n">model</span> <span class="o">=</span> <span class="n">SentenceTransformer</span><span class="p">(</span><span class="s2">&quot;Qwen/Qwen3-VL-Embedding-2B&quot;</span><span class="p">,</span> <span class="n">revision</span><span class="o">=</span><span class="s2">&quot;refs/pr/23&quot;</span><span class="p">)</span>

<span class="c1"># Encode images</span>
<span class="n">img_embeddings</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">encode</span><span class="p">([</span>
 <span class="s2">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/car.jpg&quot;</span><span class="p">,</span>
 <span class="s2">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/bee.jpg&quot;</span><span class="p">,</span>
<span class="p">])</span>

<span class="c1"># Encode text queries (one matching + one hard negative per image)</span>
<span class="n">text_embeddings</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">encode</span><span class="p">([</span>
 <span class="s2">&quot;A green car parked in front of a yellow building&quot;</span><span class="p">,</span>
 <span class="s2">&quot;A red car driving on a highway&quot;</span><span class="p">,</span>
 <span class="s2">&quot;A bee on a pink flower&quot;</span><span class="p">,</span>
 <span class="s2">&quot;A wasp on a wooden table&quot;</span><span class="p">,</span>
<span class="p">])</span>

<span class="c1"># Compute cross-modal similarities</span>
<span class="n">similarities</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">similarity</span><span class="p">(</span><span class="n">text_embeddings</span><span class="p">,</span> <span class="n">img_embeddings</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">similarities</span><span class="p">)</span>
<span class="c1"># tensor([[0.5115, 0.1078],</span>
<span class="c1"># [0.1999, 0.1108],</span>
<span class="c1"># [0.1255, 0.6749],</span>
<span class="c1"># [0.1283, 0.2704]])</span>
</code></pre>
</div>
<p>As expected, "A green car parked in front of a yellow building" is most similar to the car image (0.51), and "A bee on a pink flower" is most similar to the bee image (0.67). The hard negatives ("A red car driving on a highway", "A wasp on a wooden table") correctly receive lower scores.</p>
<p>You might notice that even the best matching scores (0.51, 0.67) aren't very close to 1.0. This is due to the <a href="https://arxiv.org/abs/2203.02053">modality gap</a>: embeddings from different modalities tend to cluster in separate regions of the space. Cross-modal similarities are typically lower than within-modal ones (e.g., text-to-text), but the relative ordering is preserved, so retrieval still works well.</p>
<h3>Encoding Queries and Documents</h3>
<p>For retrieval tasks, <code>encode_query()</code> and <code>encode_document()</code> are the recommended methods. Many retrieval models prepend different instruction prompts depending on whether the input is a query or a document, similar to how chat models might apply different system prompts depending on the goal. Model authors can specify their prompts in the model config, and <code>encode_query()</code> / <code>encode_document()</code> automatically load and apply the correct one:</p>
<ul>
<li><code>encode_query()</code> uses the model's "query" prompt (if available) and sets <code>task="query"</code>.</li>
<li><code>encode_document()</code> uses the first available prompt from "document", "passage", or "corpus", and sets <code>task="document"</code>.</li>
</ul>
<p>Under the hood, both are thin wrappers around <code>encode()</code>, they just handle prompt selection for you. Here's what cross-modal retrieval looks like:</p>
<div class="codehilite">
<pre><span></span><code><span class="kn">from</span> <span class="nn">sentence_transformers</span> <span class="kn">import</span> <span class="n">SentenceTransformer</span>

<span class="n">model</span> <span class="o">=</span> <span class="n">SentenceTransformer</span><span class="p">(</span><span class="s2">&quot;Qwen/Qwen3-VL-Embedding-2B&quot;</span><span class="p">,</span> <span class="n">revision</span><span class="o">=</span><span class="s2">&quot;refs/pr/23&quot;</span><span class="p">)</span>

<span class="c1"># Encode text queries with the query prompt</span>
<span class="n">query_embeddings</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">encode_query</span><span class="p">([</span>
 <span class="s2">&quot;Find me a photo of a vehicle parked near a building&quot;</span><span class="p">,</span>
 <span class="s2">&quot;Show me an image of a pollinating insect&quot;</span><span class="p">,</span>
<span class="p">])</span>

<span class="c1"># Encode document screenshots with the document prompt</span>
<span class="n">doc_embeddings</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">encode_document</span><span class="p">([</span>
 <span class="s2">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/car.jpg&quot;</span><span class="p">,</span>
 <span class="s2">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/bee.jpg&quot;</span><span class="p">,</span>
<span class="p">])</span>

<span class="c1"># Compute similarities</span>
<span class="n">similarities</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">similarity</span><span class="p">(</span><span class="n">query_embeddings</span><span class="p">,</span> <span class="n">doc_embeddings</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">similarities</span><span class="p">)</span>
<span class="c1"># tensor([[0.3907, 0.1490],</span>
<span class="c1"># [0.1235, 0.4872]])</span>
</code></pre>
</div>
<p>These methods accept the same input types as <code>encode()</code> (images, URLs, multimodal dicts, etc.) and pass through the same parameters. For models without specialized query/document prompts, they behave identically to <code>encode()</code>.</p>
<h2>Multimodal Reranker Models</h2>
<p>Multimodal reranker (CrossEncoder) models score the relevance between pairs of inputs, where each element can be text, an image, audio, video, or a combination. They tend to outperform embedding models in terms of quality, but are slower since they process each pair individually. The currently available pretrained multimodal rerankers focus on text and image inputs, but the architecture supports any modality that the underlying model can handle.</p>
<h3>Ranking Mixed-Modality Documents</h3>
<p>The <code>rank()</code> method scores and ranks a list of documents against a query, supporting mixed modalities:</p>
<div class="codehilite">
<pre><span></span><code><span class="kn">from</span> <span class="nn">sentence_transformers</span> <span class="kn">import</span> <span class="n">CrossEncoder</span>

<span class="n">model</span> <span class="o">=</span> <span class="n">CrossEncoder</span><span class="p">(</span><span class="s2">&quot;Qwen/Qwen3-VL-Reranker-2B&quot;</span><span class="p">,</span> <span class="n">revision</span><span class="o">=</span><span class="s2">&quot;refs/pr/11&quot;</span><span class="p">)</span>

<span class="n">query</span> <span class="o">=</span> <span class="s2">&quot;A green car parked in front of a yellow building&quot;</span>
<span class="n">documents</span> <span class="o">=</span> <span class="p">[</span>
 <span class="c1"># Image documents (URL or local file path)</span>
 <span class="s2">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/car.jpg&quot;</span><span class="p">,</span>
 <span class="s2">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/bee.jpg&quot;</span><span class="p">,</span>
 <span class="c1"># Text document</span>
 <span class="s2">&quot;A vintage Volkswagen Beetle painted in bright green sits in a driveway.&quot;</span><span class="p">,</span>
 <span class="c1"># Combined text + image document</span>
 <span class="p">{</span>
 <span class="s2">&quot;text&quot;</span><span class="p">:</span> <span class="s2">&quot;A car in a European city&quot;</span><span class="p">,</span>
 <span class="s2">&quot;image&quot;</span><span class="p">:</span> <span class="s2">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/car.jpg&quot;</span><span class="p">,</span>
 <span class="p">},</span>
<span class="p">]</span>

<span class="n">rankings</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">rank</span><span class="p">(</span><span class="n">query</span><span class="p">,</span> <span class="n">documents</span><span class="p">)</span>
<span class="k">for</span> <span class="n">rank</span> <span class="ow">in</span> <span class="n">rankings</span><span class="p">:</span>
 <span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;</span><span class="si">{</span><span class="n">rank</span><span class="p">[</span><span class="s1">&#39;score&#39;</span><span class="p">]</span><span class="si">:</span><span class="s2">.4f</span><span class="si">}</span><span class="se">\t</span><span class="s2">(document </span><span class="si">{</span><span class="n">rank</span><span class="p">[</span><span class="s1">&#39;corpus_id&#39;</span><span class="p">]</span><span class="si">}</span><span class="s2">)&quot;</span><span class="p">)</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd">0.9375 (document 0)</span>
<span class="sd">0.5000 (document 3)</span>
<span class="sd">-1.2500 (document 2)</span>
<span class="sd">-2.4375 (document 1)</span>
<span class="sd">&quot;&quot;&quot;</span>
</code></pre>
</div>
<p>The reranker correctly identifies the car image (document 0) as the most relevant result, followed by the combined text+image document about a car in a European city (document 3). The bee image (document 1) scores lowest.</p>
<p>Keep in mind that the modality gap can influence absolute scores: text-image pair scores may occupy a different range than text-text or image-image pair scores.</p>
<p>You can also check which modalities a reranker supports using <code>modalities</code> and <code>supports()</code>, just like with embedding models:</p>
<div class="codehilite">
<pre><span></span><code><span class="nb">print</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">modalities</span><span class="p">)</span>
<span class="c1"># [&#39;text&#39;, &#39;image&#39;, &#39;video&#39;, &#39;message&#39;]</span>

<span class="nb">print</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">supports</span><span class="p">(</span><span class="s2">&quot;image&quot;</span><span class="p">))</span>
<span class="c1"># True</span>

<span class="c1"># Check if the model supports a specific pair of modalities</span>
<span class="nb">print</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">supports</span><span class="p">((</span><span class="s2">&quot;image&quot;</span><span class="p">,</span> <span class="s2">&quot;text&quot;</span><span class="p">)))</span>
<span class="c1"># True</span>
</code></pre>
</div>
<h3>Predicting Pair Scores</h3>
<p>You can also use <code>predict()</code> to get raw relevance scores for specific pairs of inputs:</p>
<div class="codehilite">
<pre><span></span><code><span class="kn">from</span> <span class="nn">sentence_transformers</span> <span class="kn">import</span> <span class="n">CrossEncoder</span>

<span class="n">model</span> <span class="o">=</span> <span class="n">CrossEncoder</span><span class="p">(</span><span class="s2">&quot;jinaai/jina-reranker-m0&quot;</span><span class="p">,</span> <span class="n">trust_remote_code</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>

<span class="n">scores</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">predict</span><span class="p">([</span>
 <span class="p">(</span><span class="s2">&quot;A green car&quot;</span><span class="p">,</span> <span class="s2">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/car.jpg&quot;</span><span class="p">),</span>
 <span class="p">(</span><span class="s2">&quot;A bee on a flower&quot;</span><span class="p">,</span> <span class="s2">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/bee.jpg&quot;</span><span class="p">),</span>
 <span class="p">(</span><span class="s2">&quot;A green car&quot;</span><span class="p">,</span> <span class="s2">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/bee.jpg&quot;</span><span class="p">),</span>
<span class="p">])</span>
<span class="nb">print</span><span class="p">(</span><span class="n">scores</span><span class="p">)</span>
<span class="c1"># [0.9389156 0.96922314 0.46063158]</span>
</code></pre>
</div>
<h3>Retrieve and Rerank</h3>
<p>A common pattern is to use an embedding model for fast initial retrieval, then refine the top results with a reranker:</p>
<div class="codehilite">
<pre><span></span><code><span class="kn">from</span> <span class="nn">sentence_transformers</span> <span class="kn">import</span> <span class="n">SentenceTransformer</span><span class="p">,</span> <span class="n">CrossEncoder</span>

<span class="c1"># Step 1: Retrieve with an embedding model</span>
<span class="n">embedder</span> <span class="o">=</span> <span class="n">SentenceTransformer</span><span class="p">(</span><span class="s2">&quot;Qwen/Qwen3-VL-Embedding-2B&quot;</span><span class="p">,</span> <span class="n">revision</span><span class="o">=</span><span class="s2">&quot;refs/pr/23&quot;</span><span class="p">)</span>

<span class="n">query</span> <span class="o">=</span> <span class="s2">&quot;revenue growth chart&quot;</span>
<span class="n">query_embedding</span> <span class="o">=</span> <span class="n">embedder</span><span class="o">.</span><span class="n">encode_query</span><span class="p">(</span><span class="n">query</span><span class="p">)</span>

<span class="c1"># Pre-compute corpus embeddings (do this once, then store them)</span>
<span class="n">document_screenshots</span> <span class="o">=</span> <span class="p">[</span>
 <span class="s2">&quot;path/to/doc1.png&quot;</span><span class="p">,</span>
 <span class="s2">&quot;path/to/doc2.png&quot;</span><span class="p">,</span>
 <span class="c1"># ... potentially millions of document screenshots</span>
<span class="p">]</span>
<span class="n">corpus_embeddings</span> <span class="o">=</span> <span class="n">embedder</span><span class="o">.</span><span class="n">encode_document</span><span class="p">(</span><span class="n">document_screenshots</span><span class="p">,</span> <span class="n">show_progress_bar</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>

<span class="c1"># Simple cosine similarity retrieval, viable as long as embeddings fit in memory</span>
<span class="n">similarities</span> <span class="o">=</span> <span class="n">embedder</span><span class="o">.</span><span class="n">similarity</span><span class="p">(</span><span class="n">query_embedding</span><span class="p">,</span> <span class="n">corpus_embeddings</span><span class="p">)</span>
<span class="n">top_k_indices</span> <span class="o">=</span> <span class="n">similarities</span><span class="o">.</span><span class="n">argsort</span><span class="p">(</span><span class="n">descending</span><span class="o">=</span><span class="kc">True</span><span class="p">)[</span><span class="mi">0</span><span class="p">][:</span><span class="mi">10</span><span class="p">]</span>

<span class="c1"># Step 2: Rerank the top-k results with a reranker model</span>
<span class="n">reranker</span> <span class="o">=</span> <span class="n">CrossEncoder</span><span class="p">(</span><span class="s2">&quot;nvidia/llama-nemotron-rerank-vl-1b-v2&quot;</span><span class="p">,</span> <span class="n">trust_remote_code</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>

<span class="n">top_k_documents</span> <span class="o">=</span> <span class="p">[</span><span class="n">document_screenshots</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">top_k_indices</span><span class="p">]</span>
<span class="n">rankings</span> <span class="o">=</span> <span class="n">reranker</span><span class="o">.</span><span class="n">rank</span><span class="p">(</span><span class="n">query</span><span class="p">,</span> <span class="n">top_k_documents</span><span class="p">)</span>
<span class="k">for</span> <span class="n">rank</span> <span class="ow">in</span> <span class="n">rankings</span><span class="p">:</span>
 <span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;</span><span class="si">{</span><span class="n">rank</span><span class="p">[</span><span class="s1">&#39;score&#39;</span><span class="p">]</span><span class="si">:</span><span class="s2">.4f</span><span class="si">}</span><span class="se">\t</span><span class="si">{</span><span class="n">top_k_documents</span><span class="p">[</span><span class="n">rank</span><span class="p">[</span><span class="s1">&#39;corpus_id&#39;</span><span class="p">]]</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</span>
</code></pre>
</div>
<p>Since the corpus embeddings are pre-computed, the initial retrieval is fast even over millions of documents. The reranker then provides more accurate scoring over the smaller candidate set.</p>
<h2>Input Formats and Configuration</h2>
<h3>Supported Input Types</h3>
<p>Multimodal models accept a variety of input formats. Here's a summary of what you can pass to <code>model.encode()</code>:</p>
<table>
<thead>
<tr>
<th>Modality</th>
<th>Accepted Formats</th>
</tr>
</thead>
<tbody>
<tr>
<td>Text</td>
<td>- Strings</td>
</tr>
<tr>
<td>Image</td>
<td>- PIL.Image.Image objects<br />- File paths (e.g. "./photo.jpg")<br />- URLs (e.g. "https://.../image.jpg")<br />- Numpy arrays, torch tensors</td>
</tr>
<tr>
<td>Audio</td>
<td>- File paths (e.g. "./audio.wav")<br />- URLs (e.g. "https://.../audio.wav")<br />- Numpy/torch arrays<br />- Dicts with "array" and "sampling_rate" keys<br />- torchcodec.AudioDecoder instances</td>
</tr>
<tr>
<td>Video</td>
<td>- File paths (e.g. "./video.mp4")<br />- URLs (e.g. "https://.../video.mp4")<br />- Numpy/torch arrays<br />- Dicts with "array" and "video_metadata" keys<br />- torchcodec.VideoDecoder instances</td>
</tr>
<tr>
<td>Multimodal</td>
<td>- Dicts mapping modality names to values,<br />e.g. <code>{"text": "a caption", "image": "https://.../image.jpg"}</code><br />Valid keys: "text", "image", "audio", "video"</td>
</tr>
<tr>
<td>Message</td>
<td>- List of message dicts with "role" and "content" keys,<br />e.g. <code>[{"role": "user", "content": [...]}]</code></td>
</tr>
</tbody>
</table>
<h3>Checking Modality Support</h3>
<p>You can check which modalities a model supports using the <code>modalities</code> property and <code>supports()</code> method:</p>
<div class="codehilite">
<pre><span></span><code><span class="kn">from</span> <span class="nn">sentence_transformers</span> <span class="kn">import</span> <span class="n">SentenceTransformer</span>

<span class="n">model</span> <span class="o">=</span> <span class="n">SentenceTransformer</span><span class="p">(</span><span class="s2">&quot;Qwen/Qwen3-VL-Embedding-2B&quot;</span><span class="p">,</span> <span class="n">revision</span><span class="o">=</span><span class="s2">&quot;refs/pr/23&quot;</span><span class="p">)</span>

<span class="c1"># List all supported modalities</span>
<span class="nb">print</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">modalities</span><span class="p">)</span>
<span class="c1"># [&#39;text&#39;, &#39;image&#39;, &#39;video&#39;, &#39;message&#39;]</span>

<span class="c1"># Check for a specific modality</span>
<span class="nb">print</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">supports</span><span class="p">(</span><span class="s2">&quot;image&quot;</span><span class="p">))</span>
<span class="c1"># True</span>
<span class="nb">print</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">supports</span><span class="p">(</span><span class="s2">&quot;audio&quot;</span><span class="p">))</span>
<span class="c1"># False</span>
</code></pre>
</div>
<p>The "message" modality indicates that the model accepts chat-style message inputs with interleaved content. In practice, you rarely need to use this directly. When you pass strings, URLs, or multimodal dicts, the model converts them to the appropriate message format internally. Sentence Transformers supports two message formats:</p>
<ol>
<li><strong>Structured</strong> (most VLMs, e.g. Qwen3-VL): Content is a list of typed dicts, e.g. <code>[{"type": "text", "text": "..."}, {"type": "image", "image": ...}]</code></li>
<li><strong>Flat</strong> (e.g. Deepseek-V3): Content is a direct value, e.g. <code>"some text"</code></li>
</ol>
<p>The format is auto-detected from the model's chat template.</p>
<p>Since all inputs get converted into the same message format internally, you can mix input types in a single <code>encode()</code> call:</p>
<div class="codehilite">
<pre><span></span><code><span class="n">embeddings</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">encode</span><span class="p">([</span>
 <span class="c1"># A text input</span>
 <span class="s2">&quot;A green car parked in front of a yellow building&quot;</span><span class="p">,</span>
 <span class="c1"># An image input (URL)</span>
 <span class="s2">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/car.jpg&quot;</span><span class="p">,</span>
 <span class="c1"># A combined text + image input</span>
 <span class="p">{</span>
 <span class="s2">&quot;text&quot;</span><span class="p">:</span> <span class="s2">&quot;A car in a European city&quot;</span><span class="p">,</span>
 <span class="s2">&quot;image&quot;</span><span class="p">:</span> <span class="s2">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/car.jpg&quot;</span><span class="p">,</span>
 <span class="p">},</span>
<span class="p">])</span>
</code></pre>
</div>
<h3>Processor and Model kwargs</h3>
<p>You may want to control image resolution bounds or model precision. Use <code>processor_kwargs</code> and <code>model_kwargs</code> when loading the model:</p>
<div class="codehilite">
<pre><span></span><code><span class="n">model</span> <span class="o">=</span> <span class="n">SentenceTransformer</span><span class="p">(</span>
 <span class="s2">&quot;Qwen/Qwen3-VL-Embedding-2B&quot;</span><span class="p">,</span>
 <span class="n">model_kwargs</span><span class="o">=</span><span class="p">{</span><span class="s2">&quot;attn_implementation&quot;</span><span class="p">:</span> <span class="s2">&quot;flash_attention_2&quot;</span><span class="p">,</span> <span class="s2">&quot;torch_dtype&quot;</span><span class="p">:</span> <span class="s2">&quot;bfloat16&quot;</span><span class="p">},</span>
 <span class="n">processor_kwargs</span><span class="o">=</span><span class="p">{</span><span class="s2">&quot;min_pixels&quot;</span><span class="p">:</span> <span class="mi">28</span> <span class="o">*</span> <span class="mi">28</span><span class="p">,</span> <span class="s2">&quot;max_pixels&quot;</span><span class="p">:</span> <span class="mi">600</span> <span class="o">*</span> <span class="mi">600</span><span class="p">},</span>
 <span class="n">revision</span><span class="o">=</span><span class="s2">&quot;refs/pr/23&quot;</span><span class="p">,</span>
<span class="p">)</span>
</code></pre>
</div>
<p><code>processor_kwargs</code> controls how inputs are preprocessed (e.g., image resolution bounds). Higher <code>max_pixels</code> means higher quality but more memory and compute. These are</p>

<div class="twitter-share"><a href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fwww.hardwired.dev%2F2026%2F04%2F10%2Fmultimodal-embedding-reranker-models-with-sentence-transformers%2F&#038;via=hessevalentino" class="twitter-share-button">Tweet</a></div><p>The post <a href="https://www.hardwired.dev/2026/04/10/multimodal-embedding-reranker-models-with-sentence-transformers/">Multimodal Embedding & Reranker Models with Sentence Transformers</a> first appeared on <a href="https://www.hardwired.dev">Hard Wired</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Průvodce modely Claude od Anthropic</title>
		<link>https://www.hardwired.dev/2026/03/11/pruvodce-modely-claude-od-anthropic/</link>
		
		<dc:creator><![CDATA[Valentino Hesse OK2HSS]]></dc:creator>
		<pubDate>Wed, 11 Mar 2026 15:26:11 +0000</pubDate>
				<category><![CDATA[AI]]></category>
		<category><![CDATA[agentic AI]]></category>
		<category><![CDATA[AI asistent]]></category>
		<category><![CDATA[AI models comparison]]></category>
		<category><![CDATA[Anthropic]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[API pricing]]></category>
		<category><![CDATA[artificial intelligence]]></category>
		<category><![CDATA[chatbot]]></category>
		<category><![CDATA[claude]]></category>
		<category><![CDATA[claude ai]]></category>
		<category><![CDATA[coding assistant]]></category>
		<category><![CDATA[extended thinking]]></category>
		<category><![CDATA[generativní AI]]></category>
		<category><![CDATA[Haiku]]></category>
		<category><![CDATA[jazykové modely]]></category>
		<category><![CDATA[kódování]]></category>
		<category><![CDATA[kontextové okno]]></category>
		<category><![CDATA[large language models]]></category>
		<category><![CDATA[LLM]]></category>
		<category><![CDATA[machine learning]]></category>
		<category><![CDATA[neural networks]]></category>
		<category><![CDATA[neuronové sítě]]></category>
		<category><![CDATA[Opus]]></category>
		<category><![CDATA[programování]]></category>
		<category><![CDATA[prompt engineering]]></category>
		<category><![CDATA[Sonnet]]></category>
		<category><![CDATA[strojové učení]]></category>
		<category><![CDATA[tokenizace]]></category>
		<category><![CDATA[umela inteligence]]></category>
		<guid isPermaLink="false">https://www.hardwired.dev/?p=2968</guid>

					<description><![CDATA[<p>Průvodce modely Claude od Anthropic Úvod Anthropic je americká firma, která se zabývá vývojem bezpečné AI - jejich hlavní produkt &#62;&#62;&#62;</p>
<p>The post <a href="https://www.hardwired.dev/2026/03/11/pruvodce-modely-claude-od-anthropic/">Průvodce modely Claude od Anthropic</a> first appeared on <a href="https://www.hardwired.dev">Hard Wired</a>.</p>]]></description>
										<content:encoded><![CDATA[<div id="bsf_rt_marker"></div><h1>Průvodce modely Claude od Anthropic</h1>
<h2>Úvod</h2>
<p>Anthropic je americká firma, která se zabývá vývojem bezpečné AI - jejich hlavní produkt je rodina jazykových modelů Claude, v současnosti jedny z nejpokročilejších AI asistentů na trhu, které mají tři hlavní úrovně: <strong>Opus</strong>, <strong>Sonnet</strong> a <strong>Haiku</strong>. Když jsem poprvé začal s těmito modely pracovat, upřímně jsem nevěděl který kdy použít - všechny vypadaly podobně, ale rozdíly v kvalitě výstupu a ceně byly obrovské. V tomhle článku si projdeme co který model umí, kdy ho použít a proč, a sdílím zkušenosti z reálných projektů kde jsem každý z nich testoval.</p>
<hr />
<h2>Architektura rodiny Claude</h2>
<p>Anthropic postavil třístupňovou hierarchii modelů, kde každá úroveň má svoje místo:</p>
<table>
<thead>
<tr>
<th>Model</th>
<th>Charakteristika</th>
<th>Primární využití</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Opus</strong></td>
<td>Nejinteligentnější, nejhlubší uvažování</td>
<td>Komplexní analýzy, výzkum, náročné programování</td>
</tr>
<tr>
<td><strong>Sonnet</strong></td>
<td>Vyvážený výkon a rychlost</td>
<td>Každodenní práce, kódování, většina úloh</td>
</tr>
<tr>
<td><strong>Haiku</strong></td>
<td>Nejrychlejší, nejlevnější</td>
<td>Real-time aplikace, vysoký objem dotazů</td>
</tr>
</tbody>
</table>
<p>Všechny modely používají Constitutional AI framework pro bezpečnost a mají kontextové okno 200 000 tokenů (zhruba 150 000 slov), což v praxi znamená že můžeš nahrát celou kódovou bázi menšího projektu nebo technickou knihu a model si pamatuje všechno. Novější verze Opus a Sonnet nabízejí experimentální podporu až 1 milion tokenů - zkoušel jsem to s kompletní dokumentací ESP-IDF frameworku a fungovalo to překvapivě dobře, i když latence byla znatelně vyšší.</p>
<hr />
<h2>Claude Opus — hluboký myslitel</h2>
<h3>Co je Opus?</h3>
<p>Opus je top tier model od Anthropic - navržený pro úlohy kde potřebuješ hluboké analytické uvažování, komplexní vícekrokové plánování, pokročilé programování a refaktoring, nebo práci s rozsáhlými kontexty jako jsou celé knihy nebo velké kódové báze. Když jsem poprvé testoval Opus na code review komplexní Flask aplikace s asynchronními tasky a Celery workers, byl jsem fascinovaný tím, jak model dokázal propojit souvislosti mezi moduly které byly od sebe vzdálené stovky řádků kódu a identifikovat potenciální race condition, kterou jsem já sám přehlédl.</p>
<h3>Kdy použít Opus?</h3>
<p><strong>Ideální scénáře:</strong></p>
<ol>
<li><strong>Code review před nasazením</strong> — Opus zachytí subtilní chyby jako memory leaky, async bugy nebo chybějící dispose volání, které ostatní modely přehlédnou</li>
<li><strong>Architektonická rozhodnutí</strong> — Při návrhu systémové architektury nebo rozsáhlém refaktoringu</li>
<li><strong>Výzkum a analýza</strong> — Sumarizace celých knih, analýza právních dokumentů, finanční modelování</li>
<li><strong>Agentické workflow</strong> — Dlouhodobé autonomní úlohy vyžadující vícekrokové uvažování</li>
</ol>
<h3>Praktický příklad</h3>
<pre><code>Scénář: Máš komplexní Flask aplikaci s 50+ soubory a potřebuješ identifikovat 
bezpečnostní zranitelnosti.

Proč Opus: Model dokáže udržet kontext celé aplikace, propojit souvislosti mezi 
moduly a identifikovat zranitelnosti typu race condition nebo injection attacks, 
které vyžadují pochopení toku dat napříč celým systémem.</code></pre>
<h3>Cena</h3>
<table>
<thead>
<tr>
<th>Typ</th>
<th>Cena za milion tokenů</th>
</tr>
</thead>
<tbody>
<tr>
<td>Vstupní tokeny</td>
<td>$5</td>
</tr>
<tr>
<td>Výstupní tokeny</td>
<td>$25</td>
</tr>
</tbody>
</table>
<p>Opus 4.5 přinesl výrazné zlevnění oproti předchozím verzím (Opus 4/4.1 stál $15/$75), což zpřístupnilo prémiovou inteligenci širšímu spektru uživatelů - upřímně, při těch starých cenách jsem Opus používal jen na kritické review před nasazením do produkce, protože každý delší prompt stál dost peněz. Teď s novými cenami je to mnohem dostupnější, i když pořád ne na každodenní použití pokud máš omezený budget.</p>
<hr />
<h2>Claude Sonnet — spolehlivý kolega</h2>
<h3>Co je Sonnet?</h3>
<p>Sonnet je vyvážený model - kombinuje vysokou inteligenci s rozumnou rychlostí a cenou, což z něj dělá ideální volbu pro většinu každodenní práce. Většina vývojářů tráví s tímhle modelem nejvíc času, a já nejsem výjimka - odhadem 80 % mých promptů jde na Sonnet, protože pro běžné programování, refaktoring nebo psaní dokumentace je naprosto dostačující a odpovídá rychle.</p>
<h3>Kdy použít Sonnet?</h3>
<p><strong>Ideální scénáře:</strong></p>
<ol>
<li><strong>Každodenní programování</strong> — Vývoj funkcí, práce s více soubory, správa stavu, připojení k API</li>
<li><strong>Analýza a reporting</strong> — Strukturované analýzy, Q&amp;A s dokumenty, vytváření reportů</li>
<li><strong>Kreativní úlohy</strong> — Psaní obsahu, copywriting, technická dokumentace</li>
<li><strong>Orchestrace agentů</strong> — Sonnet vytvoří plán a rozdělí úkoly pro Haiku instance</li>
</ol>
<h3>Praktický příklad</h3>
<pre><code>Scénář: Vyvíjíš React aplikaci s Tailwind CSS a potřebuješ implementovat
autentizaci s Firebase.

Proč Sonnet: Model zvládne multi-file logiku, správu stavu (Riverpod, Redux),
připojení k Firebase a generuje čistý, použitelný kód. Má vynikající výkon
v oblasti frontend/UI vývoje a generuje „pixel-perfect layouts&quot;.

Osobní zkušenost: Když jsem dělal redesign jednoho projektu s Flutter a Material 3,
Sonnet mi vygeneroval kompletní theme configuration včetně custom color schemes
a typography - kód fungoval na první pokus, což mě docela překvapilo protože
Material 3 API je dost komplexní a čekal jsem že budu muset něco ladit.</code></pre>
<h3>Cena</h3>
<table>
<thead>
<tr>
<th>Typ</th>
<th>Cena za milion tokenů</th>
</tr>
</thead>
<tbody>
<tr>
<td>Vstupní tokeny</td>
<td>$3</td>
</tr>
<tr>
<td>Výstupní tokeny</td>
<td>$15</td>
</tr>
</tbody>
</table>
<p>Sonnet nabízí výkon blížící se Opusu za zlomek ceny, což z něj dělá optimální volbu pro 90 % produkčních úloh - a tady je důležité si uvědomit že rozdíl mezi Sonnetem a Opusem není vždycky tak velký jak by se podle ceny mohlo zdát, takže pokud nejdeš do opravdu komplexních analýz nebo kritického code review, Sonnet ti bude stačit.</p>
<hr />
<h2>Claude Haiku — rychlý sprinter</h2>
<h3>Co je Haiku?</h3>
<p>Haiku je nejrychlejší a nejlevnější model v rodině Claude - optimalizovaný pro minimální latenci (odpovědi pod sekundu), vysoký objem dotazů a nákladovou efektivitu. Upřímně, nejdřív jsem Haiku podceňoval a myslel si že je to jen &quot;levná verze&quot; pro lidi co chtějí ušetřit, ale když jsem ho začal používat na rychlé prototypování UI komponent, zjistil jsem že pro tento konkrétní use case je vlastně lepší než Sonnet - odpovídá skoro okamžitě a pro jednoduchý layout kód je kvalita naprosto dostačující.</p>
<h3>Kdy použít Haiku?</h3>
<p><strong>Ideální scénáře:</strong></p>
<ol>
<li><strong>Chatboti a zákaznická podpora</strong> — Real-time odpovědi bez čekání</li>
<li><strong>UI prototypování</strong> — Rychlé generování layoutů a komponent</li>
<li><strong>Klasifikace a moderace obsahu</strong> — Vysokoobjemové úlohy</li>
<li><strong>Paralelní provádění subtasků</strong> — V orchestrovaném workflow s Sonnetem</li>
</ol>
<h3>Praktický příklad</h3>
<pre><code>Scénář: Potřebuješ rychle vytvořit Flutter screen s Material 3 designem.

Proč Haiku: Model vygeneruje layout téměř okamžitě. Pro brainstorming a rychlé
prototypy je ideální volbou. Ale pozor — v delších sessions „ztrácí nit&quot;
a není vhodný pro komplexní logické stavby.

Osobní zkušenost: Zkoušel jsem s Haiku dělat složitější state management
s Riverpod providers a po třech čtyřech iteracích začal generovat kód který
nedával smysl - zapomínal na kontext z předchozích promptů a navrhoval řešení
která byla v rozporu s tím co jsme dělali předtím. Pro jednoduché úlohy super,
ale na komplexní logiku radši Sonnet.</code></pre>
<h3>Cena</h3>
<table>
<thead>
<tr>
<th>Typ</th>
<th>Cena za milion tokenů</th>
</tr>
</thead>
<tbody>
<tr>
<td>Vstupní tokeny</td>
<td>$1</td>
</tr>
<tr>
<td>Výstupní tokeny</td>
<td>$5</td>
</tr>
</tbody>
</table>
<p>Haiku je 5× levnější než Opus na vstupních tokenech, což z něj dělá ekonomickou volbu pro vysokoobjemové scénáře - pokud děláš chatbota nebo zákaznickou podporu kde potřebuješ zpracovat tisíce dotazů denně, rozdíl v ceně mezi Haiku a Sonnetem se rychle nasčítá na stovky dolarů měsíčně.</p>
<hr />
<h2>Srovnávací tabulka modelů</h2>
<table>
<thead>
<tr>
<th>Vlastnost</th>
<th>Opus 4.5</th>
<th>Sonnet 4.5</th>
<th>Haiku 4.5</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Inteligence</strong></td>
<td>Nejvyšší</td>
<td>Vysoká</td>
<td>Dobrá</td>
</tr>
<tr>
<td><strong>Rychlost</strong></td>
<td>Pomalejší</td>
<td>Střední</td>
<td>Nejrychlejší</td>
</tr>
<tr>
<td><strong>Cena (vstup/výstup)</strong></td>
<td>$5/$25</td>
<td>$3/$15</td>
<td>$1/$5</td>
</tr>
<tr>
<td><strong>Kontextové okno</strong></td>
<td>200K (1M beta)</td>
<td>200K (1M beta)</td>
<td>200K</td>
</tr>
<tr>
<td><strong>Max. výstup</strong></td>
<td>64K tokenů</td>
<td>64K tokenů</td>
<td>32K tokenů</td>
</tr>
<tr>
<td><strong>Extended Thinking</strong></td>
<td>✓</td>
<td>✓</td>
<td>✓</td>
</tr>
<tr>
<td><strong>SWE-bench skóre</strong></td>
<td>80.9%</td>
<td>77.2%</td>
<td>73.3%</td>
</tr>
</tbody>
</table>
<hr />
<h2>Orchestrační workflow — jak modely kombinovat</h2>
<p>Když pracuješ na větším projektu, dává smysl kombinovat modely podle jejich silných stránek - tohle je něco co jsem se naučil až po pár měsících práce s Claude, protože na začátku jsem používal jen Sonnet na všechno a nevěděl jsem že můžu ušetřit čas i peníze tím že rozdělím úlohy mezi modely strategicky.</p>
<h3>Fáze 1: Plánování (Sonnet)</h3>
<p>Sonnet analyzuje požadavky, navrhuje architekturu a rozděluje úkoly na paralelizovatelné podúlohy.</p>
<h3>Fáze 2: Implementace (Haiku)</h3>
<p>Více instancí Haiku provádí subtasky paralelně — scaffolding, komponenty, API integrace.</p>
<h3>Fáze 3: Review (Opus)</h3>
<p>Před mergem provede Opus hlubokou revizi — zachytí async bugy, memory leaky a subtilní logické chyby.</p>
<pre><code>Příklad z praxe:

Developer pracuje na mobilní aplikaci:
1. Používá Haiku pro rychlé UI prototypy
2. Přepne na Sonnet pro implementaci business logiky
3. Před releasem nechá Opus udělat finální code review

Výsledek: Opus odhalil rebuild issues a chybějící disposes,
které Haiku i Sonnet přehlédly.

Moje zkušenost: Přesně tenhle workflow jsem použil na jednom Flutter projektu
kde jsem dělal aplikaci pro správu IoT zařízení. Haiku mi vygeneroval asi 15
různých screen layoutů za pár minut, Sonnet implementoval komunikaci s MQTT
brokerem a state management, a Opus pak při finálním review našel memory leak
v subscription handleru který by v produkci způsobil problémy - model si všiml
že StreamSubscription není správně disposed při dispose() widgetu, což by
vedlo k postupnému nárůstu paměti. Tohle by Sonnet pravděpodobně přehlédl.</code></pre>
<hr />
<h2>Rozhodovací strom: Který model zvolit?</h2>
<pre><code>START
  │
  ├── Je úloha časově kritická (real-time)?
  │     └── ANO → HAIKU
  │
  ├── Je to rutinní práce (coding, analýza, psaní)?
  │     └── ANO → SONNET
  │
  ├── Vyžaduje hluboké uvažování nebo rozsáhlý kontext?
  │     └── ANO → OPUS
  │
  ├── Je to finální review před nasazením?
  │     └── ANO → OPUS
  │
  └── Nejste si jistí?
        └── Začněte se SONNET, eskalujte na OPUS při potřebě</code></pre>
<hr />
<h2>Cenové předplatné pro běžné uživatele</h2>
<p>Pro ty, kteří nepoužívají API, nabízí Anthropic předplatné:</p>
<table>
<thead>
<tr>
<th>Plán</th>
<th>Cena</th>
<th>Co zahrnuje</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Free</strong></td>
<td>$0</td>
<td>Základní přístup k Haiku, omezené využití</td>
</tr>
<tr>
<td><strong>Pro</strong></td>
<td>$20/měsíc</td>
<td>Přístup k Opus i Sonnet, vyšší limity, Claude Code</td>
</tr>
<tr>
<td><strong>Max</strong></td>
<td>$100-200/měsíc</td>
<td>Výrazně vyšší limity, prioritní přístup</td>
</tr>
</tbody>
</table>
<hr />
<h2>Praktické tipy pro optimalizaci nákladů</h2>
<h3>1. Začni s Haiku, eskaluj nahoru</h3>
<p>Pro většinu dotazů postačí Haiku - na Sonnet nebo Opus přepni pouze pro složitější úlohy, což ti ušetří peníze a zároveň nezpomalí workflow, protože Haiku odpovídá tak rychle že rozdíl v latenci je znatelný.</p>
<h3>2. Využij Prompt Caching</h3>
<p>Při opakovaném dotazování na stejný kontext (např. velký dokument) snížíš náklady až o 90 % - tohle je obrovská úspora pokud pracuješ s rozsáhlou kódovou bází nebo dokumentací, protože model si cachuje kontext a při dalších dotazech ho nemusí znovu zpracovávat. Zkoušel jsem to s dokumentací k ESP-IDF a rozdíl v ceně byl dramatický - první prompt stál normálně, ale následující dotazy byly skoro zadarmo.</p>
<h3>3. Batch API pro neurgentní úlohy</h3>
<p>Asynchronní zpracování přes Batch API poskytuje 50% slevu na tokeny.</p>
<h3>4. Optimalizuj prompty</h3>
<p>Každý token stojí peníze. Odstraň zbytečný kontext a buď konkrétní.</p>
<hr />
<h2>Závěr</h2>
<p>Každý model v rodině Claude má svoje místo:</p>
<ul>
<li><strong>Opus</strong> je senior architekt — pomalejší, ale nejspolehlivější pro kritické rozhodnutí a hluboké analýzy</li>
<li><strong>Sonnet</strong> je spolehlivý kolega — zvládne 90 % každodenní práce kvalitně a efektivně, což z něj dělá můj go-to model</li>
<li><strong>Haiku</strong> je rychlý junior — ideální pro opakované úlohy a prototypování, překvapivě schopný pokud víš jak ho použít</li>
</ul>
<p>Nejde o to používat jeden model na všechno. Jde o to strategicky kombinovat jejich silné stránky podle toho, co zrovna potřebuješ - a tohle pochopení přišlo až s praxí, protože na začátku jsem dělal chybu že jsem používal Sonnet i na úlohy kde by Haiku stačil, nebo naopak jsem se snažil ušetřit a používal Sonnet na code review kde by Opus odvedl mnohem lepší práci. Teď po několika měsících práce s těmito modely mám docela dobrý cit kdy který použít, a doufám že tento článek ti pomůže zkrátit tu learning curve.</p>
<hr />
<h2>Zdroje a další čtení</h2>
<ul>
<li><a href="https://docs.anthropic.com">Anthropic dokumentace</a></li>
<li><a href="https://claude.ai">Claude.ai</a></li>
<li><a href="https://claude.com/pricing">API cenový přehled</a></li>
</ul>
<hr />
<p><em>Pro opravu diakritiky a překlepů byl použit model Claude Sonnet 4.5.</em></p>
<p><em>Článek aktualizován: březen 2026</em></p>

<div class="twitter-share"><a href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fwww.hardwired.dev%2F2026%2F03%2F11%2Fpruvodce-modely-claude-od-anthropic%2F&#038;via=hessevalentino&#038;related=hessevalentino%3AValentino%20Hesse%20OK2HSS" class="twitter-share-button">Tweet</a></div><p>The post <a href="https://www.hardwired.dev/2026/03/11/pruvodce-modely-claude-od-anthropic/">Průvodce modely Claude od Anthropic</a> first appeared on <a href="https://www.hardwired.dev">Hard Wired</a>.</p>]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
