/local-llm

LLM Operations L2+ Production medium usage

/local-llm

Overview

/local-llm is a production command in the LLM Operations category of the Prismatic Platform that executes language model requests exclusively through local providers, primarily Ollama, at zero API cost. While the /llm command routes requests across all available providers based on optimization criteria, the /local-llm command guarantees that no external API calls are made, ensuring complete data privacy, zero latency variability from network conditions, and zero per-token costs.

This command operates under the L2+ authority level and is executed by the local-llm-coordinator agent. It is part of the platform's 216-command slash command registry, built on the AIAD (Autonomous Intelligence Agent Design) standard. Local LLM execution is essential for scenarios where data sensitivity prevents sending content to external APIs, where network connectivity is unreliable, or where cost management requires eliminating per-token charges.

The Prismatic Platform integrates with Ollama as its primary local LLM provider, supporting models including qwen3-coder (7B parameters, < 3 second response), gpt-oss (20B parameters, < 5 second response), and deepseek-coder (6.7B parameters, < 3 second response). These models run entirely on the local machine's hardware, providing inference capabilities that are adequate for many platform operations including code generation, analysis, and formatting tasks.

Architecture

The local LLM system operates through the Ollama runtime, which manages model loading, inference, and memory.

Local Inference Architecture

/local-llm -> Ollama Client -> Ollama Server -> Model Runtime
                   |                |                |
                   v                v                v
             Request Format    API (port 11434)   GPU/CPU Inference
             Response Parse    Model Manager      Memory Management
             Token Count       Health Monitor     Quantization

Model Registry

ModelParametersVRAM RequiredResponse TimeStrength
qwen3-coder7B~4GB< 3sCode generation, refactoring
deepseek-coder6.7B~4GB< 3sCode analysis, completion
gpt-oss20B~12GB< 5sGeneral reasoning, analysis
codellama7B~4GB< 3sCode-specific tasks
llama38B~5GB< 4sGeneral purpose

Performance Characteristics

MetricTargetTypical
Response time< 5s1-3s (7B), 3-5s (20B)
Memory usage< 8GB4-6GB (7B), 10-14GB (20B)
Uptime> 99%> 99.5%
Accuracy> 85%85-92%
Throughput> 30 tok/s35-50 tok/s (7B)

Usage

# Send a prompt to the default local model
/local-llm "Refactor this function to use pattern matching"

# Use a specific local model
/local-llm "Generate a GenServer for caching" --model=qwen3-coder

# Use the larger model for complex reasoning
/local-llm "Analyze this architecture decision" --model=gpt-oss

# Check local model availability
/local-llm status

# List installed models
/local-llm models

# Install a new model
/local-llm install codellama

# Remove a model
/local-llm remove codellama

# Run a benchmark
/local-llm benchmark --model=qwen3-coder

# Configure default model
/local-llm config --default-model=qwen3-coder

# Check Ollama server health
/local-llm health

# Stream response tokens
/local-llm "Write a comprehensive module" --stream

# Process from file input
/local-llm --input=prompt.txt --output=response.md

Options

OptionTypeDefaultDescription
promptstringnonePrompt text (positional, or from stdin)
actionstringpromptAction: prompt, status, models, install, remove, benchmark, config, health
--modelstringqwen3-coderModel name
--streamflagfalseStream response tokens
--max-tokensinteger4096Maximum response tokens
--temperaturefloat0.7Sampling temperature
--systemstringnoneSystem prompt
--formatstringtextOutput format: text, json, markdown
--inputstringnoneRead prompt from file
--outputstringstdoutWrite response to file
--timeoutinteger30Request timeout in seconds
--verboseflagfalseShow model loading and inference details
--gpubooleanautoForce GPU or CPU inference

Execution Flow

  1. Ollama Health Check: The command verifies that the Ollama server is running and responsive at http://localhost:11434. If the server is not running, a helpful error message is displayed with instructions to start it.

  2. Model Verification: The requested model is verified as installed. If not installed and the action is prompt, the command offers to pull the model automatically.

  3. Model Loading: If the model is not already loaded in memory, Ollama loads it from disk. First-use loading takes 5-15 seconds depending on model size; subsequent requests reuse the loaded model.

  4. Prompt Construction: The prompt is constructed with the optional system prompt, user prompt, and any formatting parameters. The prompt format follows the model's expected chat template.

  5. Local Inference: The request is sent to the Ollama API. Inference runs entirely on local hardware (GPU if available, CPU otherwise). No data leaves the machine.

  6. Response Collection: The response is collected either as a complete response or as a token stream, depending on the --stream flag. Token counts are extracted for usage tracking.

  7. Quality Check: The response is checked for basic quality: non-empty content, absence of degenerate output patterns (repetition, truncation), and reasonable length relative to the prompt.

  8. Output Formatting: The response is formatted and delivered according to the --format and --output options.

