graph { graph [engine:dot rankdir:LR clusterize:true] LLM_Tagger -> Quick_Start [reverse: false] LLM_Tagger -> All_Commands [reverse: false] LLM_Tagger -> Workflows [reverse: false] Workflows -> Workflow_1__Single_Level_Tagging [reverse: false] Workflows -> Workflow_2__Hierarchical_Tagging [reverse: false] Workflows -> Workflow_3__Multiple_Subsets [reverse: false] Workflows -> Workflow_4__Multiple_Subsets___Hierarchy [reverse: false] LLM_Tagger *= Performance_Changes [reverse: false] Performance_Changes *= 1__Parallel_Tag_Extraction [reverse: false] Performance_Changes *= 2__Connection_Pooling [reverse: false] Performance_Changes *= 3__Parallel_Embedding [reverse: false] Performance_Changes *= 4__HDBSCAN_Multi_core [reverse: false] LLM_Tagger *= Two_Phase_Architecture [reverse: false] Two_Phase_Architecture *= Phase_1__init_total_ndjson [reverse: false] Two_Phase_Architecture *= Phase_2__educe_tags_subset_ndjson [reverse: false] Two_Phase_Architecture *= Benefits [reverse: false] LLM_Tagger *= Hierarchical_Tagging [reverse: false] Hierarchical_Tagging *= Workflow [reverse: false] Hierarchical_Tagging *= How_It_Works [reverse: false] Hierarchical_Tagging *= Output_Format [reverse: false] Hierarchical_Tagging *= Use_Cases [reverse: false] LLM_Tagger *= Additional_Tools [reverse: false] Additional_Tools *= 1__Semantic_Search [reverse: false] Additional_Tools *= 2__Find_Similar_Documents [reverse: false] Additional_Tools *= 3__Custom_Prompts [reverse: false] Additional_Tools *= 4__Visualize_Embeddings [reverse: false] LLM_Tagger [z: 9.5 @html: "
LLM Tagger
Document clustering and analysis using
embeddings and LLM.
" nomen: "LLM Tagger"] Quick_Start [z: 4.75 @html: "
Quick Start

 cd docker/llm-tagger # step 1:
cache embeddings (always first)
./llm-tagger.sh init total.ndjson #
step 2: cluster and tag ./llm-tagger.sh
educe-tags subset.ndjson output.ndjson
100 # optional: hierarchical tagging
./llm-tagger.sh hierarchical
level1.ndjson level2.ndjson 3 #
optional: analysis tools ./llm-tagger.sh
search data.ndjson 'query' 10
./llm-tagger.sh similar data.ndjson 0.95
./llm-tagger.sh custom-prompt
tagged.ndjson 'prompt' ./llm-tagger.sh
visualize tagged.ndjson
output.html 

" nomen: "Quick Start"] All_Commands [z: 4.75 @html: "
All Commands
CommandPurpose
 init Cache embeddings from total dataset
 educe-tags Cluster subset and generate tags
 hierarchical Create two-level taxonomy
 search Semantic search by query
 similar Find duplicate/similar documents
 custom-prompt Ask custom questions to clusters
 visualize Interactive 2D visualization
" nomen: "All Commands"] Workflows [z: 4.75 @html: "
Workflows
" nomen: "Workflows"] Workflow_1__Single_Level_Tagging [z: 2.375 @html: "
Workflow 1: Single-Level Tagging
One level of clusters with tags.
 # 1. cache embeddings (once)
./llm-tagger.sh init total.ndjson # 2.
cluster and tag ./llm-tagger.sh
educe-tags subset.ndjson output.ndjson
20 

Result: Documents with cluster and tags
 { "description":
"...", "cluster": 5,
"tags": "hardware,
tools" } 

" nomen: "Workflow 1: Single-Level Tagging"] Workflow_2__Hierarchical_Tagging [z: 2.375 @html: "
Workflow 2: Hierarchical Tagging
Two levels: fine-grained + broad
categories.
 # 1. cache embeddings (once)
./llm-tagger.sh init total.ndjson # 2.
fine-grained clustering ./llm-tagger.sh
educe-tags subset.ndjson level1.ndjson 5
# 3. cluster the clusters
./llm-tagger.sh hierarchical
level1.ndjson level2.ndjson 3 

Result: Documents with two levels
 { "description":
"...",
"cluster_l1": 12,
"tags_l1": "screws,
fasteners",
"cluster_l2": 2,
"tags_l2":
"hardware" } 

" nomen: "Workflow 2: Hierarchical Tagging"] Workflow_3__Multiple_Subsets [z: 2.375 @html: "
Workflow 3: Multiple Subsets
Analyze different slices independently.
 # 1. cache embeddings (once for
all) ./llm-tagger.sh init total.ndjson
# 2. tag each subset (different
patterns) ./llm-tagger.sh educe-tags
january.ndjson jan-tagged.ndjson 15
./llm-tagger.sh educe-tags
hardware.ndjson hw-tagged.ndjson 20
./llm-tagger.sh educe-tags
vendor-x.ndjson vx-tagged.ndjson
10 

Benefit: Each subset gets unique clustering
reflecting its patterns
" nomen: "Workflow 3: Multiple Subsets"] Workflow_4__Multiple_Subsets___Hierarchy [z: 2.375 @html: "
Workflow 4: Multiple Subsets + Hierarchy
Combine both approaches.
 # 1. cache embeddings (once)
./llm-tagger.sh init total.ndjson # 2.
subset 1 with hierarchy ./llm-tagger.sh
educe-tags january.ndjson jan-l1.ndjson
5 ./llm-tagger.sh hierarchical
jan-l1.ndjson jan-final.ndjson 3 # 3.
subset 2 with hierarchy ./llm-tagger.sh
educe-tags hardware.ndjson hw-l1.ndjson
5 ./llm-tagger.sh hierarchical
hw-l1.ndjson hw-final.ndjson 3 

" nomen: "Workflow 4: Multiple Subsets + Hierarchy"] Performance_Changes [z: 4.75 @html: "
Performance Changes
" nomen: "Performance Changes"] 1__Parallel_Tag_Extraction [z: 2.375 @html: "
1. Parallel Tag Extraction
• 8 concurrent workers
• removed sleep delays
• 8x faster
" nomen: "1. Parallel Tag Extraction"] 2__Connection_Pooling [z: 2.375 @html: "
2. Connection Pooling
• requests.Session() for reuse
• all API calls
" nomen: "2. Connection Pooling"] 3__Parallel_Embedding [z: 2.375 @html: "
3. Parallel Embedding
• 4 concurrent workers
• batch size: 32 → 64
• maintains ordering
" nomen: "3. Parallel Embedding"] 4__HDBSCAN_Multi_core [z: 2.375 @html: "
4. HDBSCAN Multi-core
• core_dist_n_jobs=-1
• uses all cores
**Overall speedup: 5-8x
" nomen: "4. HDBSCAN Multi-core"] Two_Phase_Architecture [z: 4.75 @html: "
Two-Phase Architecture
" nomen: "Two-Phase Architecture"] Phase_1__init_total_ndjson [z: 2.375 @html: "
Phase 1: init total.ndjson
• pre-compute all embeddings
• save to cache
• no clustering yet
" nomen: "Phase 1: init total.ndjson"] Phase_2__educe_tags_subset_ndjson [z: 2.375 @html: "
Phase 2: educe-tags subset.ndjson
• load cached embeddings
• cluster subset only
• generate subset-specific tags
• each subset: unique patterns
" nomen: "Phase 2: educe-tags subset.ndjson"] Benefits [z: 2.375 @html: "
Benefits
• embeddings computed once
• each subset independently clustered
• tags reflect subset context
• january.ndjson → january patterns
• hardware.ndjson → hardware categories
" nomen: "Benefits"] Hierarchical_Tagging [z: 4.75 @html: "
Hierarchical Tagging
Create two-level taxonomy: fine-grained
+ broad categories.
" nomen: "Hierarchical Tagging"] Workflow [z: 2.375 @html: "
Workflow

 # level 1: fine-grained (many
small clusters) ./llm-tagger.sh
educe-tags subset.ndjson level1.ndjson 5
# level 2: cluster the clusters
./llm-tagger.sh hierarchical
level1.ndjson level2.ndjson 3 

