Subtitle Edit has evolved beyond a simple timing tool into a sophisticated AI-powered workstation. By integrating local Large Language Models (LLMs), users can now perform complex translations, grammar corrections, and style adjustments entirely on their own hardware. This approach eliminates recurring API costs and ensures that sensitive or unreleased video content never leaves the local machine.

Connecting a local LLM to Subtitle Edit involves setting up an inference server that mimics the OpenAI API structure. Tools like LM Studio or Ollama serve as the bridge, allowing Subtitle Edit to send subtitle lines to models like Llama 3.1 or Qwen 2.5 and receive processed text in real-time.

The Advantages of Local Inference in Subtitle Workflows

Transitioning from cloud-based services like DeepL or Google Translate to local LLMs offers three primary benefits:

  1. Data Sovereignty and Privacy: For professional translators working on NDAs or private family videos, cloud uploads represent a security risk. Local LLMs process data in RAM and VRAM without external logging.
  2. Cost Efficiency: Cloud APIs charge per character or token. When processing thousands of hours of video, these costs escalate. A local model runs for the cost of electricity.
  3. Contextual Intelligence: Unlike traditional machine translation, LLMs understand context. They can maintain consistent gender pronouns across a scene or adapt the "tone" of a dialogue (e.g., formal vs. street slang) based on the system prompt.
  4. No Content Censorship: Many cloud providers refuse to translate or process content containing violence, mature themes, or controversial topics. "Uncensored" local models process exactly what they are given without refusal.

Setting Up the Local LLM Infrastructure

Before configuring Subtitle Edit, an inference engine must be running to host the model. The two most reliable options for Windows, Linux, and macOS users are LM Studio and Ollama.

Configuring LM Studio for Subtitle Edit

LM Studio provides a graphical interface that is ideal for users who want to monitor VRAM usage and model performance visually.

  • Model Selection: Search for and download a "GGUF" version of a model. For subtitle work, models in the 7B to 14B parameter range offer the best balance of speed and accuracy. Qwen 2.5 7B is currently highly recommended for its multilingual capabilities.
  • Loading the Model: Go to the "AI Chat" or "Local Server" tab and select the model to load it into memory.
  • Server Activation: Navigate to the "Local Server" tab (indicated by a double-arrow icon). Ensure the "CORS" setting is enabled.
  • Identifying the Endpoint: By default, LM Studio runs on http://localhost:1234. The full endpoint for Subtitle Edit will be http://localhost:1234/v1/chat/completions.

Configuring Ollama for Subtitle Edit

Ollama is a lightweight, CLI-focused tool that is excellent for background operation.

  • Installation and Model Pull: Once Ollama is installed, open a terminal and run ollama pull qwen2.5 or ollama pull llama3.1.
  • Background Operation: Ollama runs as a service. It automatically provides an OpenAI-compatible endpoint at http://localhost:11434/v1/chat/completions.
  • Verification: Ensure the service is active by checking the system tray icon or running ollama list in the terminal to confirm the model is ready.

Connecting Subtitle Edit to the Local Endpoint

Once the server is running, Subtitle Edit needs to be directed to use the local API instead of the standard OpenAI cloud service.

Step-by-Step Configuration

  1. Open Auto-Translate: In Subtitle Edit, go to the "Auto-translate" menu.
  2. Select Engine: In the engine dropdown, look for "OpenAI" or "OpenAI compatible".
  3. Input the API URL: Replace the default OpenAI URL with your local address.
    • For LM Studio: http://localhost:1234/v1/chat/completions
    • For Ollama: http://localhost:11434/v1/chat/completions
  4. API Key: Local servers usually do not require a real key. You can enter a placeholder like sk-local-llm or just 123.
  5. Model Name: This must match the exact name of the model loaded in your runner. In LM Studio, copy the identifier from the server tab. In Ollama, use the name used during the "pull" command (e.g., qwen2.5:7b).
  6. Test Connection: Click the "Test" button (if available) or attempt to translate a single line to ensure the handshake is successful.

Advanced Prompt Engineering for Subtitles

The quality of local LLM output is 20% model capability and 80% prompt quality. Subtitles have unique constraints: they must fit within specific character-per-second (CPS) limits and maintain line breaks.

The Perfect Translation Prompt

When using the "Auto-translate" feature, use a System Prompt that enforces strict formatting. A recommended prompt looks like this:

"You are a professional subtitle translator. Translate the provided text from [Source Language] to [Target Language]. Maintain the original emotional tone and cultural nuances. Most importantly: DO NOT add meta-commentary, DO NOT add explanations, and DO NOT change the number of lines. Output only the translated text."

The Cleanup and Correction Prompt

Local LLMs are exceptionally good at fixing "OCR gore"—the messy text produced when ripping subtitles from Blu-rays. Use this prompt in the "Multiple Replace" or specialized AI tools within Subtitle Edit:

"Review the following subtitles for OCR errors. Common errors include 'I' being read as '1' or 'l', and 'o' being read as '0'. Fix these errors and correct any obvious spelling or punctuation mistakes. Do not change the meaning of the dialogue. Return only the corrected text."

