LLM Infrastructure Tools

LLM Infrastructure Tools

Tools for discovering, categorizing, and managing large language models. These are production-grade utilities that power Aurora’s model management capabilities.


Overview

Working with LLMs at scale requires infrastructure. These tools help us:


Available Tools

fetch_models.py

HuggingFace Model Categorizer

A comprehensive tool that fetches GGUF models from all major quantization uploaders on HuggingFace, categorizes them by type and capability, and produces a structured model list.

Key Features:

Use Cases:

friend.zip - Mobile LLM Project

On-Device LLM Infrastructure

A complete mobile/on-device LLM implementation with shell scripts for:

Key Features:

Use Cases:


The Model Categorization Challenge

With thousands of GGUF models on HuggingFace, manual categorization is impossible. fetch_models.py solves this with a two-stage approach:

Stage 1: Primary Categories (XOR - First Match Wins)

Models are first matched against specific use-case categories:

CategoryKeywordsExample Models
Audiotts, speech, voice, whisperWhisper, Bark, Outé
Visionvl, vision, llava, moondreamLLaVA, BakLLaVA, MiniCPM-V
Codingcoder, starcoder, codegemmaStarCoder2, CodeLlama, DeepSeek-Coder
Reasoningreasoning, math, r1, o1DeepSeek-R1, QWQ, Skywork
Medicalmedical, clinical, healthMedLlama, Meditron
Legallegal, law, lawyerLawLlama, JurisAI
Financefinance, financial, tradingFinLlama, BloombergGPT
Roleplayroleplay, rpg, personaTavernAI, RoleplayLlama
Uncensoreduncensored, nsfw, adultUncensoredLlama, LewdPlay
Creativedolphin, hermes, openchatDolphin, Hermes, Zephyr
Long Contextlong, context, 128k, 256kLongLlama, Yarn, Infini
Multilingualmultilingual, bloom, xglmBloom, XGLM, Aya
Mergedmerge, franken, slerpFrankenLlama, Supernova
Tinysmollm, tinyllama, mobileTinyLlama, Phi-1, Edge
Instructinstruct, chat, assistantLlama-3-Instruct, Mistral-Instruct

Stage 2: Auto-Categorization (Fallback)

Models that don’t match primary categories are auto-categorized by architecture:

CategoryKeywords
Auto/Gemmagemma
Auto/Llamallama
Auto/Qwenqwen
Auto/Mistralmistral
Auto/Phiphi
Auto/Falconfalcon
Auto/DeepSeekdeepseek
Auto/GLMglm
Auto/Other(catch-all)

Architecture Patterns

fetch_models.py Design

# 1. Define uploaders (sources)
UPLOADERS = ["Lewdiculous", "QuantFactory", "TheBloke", ...]

# 2. Define categorization rules
PRIMARY_RULES = [("Audio", [r"tts\b", r"\bspeech\b", ...]), ...]
AUTO_RULES = [("Auto/Gemma", [r"\bgemma\b"]), ...]

# 3. Fetch from each uploader
for uploader in UPLOADERS:
    data = fetch_from_huggingface(uploader)
    
# 4. Filter and categorize
for model in data:
    if passes_filters(model):
        category = categorize(model)
        models.append(model_with_category)

# 5. Sort and output
models.sort(key=lambda x: (x["date"], x["likes"]), reverse=True)
write_output(models)

Parameter Extraction

The tool handles complex parameter notation:


Usage Examples

Basic Usage

# Fetch models, cache in ./cache, output to models.txt
python3 fetch_models.py ./cache models.txt

Output Format

