<?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 Jenny on Medium]]></title>
        <description><![CDATA[Stories by Jenny on Medium]]></description>
        <link>https://medium.com/@jenny_64810?source=rss-36858916ee53------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*u4QrRB-zeiEM8OXR</url>
            <title>Stories by Jenny on Medium</title>
            <link>https://medium.com/@jenny_64810?source=rss-36858916ee53------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 09:59:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jenny_64810/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[Vibe Tooning (formerly “Sentence-to-Toon”) Renewal: LLM SceneJSON + Vector Search…]]></title>
            <link>https://medium.com/toonsquare-tech/vibe-tooning-formerly-sentence-to-toon-renewal-llm-scenejson-vector-search-6fa369e0fc4e?source=rss-36858916ee53------2</link>
            <guid isPermaLink="false">https://medium.com/p/6fa369e0fc4e</guid>
            <category><![CDATA[vector-database]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[search-engines]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Jenny]]></dc:creator>
            <pubDate>Mon, 11 May 2026 00:41:01 GMT</pubDate>
            <atom:updated>2026-05-11T09:29:06.337Z</atom:updated>
            <content:encoded><![CDATA[<h3>Vibe Tooning (formerly “Sentence-to-Toon”) Renewal: LLM SceneJSON + Vector Search (lexical/semantic)</h3><h3>1. Feature Introduction</h3><p>“Sentence-to-Toon” is a feature that automatically composes the elements needed for a single editor page based on a sentence the user types.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*hsB4mfwBHlKGM7pM5Z_edg.gif" /><figcaption>e.g. Sera is walking a dog in the park. “The weather is great today!”</figcaption></figure><p>For example, if the user enters:</p><blockquote>Sera is walking a dog in the park. “The weather is great today!”</blockquote><p>the page can be composed by selecting:</p><ul><li><strong>Background</strong>: a park</li><li><strong>Character</strong>: Sera</li><li><strong>Character action</strong>: walking / taking a walk</li><li><strong>Prop / effect</strong>: a dog</li><li><strong>Speech bubble / narration</strong>: a speech bubble — “The weather is great today!” / a narration bubble — “Sera is walking a dog in the park.”</li></ul><p>In other words, the core of this feature is to “understand the sentence,” pick the right assets, and place them naturally on the canvas.</p><p>I renewed the previous NER-based approach into an **LLM-based scene understanding + vector document search + reranking** architecture.</p><h3>2. Previous Approach (AS-IS): Khaiii and Google NLP</h3><p>Before the renewal, we combined NLP analyzers to extract clues from the sentence and then queried resources from the DB.</p><ul><li><strong>Khaiii (morphological analysis)</strong>: a tool that splits Korean text into morphemes/parts-of-speech to obtain signals like “noun/verb/particle.”</li><li><strong>Google NLP (entity &amp; syntax analysis)<br></strong>Entity analysis : extracts entities such as PERSON (people) and LOCATION (places)<br>Syntax analysis : estimates sentence structure (dependency relations)</li></ul><p>This approach was useful for getting signals like “person/place,” but it had clear limits as a product feature.</p><ul><li><strong>Too much randomness<br></strong>When multiple candidates existed, the system often picked one at random (character/action/background), producing inconsistent results.</li><li><strong>Hard to handle multiple utterances / narrations<br></strong>If quotation marks didn’t match or there were multiple utterances, simple splitting logic would easily break.</li><li><strong>Fragile layout (coordinates)<br></strong>When the character position wasn’t determined well, bubbles/items also became unstable, leading to unnatural or overlapping layouts.</li></ul><p>In short, “text analysis” was possible, but it was hard to reliably perform full <strong>scene design (composition + placement + slot separation)</strong>.</p><h3>3. Improved Approach (TO-BE): OpenAI Vector Store + lexical/semantic search</h3><p>The direction of the renewal was straightforward:</p><p>1) Structure the sentence into a Scene first,<br>2) Search resources using structured queries,<br>3) Stabilize the final choice through scoring (reranking).</p><h4>3.1. Scene JSON generated by an LLM</h4><p>In TO-BE, an LLM first generates a <strong>Scene JSON</strong>.<br>Scene JSON does <strong>not</strong> include DB resource IDs directly.<br>Instead, it contains only “searchable query strings + layout information (position/scale),” such as:</p><ul><li>backgroundQuery : query for background search</li><li>characters[] : character slots (label, character query, pose query, position/scale, etc.)</li><li>foregroundItems[] : prop/effect/bubble slots</li><li>speeches[] : an array of utterances (can be multiple)</li><li>descriptions[] : an array of narrations (can be multiple)</li></ul><p>The key safety device here is a <strong>JSON Schema</strong>.</p><blockquote><strong>What is JSON Schema?</strong></blockquote><blockquote>It’s a set of rules that enforces “which keys/types the output JSON must have.”<br>Since LLM outputs are flexible by nature, fixing the shape with a schema improves stability.</blockquote><p>Additionally, even if the LLM response fails or JSON parsing fails, the feature should not stop.</p><p>So we added a fallback Scene JSON generation path (e.g., extracting utterances from quotation marks) to guarantee minimum behavior.</p><h4>3.2. Building vector documents (VectorDocs): indexing DB resources as searchable documents</h4><p>Next comes the search infrastructure.</p><p>We take metadata for DB resources (backgrounds, items, bubbles, effects, characters, character actions), <br>transform them into asset-group-specific <strong>JSONL(VectorDocs)</strong> search documents,<br>upload them to S3,<br>and attach the files to an OpenAI Vector Store.</p><p>Search documents are typically designed by separating <strong>content</strong> and <strong>metadata</strong>.</p><blockquote><strong>What is content?</strong></blockquote><blockquote>‘content’ is the main text that gets embedded (text → numeric vector). It’s used directly to compute semantic similarity between the query and candidates. That’s why we put “search hints” such as tags and captions that help semantic matching into content.</blockquote><blockquote><strong>What is metadata?</strong></blockquote><blockquote>‘metadata’ is structured fields that are not embedded, so it doesn’t directly participate in semantic similarity calculation. Instead, it’s used for filtering, post-processing, and for looking up the real resource in the DB after search. High-level categories or stable identifiers like <em>sourceId, </em><em>id, </em><em>characterId, </em><em>category_ko, </em><em>name_ko, </em><em>sourceType</em>belong here.</blockquote><p>Why do we need both?</p><ul><li>With only ‘content’ : semantic matching works, but strict constraints like “only this specific character” (e.g., for pose search) become weak.</li><li>With only ‘metadata’ : filtering is strong, but natural-language semantic matching becomes weak.</li></ul><p>So the most stable combination was <strong>content(meaning) + metadata (constraints/identifiers)</strong>.</p><h4>3.3. Runtime search: lexical candidate narrowing + semantic reranking</h4><p>TO-BE runtime search does not “search the Vector Store directly.”<br>Instead, we check the `objectKey` from the DB table that stores VectorDocs state, load and cache the JSONL from S3, and perform candidate collection and reranking on the server side.</p><p>We mix two types of search:</p><ul><li><strong>Lexical search (word-based) </strong>: narrows candidates using token matches (exact match / includes match)</li><li><strong>Semantic search (meaning-based) </strong>: reorders candidates using embeddings + cosine similarity</li></ul><p>With per-asset-group policies:</p><ul><li>some asset groups skip semantic reranking when lexical matches are strong enough (to reduce cost/latency),</li><li>while others use semantic search more aggressively to handle diverse expressions.</li></ul><p>Also, we don’t finalize a resource directly from search output.</p><p>The server re-queries the DB and validates publish/status conditions before the final decision.</p><p>This step is essential to avoid “the search was correct, but an unpublished/invalid resource got mixed in.”</p><h4>3.4. Operational stability: tracking document state in DB + REST trigger</h4><p>In production environments, vector documents must be refreshed periodically.<br>So we track document state in a DB table, including:</p><ul><li><em>fileId</em> attached in the Vector Store</li><li>the latest <em>updatedDate</em> per asset group (for incremental updates)</li><li><em>content</em> hash (to detect document content changes)</li><li>S3 file name (<em>objectKey</em>)</li></ul><p>This makes it possible to consistently determine “which document is connected in production” and “when/what changed,” greatly improving automation and debugging stability.</p><p>We also provide a REST trigger for periodic execution in production, so batch execution is not tied only to scripts and can be safely invoked in a server environment.</p><p>This structure wasn’t something I had perfectly designed from day one — during review, teammates suggested practical improvements like “keep documents in S3 and track state in DB” and “provide a REST trigger for production.”</p><p>Thanks to their feedback and careful review, we were able to finish with a much more robust design. I’m sincerely grateful to everyone who helped.</p><h3>4. What we tried (and learned)</h3><h4>4.1. Trying English caption preprocessing (moondream, etc.) to improve bubble search quality</h4><p>Because it can be hard to distinguish bubble “usage” using tags alone, we tried generating English captions with an image captioning model (such as moondream) and mixing them into semantic search.</p><p>The conclusion was “slightly better than nothing,” but the impact wasn’t large enough compared to the cost/complexity.</p><p>So we settled on a simpler baseline: <strong>DB tag-based search + excluding meaningless tags.</strong></p><h4>4.2. Returning immediately (early return) as soon as a similar resource is found</h4><p>To increase search speed, we also tried an “early return” approach: if a similar resource is found, return it immediately.</p><p>It did make things faster, but for characters and props, the “first plausible hit” was often wrong, and accuracy dropped frequently.</p><p>In the end, collecting a set of candidates and then picking the final one through scoring (reranking) was more advantageous for quality and stability.</p><h3>5. Output</h3><h4>5.1. Comparing results</h4><p>After the renewal, these improvements were especially noticeable. The results below are AS-IS first, then TO-BE.</p><ul><li>More cases where matching works based on “traits,” even without explicitly naming the character</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BoG3NfhkquKejFnNzsun-g.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xnGtBWhHKN2e4FJ-cF4lFA.jpeg" /><figcaption>e.g. A man wearing jeans is hailing a taxi on the street. “Excuse me~”</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pFNX1DDSR50LhWrdFIA9fw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_IburkDfpL-P3nZuXA-tDg.jpeg" /><figcaption>A police officer is directing traffic on the road.</figcaption></figure><ul><li>Speech bubbles can be generated as an array when there are multiple utterances</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L4qx7Ov12zIjbnQa_Wnlfg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hqb4Sd9kQ6tZ-KousdSqHQ.jpeg" /><figcaption>A bear and a rabbit are talking in the forest. “Rabbit, where are you going?” “I’m out for a walk~” “Can I come with you?” “Sure!”</figcaption></figure><h4>5.2. Improvements</h4><p>The biggest change in this renewal is that the structure itself moved from “extracting a few clues from text” to “designing a whole scene and searching/finalizing resources based on that design.”</p><p>In AS-IS, the flow branched heavily depending on Khaiii/Google NLP NER signals, and randomness was easy to introduce when multiple candidates existed.<br>In TO-BE, the LLM first organizes searchable queries and layout information (position/scale) as Scene JSON, and then the server runs a pipeline of asset-group search → candidate collection → reranking → DB re-query for finalization.<br>This makes results more consistent and also supports input shapes like multiple utterances/narrations in a more structural way.</p><p>On the search side, we separated lexical and semantic and took the strengths of each: lexical (word-based) quickly narrows candidates, while semantic (embedding-based) reranks to compensate when expressions differ. We also introduced per-asset-group policies to balance cost/latency and quality by deciding whether to trust lexical first or lean more on semantic.</p><p>Operationally, keeping search documents in S3 and tracking document state in DB enabled incremental updates. Providing a REST trigger also made it possible to refresh documents periodically in deployed environments in a stable way.</p><h3>6. What’s still left to improve</h3><p>There are still clear next steps.</p><p>Search quality depends heavily on data quality, and for props or character actions, many resources have duplicated or sparse tags, causing “sentence → correct resource” matching to wobble at times.</p><p>Over time, improving preprocessing pipelines — caption generation, tag normalization, and standardizing category/name — will be important to sustainably improve quality.</p><p>For speech bubbles, selection is still largely tag-based, so there’s a lot of room to structure “semantic attributes” such as purpose (speech/narration/inner voice), tail direction, and color/style, and to reflect them in search and selection.</p><p>Finally, Scene JSON generation assumes a default canvas size in some parts. If we pass the actual page width/height as input and expand layout rules accordingly, results should look more natural across different templates and resolutions.</p><h3>References</h3><p><a href="https://arxiv.org/html/2403.01248v1">SceneCraft: An LLM Agent for Synthesizing 3D Scene as Blender Code</a><br><a href="https://arxiv.org/html/2509.04481v1#S1">Narrative-to-Scene Generation: An LLM-Driven Pipeline for 2D Game Environments</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6fa369e0fc4e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/toonsquare-tech/vibe-tooning-formerly-sentence-to-toon-renewal-llm-scenejson-vector-search-6fa369e0fc4e">Vibe Tooning (formerly “Sentence-to-Toon”) Renewal: LLM SceneJSON + Vector Search…</a> was originally published in <a href="https://medium.com/toonsquare-tech">toonsquare.tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[바이브 투닝(구 문장으로 툰 생성) 리뉴얼: LLM SceneJSON과 벡터 검색(lexical/semantic)]]></title>
            <link>https://medium.com/toonsquare-tech/%EB%B0%94%EC%9D%B4%EB%B8%8C-%ED%88%AC%EB%8B%9D-%EA%B5%AC-%EB%AC%B8%EC%9E%A5%EC%9C%BC%EB%A1%9C-%ED%88%B0-%EC%83%9D%EC%84%B1-%EB%A6%AC%EB%89%B4%EC%96%BC-llm-scenejson%EA%B3%BC-%EB%B2%A1%ED%84%B0-%EA%B2%80%EC%83%89-lexical-semantic-1d87e2abd161?source=rss-36858916ee53------2</link>
            <guid isPermaLink="false">https://medium.com/p/1d87e2abd161</guid>
            <category><![CDATA[vector-database]]></category>
            <category><![CDATA[search-engines]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Jenny]]></dc:creator>
            <pubDate>Thu, 07 May 2026 10:31:33 GMT</pubDate>
            <atom:updated>2026-05-11T07:39:28.401Z</atom:updated>
            <content:encoded><![CDATA[<h3>1. 기능 소개</h3><p>‘문장으로 툰 생성’은 사용자가 입력한 문장을 바탕으로 에디터에서 <strong>한 페이지에 들어갈 요소를 자동으로 구성</strong>해주는 기능입니다.</p><figure><img alt="예시: 세라가 공원에서 강아지랑 산책하고 있다. ‘오늘 날씨 좋다!’" src="https://cdn-images-1.medium.com/max/1000/1*v7w0_AGzIynWD_gUvfRKyQ.gif" /><figcaption>예시: <em>세라가 공원에서 강아지랑 산책하고 있다. ‘오늘 날씨 좋다!’</em></figcaption></figure><p>예를 들어 사용자가 아래 문장을 입력하면,</p><blockquote><em>세라가 공원에서 강아지랑 산책하고 있다. ‘오늘 날씨 좋다!’</em></blockquote><ul><li><strong>배경 </strong>: 공원</li><li><strong>캐릭터 </strong>: 세라</li><li><strong>캐릭터 동작 </strong>: 산책하다/걷다</li><li><strong>소품/효과 </strong>: 강아지</li><li><strong>말풍선/나레이션 </strong>: 대사 말풍선 — “오늘 날씨 좋다!” / 나레이션 말풍선 — “세라가 공원에서 강아지랑 산책하고 있다.”</li></ul><p>으로 페이지를 구성합니다.</p><p>이 기능의 핵심은 문장을 이해해서 적절한 리소스를 고르고, 화면에 자연스럽게 배치하는 것입니다.</p><p>저는 기존 NER 기반 구조를 <strong>LLM 기반 장면 이해 + 벡터 문서 검색/재랭킹</strong> 구조로 리뉴얼했습니다.</p><h3>2. 기존 방식(AS-IS): Khaiii와 Google NLP</h3><p>리뉴얼 전에는 자연어 분석기를 조합해 <strong>문장에서 단서를 추출</strong>한 뒤, DB에서 리소스를 조회하는 방식이었습니다.</p><ul><li><strong>Khaiii(형태소 분석)</strong>: 한국어 문장을 형태소/품사 단위로 쪼개서 “명사/동사/조사” 같은 정보를 얻는 도구</li><li><strong>Google NLP(엔티티/구문 분석)<br>- </strong>엔티티 분석: 사람(PERSON), 장소(LOCATION) 같은 개체를 뽑는 기능<br>- 구문 분석: 문장 구조(의존 관계)를 추정하는 기능</li></ul><p>이 방식은 “사람/장소” 같은 신호를 얻는 데는 유용했지만, 실제 제품 기능으로 돌리기에는 한계가 있었습니다.</p><ul><li><strong>랜덤 선택이 많음<br></strong>후보가 여러 개면 랜덤 선택(캐릭터/동작/배경 등)으로 이어져 결과가 들쭉날쭉해졌습니다.</li><li><strong>다중 발화/나레이션 처리 한계<br></strong>따옴표 쌍이 맞지 않거나 대사가 여러 개인 문장은 분리 로직이 쉽게 깨졌습니다.</li><li><strong>배치(좌표) 로직의 취약함<br></strong>캐릭터 위치가 명확하지 않으면 말풍선/요소도 함께 흔들리는 구조가 되어 화면이 부자연스럽거나 겹치는 문제가 생겼습니다.</li></ul><p>요약하자면 “텍스트 분석”은 가능했지만,<br>“장면 설계(구도 + 배치 + 슬롯 분리)”까지 안정적으로 수행하기 어려웠습니다.</p><h3>3. 개선된 방식(TO-BE): OpenAI Vector Store와 lexical/semantic 검색</h3><p>리뉴얼의 방향은 단순했습니다.</p><blockquote><em>문장을 먼저 장면(Scene)으로 </em><strong><em>구조화</em></strong><em>하고,<br>구조화된 쿼리로 리소스를 </em><strong><em>검색</em></strong><em>한 뒤,<br>점수화</em><strong><em>(재랭킹)</em></strong><em>로 최종 선택을 안정화한다.</em></blockquote><h4>3.1. LLM이 만드는 Scene JSON</h4><p>TO-BE에서는 LLM이 먼저 <strong>Scene JSON</strong>을 생성합니다.<br>Scene JSON에는 DB에 있는 리소스 ID를 직접 넣지 않습니다.<br>대신 아래처럼 <strong>“검색용 쿼리 문자열 + 배치 정보(좌표/스케일)”</strong>만 포함합니다.</p><ul><li>backgroundQuery : 배경 검색용 쿼리</li><li>characters[] : 캐릭터 슬롯(라벨, 캐릭터 쿼리, 포즈 쿼리, 좌표/스케일 등)</li><li>foregroundItems[] : 소품/효과/말풍선 슬롯</li><li>speeches[] : 대사 배열(여러 개 가능)</li><li>descriptions[] : 나레이션 배열(여러 개 가능)</li></ul><p>여기서 중요한 장치가 <strong>JSON 스키마(JSON Schema</strong>)입니다.</p><blockquote><strong><em>JSON 스키마</em></strong><em>란?<br>“출력 JSON은 어떤 키/타입을 가져야 한다”를 강제하는 규칙입니다.<br>LLM 출력은 자유도가 크기 때문에, 스키마로 형태를 고정해 안정성을 높였습니다.</em></blockquote><p>추가로 LLM 응답이 실패하거나 파싱 실패에도 기능이 멈추지 않도록 <strong>fallback Scene JSON </strong>생성 로직(예: 따옴표 기반 대사 추출)을 둬서 최소 동작을 보장했습니다.</p><h4>3.2. 벡터 문서(VectorDocs) 구축: DB 리소스를 검색 문서로 가공</h4><p>다음 단계는 검색 인프라입니다.</p><p>DB의 배경/소품/말풍선/효과/캐릭터/캐릭터 동작 리소스들의 메타 데이터를</p><ul><li>자산군별로 JSONL(VectorDocs)로 가공하여 검색 문서를 만들고</li><li>S3에 업로드한 뒤</li><li>OpenAI Vector Store에는 해당 파일을 attach합니다.</li></ul><p>검색 문서는 일반적으로 <strong>content</strong>와 <strong>metadata</strong>를 분리해 설계합니다.</p><blockquote><strong><em>content</em></strong><em>란?</em><strong><em><br></em></strong><em>임베딩(텍스트를 숫자 벡터로 변환)되는 본문 텍스트로, 검색할 때 질의 문장과의 </em><strong><em>의미 유사도</em></strong><em>를 계산하는 데 직접 사용됩니다. 그래서 태그(tags)처럼 “검색 힌트”가 되는 텍스트나 캡션처럼 의미 매칭에 도움이 되는 내용을 주로 content에 넣습니다.</em></blockquote><blockquote><strong><em>metadata</em></strong><em>란?<br>임베딩되지 않는 구조화된 필드로, 의미 유사도 계산 자체에는 직접 쓰이지 않습니다. 대신 검색 결과를 좁히거나</em><strong><em>(필터링)</em></strong><em>, 후처리를 하거나 최종적으로 DB에서 실제 리소스를 다시 조회할 때 필요한 식별자/속성 정보로 사용됩니다.<br></em><em>sourceId, </em><em>id, </em><em>characterId, </em><em>category_ko, </em><em>name_ko, </em><em>sourceType 같은 대분류나 고유한 값들이 여기에 해당합니다.</em></blockquote><p>왜 둘 다 필요할까요?</p><ul><li>content만 있으면: 의미 검색은 가능하지만 캐릭터의 동작 검색 시 원하는 “특정 캐릭터만” 같은 <strong>정확한 제약</strong>이 약합니다.</li><li>metadata만 있으면: 필터는 강하지만 <strong>자연어 의미 매칭</strong>이 약합니다.</li></ul><p>그래서 content(의미) + metadata(제약/식별) 조합이 가장 안정적이었습니다.</p><h4>3.3. 런타임 검색: lexical 후보 축소 + semantic 재랭킹</h4><p>TO-BE의 런타임 검색은 “Vector Store 자체를 바로 검색”하는 형태가 아니라,</p><p>Vector Docs의 상태를 저장하고있는 DB에서 <em>objectKey</em>를 확인해 S3의 JSONL을 로드 및 캐시하고, 서버에서 후보 수집과 재랭킹을 수행하는 구조입니다.</p><p>이때 두 종류의 검색을 섞습니다.</p><ul><li><strong>lexical 검색</strong>(단어 기반 검색)<br>토큰 매칭(exact: 정확 일치/tokenOr: 포함 일치)으로 후보를 좁히는 방식</li><li><strong>semantic 검색</strong>(의미 기반 검색)<br>임베딩 + 코사인 유사도(cosine similarity)로 “의미가 가까운 후보”를 재정렬하는 방식</li></ul><p>자산군별로 정책을 둬서,<br>어떤 자산군은 lexical이 충분히 맞으면 semantic을 생략해 비용/지연을 줄이고<br>어떤 자산군은 semantic을 적극 활용해 표현 다양성을 흡수하는 식으로 구성했습니다.</p><p>또한 검색 결과로 곧장 리소스를 확정하지 않고,<br>서버가 DB를 다시 조회해 리소스의 publish와 status 조건을 검증한 뒤 최종 확정합니다.</p><p>이 단계가 있어야 “검색은 맞았지만 비공개/비정상 리소스가 섞이는 문제”를 막을 수 있습니다.</p><h4>3.4. 운영 안정성: 문서 상태 DB 추적 + REST 트리거</h4><p>운영 환경에서는 벡터 문서를 주기적으로 갱신해야 하므로 문서들의 상태를 DB 테이블로 추적합니다. 해당 테이블은 다음과 같이 이루어져있습니다:</p><ul><li>Vector Store에 저장된 fileId</li><li>증분 판단을 위한 각 자산군별 DB의 가장 최신 updatedDate</li><li>문서 내용 변경 여부를 확인하기위한 content 해시</li><li>S3에 저장된 파일명</li></ul><p>이를 통해 “어떤 문서가 현재 운영에 연결돼 있는지”와 “언제/무엇이 바뀌었는지”를 일관된 기준으로 판단할 수 있어, 운영 자동화와 디버깅이 훨씬 안정적이 되었습니다.</p><p>또한 운영 환경에서는 주기적 실행을 위해 REST 트리거를 제공합니다. 배치 실행을 스크립트에만 의존하지 않고 서버 환경에서도 안전하게 호출할 수 있도록 구성했습니다.</p><p>이 구조는 제가 처음부터 완성 형태로 떠올린 것이 아니라 리뷰 과정에서 팀원들이 “문서는 S3에 두고 상태는 DB로 관리하자”, “운영에서는 REST로도 트리거할 수 있게 하자” 같은 실질적인 개선 의견을 주면서 정리된 방향입니다.<br>좋은 피드백과 검토 덕분에 훨씬 탄탄한 형태로 마무리할 수 있었습니다. 도움 주신 팀원들께 감사의 말씀을 전합니다.</p><h3>4. 시행착오</h3><h4>4.1. 말풍선 검색 품질을 위해 영어 캡션 생성 전처리 시도</h4><p>말풍선은 “용도”를 태그만으로 구분하기 어려운 경우가 있어서 moondream과 같은 이미지 캡셔닝 모델로 영어 캡션을 만들고 semantic 검색에 섞는 실험을 했습니다.</p><p>결론은 “없는 것보단 약간 나음” 수준이었지만, 비용/복잡도 대비 효과가 크지 않아 최종적으로는 기본 전략을 <strong>DB 태그 기반 + 의미 없는 태그 제외</strong>로 정리했습니다.</p><h4>4.2. “즉시 반환(early return)” 방식으로 유사 리소스를 찾자마자 반환</h4><p>검색 속도를 올리기 위해 “유사한 리소스를 찾으면 즉시 반환”하는 접근도 시도했습니다.</p><p>확실히 빨라지는 장점이 있었지만, 캐릭터와 소품에서 처음 걸린 그럴듯한 후보가 오답인 케이스가 많아져 정확도가 떨어지는 문제가 자주 발생했습니다.</p><p>결국 후보를 일정량 모아 <strong>점수화(재랭킹)로 최종 선택</strong>하는 방식이 품질과 안정성 측면에서 더 유리했습니다.</p><h3>5. 결과물</h3><h4>5.1. 생성 결과 비교</h4><p>리뉴얼 이후에는 다음 변화가 특히 체감되었습니다. 아래 결과는 순서대로 AS-IS와 TO-BE입니다.</p><ul><li>캐릭터 명칭을 정확히 언급하지 않아도 “특성”으로 매칭되는 경우 증가</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lKM1YOYt22sm7lr7mbFHtg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nXouap74IB6kalXX8u7-bg.jpeg" /><figcaption>청바지를 입은 남자가 길거리에서 택시를 잡고 있다. “저기요~”</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FMhFzzCA0LFeDgVvKObqpw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YrpSaLO8_05VH9tC87-1-w.jpeg" /><figcaption>경찰이 도로에서 교통정리를 하고 있다.</figcaption></figure><ul><li>발화가 여러 개인 문장에서 대사를 배열로 분리해 말풍선 여러 개 생성 가능</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5O9WLOkxfOzwKaqNSlfFQA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_bN_npp0dCar3OSwQqFHXA.jpeg" /><figcaption>토끼와 곰이 숲속에서 대화를 나누고 있다. “토끼야, 어디가?” “산책하는 중이야~” “나도 같이 가도 돼?””그럼!”</figcaption></figure><h4>5.2. 개선 사항</h4><p>이번 리뉴얼의 가장 큰 변화는 “문장을 분석해서 몇 가지 단서를 뽑는 기능”에서 “문장을 하나의 장면으로 설계하고 그 설계를 기준으로 리소스를 검색하고 확정하는 기능”으로 구조 자체가 바뀌었다는 점입니다.</p><p>기존 AS-IS에서는 Khaiii·Google NLP 기반 NER 결과에 의존해 흐름이 분기되고, 후보가 여러 개일 때는 랜덤 선택이 섞이기 쉬웠습니다.<br>TO-BE에서는 LLM이 Scene JSON을 만들어 <strong>검색용 쿼리와 배치 정보(좌표/스케일)를 먼저 정리</strong>하고, 서버가 그 슬롯을 따라 <strong>자산군별 검색 → 후보 수집 → 재랭킹 → DB 재조회로 확정</strong>하는 파이프라인으로 동작합니다.<br>덕분에 결과가 더 일관되고, 다중 발화/설명 같은 입력 형태도 구조적으로 처리할 수 있게 되었습니다.</p><p>검색 측면에서는 lexical과 semantic을 분리해 각각의 장점을 가져갔습니다. lexical(단어 기반)은 빠르게 후보를 줄이고, semantic(임베딩 기반)은 표현이 달라도 의미가 가까운 후보를 재랭킹해 품질을 보완합니다. 자산군마다 “lexical을 먼저 믿을지, semantic을 더 활용할지” 정책을 두어 비용 및 지연과 품질 사이의 균형도 잡았습니다.</p><p>운영 측면에서는 검색 문서를 레포지토리에 들고 있지 않고 S3에 보관하며, 문서 상태를 DB로 추적해 증분 업데이트가 가능해졌습니다. 또한 운영에서 주기적으로 인덱싱을 돌릴 수 있도록 REST 트리거를 제공해, 배포 환경에서도 문서 갱신을 안정적으로 수행할 수 있게 되었습니다.</p><h3>6. 남은 개선점</h3><p>다만 아직 남은 과제도 분명합니다.</p><p>검색 품질은 결국 데이터 품질에 크게 좌우되는데, <strong>소품이나 캐릭터 동작의 경우 태그가 중복되거나 빈약한 리소스</strong>가 많아 “문장 → 정확한 리소스” 매칭이 흔들리는 순간이 있습니다.<br>이 부분은 캡션 생성, 태그 정규화, 카테고리/이름의 표준화 같은 전처리 파이프라인을 더 탄탄하게 가져가야 장기적으로 품질이 올라갑니다.</p><p><strong>말풍선도 현재는 태그 중심</strong>으로 선택되다 보니 용도(대사/나레이션/속마음), 말풍선의 꼬리 방향, 색상이나 스타일 같은 “의미적 속성”을 더 구조화해 검색과 선택에 반영할 여지가 큽니다.</p><p>마지막으로 Scene JSON 생성은 기본 캔버스 크기를 가정하는 부분이 있어 <strong>실제 페이지의 width/height를 입력으로 반영</strong>하고 배치 규칙을 확장하면 다양한 템플릿과 해상도에서도 결과가 더 자연스러워질 것입니다.</p><h3>참고 문헌</h3><p><a href="https://arxiv.org/html/2403.01248v1">SceneCraft: An LLM Agent for Synthesizing 3D Scene as Blender Code</a><br><a href="https://arxiv.org/html/2509.04481v1#S1">Narrative-to-Scene Generation: An LLM-Driven Pipeline for 2D Game Environments</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1d87e2abd161" width="1" height="1" alt=""><hr><p><a href="https://medium.com/toonsquare-tech/%EB%B0%94%EC%9D%B4%EB%B8%8C-%ED%88%AC%EB%8B%9D-%EA%B5%AC-%EB%AC%B8%EC%9E%A5%EC%9C%BC%EB%A1%9C-%ED%88%B0-%EC%83%9D%EC%84%B1-%EB%A6%AC%EB%89%B4%EC%96%BC-llm-scenejson%EA%B3%BC-%EB%B2%A1%ED%84%B0-%EA%B2%80%EC%83%89-lexical-semantic-1d87e2abd161">바이브 투닝(구 문장으로 툰 생성) 리뉴얼: LLM SceneJSON과 벡터 검색(lexical/semantic)</a> was originally published in <a href="https://medium.com/toonsquare-tech">toonsquare.tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>