" nomen: "Workflow"] How_It_Works [z: 2.375 @html: "
How It Works
•  Level 1 creates detailed clusters (e.g.,
"screws", "bolts",
"cables")
•  Level 2 computes cluster centroids
• Clusters the centroids into
super-clusters
• Generates broad tags (e.g.,
"hardware",
"electronics")
" nomen: "How It Works"] Output_Format [z: 2.375 @html: "
Output Format

 { "description":
"...",
"cluster_l1": 5,
"tags_l1": "screws,
fasteners",
"cluster_l2": 1,
"tags_l2": "hardware,
tools" } 

" nomen: "Output Format"] Use_Cases [z: 2.375 @html: "
Use Cases
• multi-level taxonomy
• drill-down navigation
• broad overview + details
" nomen: "Use Cases"] Additional_Tools [z: 4.75 @html: "
Additional Tools
Beyond clustering, embeddings enable
powerful analysis.
" nomen: "Additional Tools"] 1__Semantic_Search [z: 2.375 @html: "
1. Semantic Search
Find documents matching query
semantically.
 ./llm-tagger.sh search data.ndjson
'hardware repair' 10 

Output: Top matching documents with similarity
scores Use cases:
• find relevant documents
• content discovery
• query-based filtering
" nomen: "1. Semantic Search"] 2__Find_Similar_Documents [z: 2.375 @html: "
2. Find Similar Documents
Detect duplicates or near-duplicates.
 ./llm-tagger.sh similar
data.ndjson 0.95 

Output: Pairs of similar documents Use cases:
• duplicate detection
• data quality
• identify redundancy
" nomen: "2. Find Similar Documents"] 3__Custom_Prompts [z: 2.375 @html: "
3. Custom Prompts
Ask different questions to clusters.
 ./llm-tagger.sh custom-prompt
tagged.ndjson 'Zhrň hlavné
témy:\\n{examples}' 

Prompt examples:
•  'Zhrň hlavné
témy:\\n{examples}' 
- summaries
•  'Identifikuj
riziká:\\n{examples}' 
- risk analysis
•  'Aké patterny
vidíš:\\n{examples}' 
- insights
•  'Prečo sú
zoskupené:\\n{examples}' 
- reasoning
Use cases:
• different perspectives
• specialized analysis
• custom insights
" nomen: "3. Custom Prompts"] 4__Visualize_Embeddings [z: 2.375 @html: "
4. Visualize Embeddings
Interactive 2D visualization of document
space.
 ./llm-tagger.sh visualize
tagged.ndjson output.html 

Output: Interactive HTML with plotly Requirements:  pip install umap-learn in Dockerfile Use cases:
• explore document landscape
• verify clustering quality
• find outliers visually
" nomen: "4. Visualize Embeddings"] }