# llama-menu model list — fetched from HuggingFace
# NAME|CATEGORY|REPO|FILE|SIZE|LIKES|DOWNLOADS|DATE
Llama-3-8B-Instruct|Instruct|meta-llama/Meta-Llama-3-8B-Instruct-GGUF|Q4_K_M.gguf|6.8GB|15000|85000|2026-07-15
Mistral-7B-Instruct|Instruct|TheBloke/Mistral-7B-Instruct-v0.2-GGUF|Q4_K_M.gguf|4.1GB|12000|75000|2026-07-10
Phi-3-mini-4k-instruct|Instruct|mradermacher/Phi-3-mini-4k-instruct-4k-GGUF|Q4_K_M.gguf|2.1GB|8000|45000|2026-07-20

Integration with Model Menus

Many LLM interfaces (like llama-menu.sh) use this output:

# Parse model list
while IFS='|' read -r name category repo file size likes downloads date; do
  if [ "$category" = "Coding" ]; then
    echo "[$name] ($size) - $category"
  fi
done < models.txt

Performance Considerations

Fetching Speed

Caching

Filtering


Source Code

All tools are available for download and study:



Good infrastructure makes complex systems simple. Great infrastructure makes them invisible.

fetch_models.py - HuggingFace Model Categorizer

fetch_models.py

Comprehensive GGUF Model Fetcher and Categorizer

Fetches GGUF models from all major quantization uploaders on HuggingFace. Filters by param count (0.1B-14B). Categorizes by keyword rules. Anything not matched goes into Auto/ via a second-pass clusterer.


Overview

fetch_models.py is a production-grade tool that solves a critical problem: How do you make sense of thousands of LLM models on HuggingFace?

It fetches models from all major GGUF quantization uploaders, intelligently categorizes them, and produces a clean, structured output that can be used to power model selection interfaces, analysis tools, or any application that needs to work with the LLM ecosystem at scale.

Read more...

friend.zip - Mobile LLM Project

friend.zip

Mobile/On-Device LLM Infrastructure

A self-contained LLM implementation designed for edge devices and mobile environments. This is a complete AI assistant system that runs entirely locally with minimal dependencies.


Overview

friend.zip contains a portable, self-contained LLM system built entirely in Bash. It’s designed to run on resource-constrained devices (mobile, edge, embedded) where traditional Python-based LLM systems would be too heavy.

Contents

The archive contains 8 files totaling ~16KB:

FileSizePurpose
setup.sh1.5KBInstallation and initialization
config.sh778BConfiguration management
llm_call.sh2.7KBCore LLM calling interface
memory.sh2.5KBMemory/conversation management
tools.sh2.1KBUtility functions and helpers
dream.sh3.1KBMemory consolidation (similar to Aurora’s)
talk.sh3.0KBMain conversation interface
system_prompt.txt602BDefault system prompt

Architecture

Component Overview

┌─────────────────────────────────────────────────────────┐
│                    FRIEND SYSTEM                            │
├─────────────────────────────────────────────────────────┤
│                                                              │
│  ┌─────────────┐     ┌─────────────┐     ┌────────────┐ │
│  │   talk.sh   │────►│ llm_call.sh │────►│   LLM      │ │
│  │ (Interface) │     │ (Core)      │     │ (Backend)  │ │
│  └─────────────┘     └─────────────┘     └────────────┘ │
│         ▲                   ▲                              │
│         │                   │                              │
│  ┌──────┴──────┐    ┌──────┴──────┐                      │
│  │  memory.sh  │    │  config.sh  │                      │
│  │ (State)     │    │ (Settings)  │                      │
│  └──────┬──────┘    └─────────────┘                      │
│         │                                              │
│  ┌──────▼──────┐                                             │
│  │  dream.sh   │                                             │
│  │ (Consolidation)                                         │
│  └─────────────┘                                             │
│                                                              │
└─────────────────────────────────────────────────────────┘

Data Flow

User Input → talk.sh → memory.sh (load context) → llm_call.sh → LLM
                                    ↑
                               dream.sh (consolidate)
                                    ↓
                            memory.sh (save context)

Components

1. talk.sh (3.0KB)

Main conversation interface — The entry point for interacting with the LLM.

Read more...