Integration Points

ComponentRelationshipDetails
Prismatic AgentsExecuted by local-llm-coordinatorLocal model management
/llmParent orchestratorLocal LLM as one provider option
OllamaInference runtimeModel serving and management
TelemetryUsage trackingResponse times, token counts, model usage
Quality GatesResponse qualityOutput quality validation
AIAD RegistryCommand specificationLocal LLM command configuration
/chatgpt-workflowWorkflow integrationLocal models as workflow step targets

Best Practices

Start Ollama before the platform. Ensure the Ollama server is running before starting development sessions. The command checks Ollama availability but cannot start the server itself.

Use appropriate models for the task. The 7B models (qwen3-coder, deepseek-coder) are fast and adequate for most code-related tasks. Reserve the 20B model (gpt-oss) for tasks requiring stronger reasoning or more complex analysis.

Monitor GPU memory. Local models consume significant GPU memory. Running multiple models simultaneously can cause out-of-memory errors. Use /local-llm models to see which models are currently loaded and unload unused ones.

Leverage zero cost for iteration. The zero-cost nature of local inference encourages rapid iteration. Use local models to draft prompts and refine them before sending to more capable (and expensive) cloud models.

Keep models updated. Periodically check for model updates with ollama pull model-name. Newer model versions often include quality improvements and bug fixes.

Use streaming for long outputs. The --stream flag provides real-time feedback during generation, which is particularly valuable for long code generation tasks where early output can indicate whether the model is on the right track.

Error Handling

ErrorCauseResolution
ollama_not_runningOllama server not startedRun ollama serve in a separate terminal
model_not_foundRequested model not installedUse /local-llm install model-name to download
out_of_memoryInsufficient GPU/system memoryClose other applications or use a smaller model
model_loading_timeoutModel loading exceeded timeoutIncrease --timeout or pre-load the model
inference_timeoutGeneration exceeded timeoutIncrease --timeout or reduce --max-tokens
degenerate_outputModel produced repetitive/empty outputAdjust temperature, rephrase prompt, or try different model
gpu_not_availableNo compatible GPU detectedUse --gpu=false for CPU-only inference (slower)

Advanced Usage

Model Performance Comparison

Benchmark models to find the best option for specific task types.

# Benchmark all installed models
/local-llm benchmark --all --task=code-generation

# Benchmark specific model with detailed metrics
/local-llm benchmark --model=qwen3-coder --iterations=10 --verbose

Custom Model Configuration

Configure model-specific parameters through Modelfiles.

# Create a custom model configuration
/local-llm config --create-modelfile --base=qwen3-coder \
  --system="You are an Elixir expert" --temperature=0.3

# Use the custom configuration
/local-llm "Generate a Supervisor module" --model=custom-elixir-expert

Batch Processing

Process multiple prompts efficiently.

# Process a batch of prompts from file
/local-llm --batch=prompts.txt --output-dir=responses/ --model=qwen3-coder

# Process with parallel execution
/local-llm --batch=prompts.txt --parallel=2 --model=qwen3-coder

Integration with Platform Agents

Configure agents to prefer local models for specific operations.

# Set agent-level model preferences
/local-llm config --agent=code-specialist --model=qwen3-coder
/local-llm config --agent=analysis-specialist --model=gpt-oss

Doctrine Compliance

All commands operate under the NO MERCY, NO DOUBTS doctrine:

  • NO MERCY: Zero tolerance for incomplete execution or quality violations. Local model responses are quality-checked before delivery. Degenerate outputs are detected and rejected.
  • NO DOUBTS: Full investigation before action, evidence-based results. Model selection is based on benchmarked performance data. Usage metrics provide evidence for optimization decisions.
  • /llm - Primary LLM operation management and orchestration
  • /openrouter - OpenRouter LLM provider operations and management
  • /chatgpt-bridge - ChatGPT bridge operations for cross-LLM coordination
  • /chatgpt-workflow - Multi-step workflow coordination across AI assistants
  • /code - Core coding implementation and feature development
  • /agents - List and manage agent ecosystem with status monitoring

Connect & Contribute

Created by Tomáš Korcak (korczis) | Open Source under GHL