Managing Temperature and Top-P

  • Temperature: For translation and cleanup, keep this between 0.1 and 0.3. Low temperature makes the model more deterministic and less likely to "hallucinate" or add creative flourishes that weren't in the original dialogue.
  • Max Tokens: Set this high enough to cover your typical batch size, but usually, 512 to 1024 is sufficient for subtitle fragments.

Optimizing Batch Size for Context

One of the biggest mistakes users make is sending one subtitle line at a time to the LLM. While this is fast, the model loses the context of the conversation.

In Subtitle Edit, look for the option to process lines in batches (if available through specific plugins or the auto-translate window). Sending 5 to 10 lines at once allows the model to see who is speaking and what was said previously. For example, if a character is referred to as "he" in one line, the LLM can correctly gender the translation in the next line.

However, avoid batches larger than 50 lines, as the model may begin to lose track of the one-to-one mapping between source and target lines, leading to timing mismatches.

Hardware Requirements and Model Selection

Running an LLM locally requires significant GPU resources, specifically Video RAM (VRAM).

Model Size Minimum VRAM Recommended VRAM Best Use Case
1B - 3B 2GB - 4GB 6GB Fast, basic grammar checks.
7B - 9B 8GB 12GB High-quality translation and nuance.
14B - 20B 16GB 24GB Complex literary or technical translation.
30B+ 24GB+ Dual GPU / Mac Studio Professional-grade localization.

Recommended Models for 2025

  1. Qwen 2.5 7B / 14B (Instruct): Currently the top performer for multilingual tasks, especially for Asian and European languages.
  2. Llama 3.1 8B: Excellent general-purpose model with strong reasoning for English-based cleanup and formatting.
  3. Mistral Nemo 12B: A great middle-ground model that fits in 12GB VRAM cards (like the RTX 3060/4070) and offers superior translation consistency.

Enhancing the Workflow with Whisper and LLM Cleanup

The most powerful local workflow involves a two-stage AI pipeline:

  1. Stage 1: Transcription: Use Subtitle Edit’s built-in Whisper integration (preferably the Faster-Whisper or Const-me implementations) to generate the raw text and timestamps from the audio.
  2. Stage 2: LLM Refinement: Take the raw Whisper output—which often lacks proper punctuation or may mishear specialized terms—and run it through your local LLM with a "Punctuate and Sanitize" prompt.

This two-step process results in subtitles that rival professional human-made files, as the LLM can add commas, periods, and capitalization that Whisper sometimes struggles to place perfectly.

Troubleshooting Common Issues

The LLM Changes the Line Count

If you send 10 lines and get back 8, the model has "merged" the dialogue. To fix this, update your prompt to: "Translate line by line. Ensure the output has exactly the same number of lines as the input. Use a newline character to separate each translation."

Connection Refused Errors

Ensure your firewall isn't blocking the port (1234 or 11434). In LM Studio, check that the "Cross-Origin Resource Sharing (CORS)" toggle is ON. If using Ollama on a separate machine, you must set the environment variable OLLAMA_HOST=0.0.0.0.

Slow Processing Speed

If translation is taking more than a few seconds per batch:

  • Check if the model is fully "offloaded" to the GPU. In LM Studio, slide the "GPU Offload" bar to the maximum.
  • Use a smaller "Quantized" version of the model (e.g., Q4_K_M instead of Q8_0). The quality loss is usually negligible for translation, but the speed gain is massive.

Summary of Local LLM Integration

Integrating a local LLM into Subtitle Edit transforms the software from a manual editor into a high-throughput automated localization tool. By utilizing the OpenAI-compatible endpoint feature, users can leverage the latest advancements in open-source AI—such as Llama 3.1 and Qwen 2.5—without sacrificing privacy or incurring high costs. The key to success lies in choosing the right model size for your VRAM and refining your system prompts to ensure the AI respects the strict formatting required for SRT and ASS files.

Frequently Asked Questions

Can I use local LLMs for OCR in Subtitle Edit?

Yes. Subtitle Edit supports local LLM-based OCR (like Ollama OCR). This allows the software to "look" at subtitle images (from VOB or SUP files) and use the vision capabilities of models like Llama 3.2-Vision to recognize text more accurately than traditional Tesseract OCR.

Is an internet connection required at any point?

Only to initially download the Subtitle Edit software and the AI models through LM Studio or Ollama. Once the models are on your hard drive, the entire transcription and translation process can be done 100% offline.

What is the best model for translating into English?

For translating various languages into English, Llama 3.1 8B is highly effective due to its vast English training data. However, for translating out of English into other languages, Qwen 2.5 often provides more natural-sounding results.

Does Subtitle Edit support GPU acceleration for LLMs?

Subtitle Edit itself sends text to the inference server. The GPU acceleration is handled by the server (LM Studio or Ollama). As long as your server is configured to use your NVIDIA, AMD, or Apple Silicon GPU, the process will be fast.