Local LLM Setup
DocApply uses Spring AI for its AI features: writing, checking and translating job descriptions, and extracting applicant data from uploaded documents. To use them locally, you need a local LLM.
This guide explains how to set up a local LLM for development with LM Studio.
Prerequisites
- A server running with the
devprofile, the default - The newest version of LM Studio
- Enough disk space for a model, usually a few gigabytes
Choosing a Model
DocApply does not depend on a particular model, and local models improve quickly, so pick a current one that fits your machine. It needs to:
- Accept images. AI extraction sends each page of an uploaded PDF to the model as an image. LM Studio marks these models as vision models; a text-only model rejects the request and the extraction fails.
- Handle a long context. Load it with a context length of about 32,000 tokens, so that job descriptions and multi-page documents fit.
Lightweight vision models such as those from the Gemma and Qwen families (for example Qwen-VL) work well for development. A small variant of a few billion parameters runs on most laptops; a larger one gives better texts if your machine has the memory.
Setting up LM Studio
You can set up LM Studio either with the GUI or with the CLI.
LM Studio GUI
1. Install LM Studio
Download LM Studio from https://lmstudio.ai/download.
2. Download a model
- Open LM Studio
- Go to the Discover tab in the side navigation bar
- Search for a model as described in Choosing a Model and download it. Check on its model page that it supports vision.
- Make sure "Enable Local LLM Service" is active
3. Load the model
- Go to the Developer tab in the side navigation bar
- Open the "Select model to load" dropdown menu at the top:
- Enable "Manually choose model load parameters"
- Select your model
- Set the context length to
32000 - Click "Load model"
4. Start the server
Toggle the "Status" switch to "Running".
The LLM service now runs on http://localhost:1234.
LM Studio CLI
1. Install LM Studio
Install LM Studio with Homebrew. This installs the LM Studio app, which comes with the CLI. For more information, see the LM Studio CLI documentation.
brew install --cask lm-studio
2. Download a model
Search the catalogue and download a model as described in Choosing a Model:
lms get <model>
3. Load the model
lms load <model> --context-length 32000
4. Start the server
lms server start
The LLM service now runs on http://localhost:1234.
Verify the Service
Open http://localhost:1234/api/v0/models. Your model appears in the list with "type": "vlm", which marks a vision model, and "state": "loaded".
Connecting the Server to the Model
The server sends every request to the model named in spring.ai.openai.chat.options.model in application-dev.yml. Set it to the identifier of the model you loaded, exactly as http://localhost:1234/api/v0/models lists it. Instead of editing the file, you can set an environment variable when you start the server:
SPRING_AI_OPENAI_CHAT_OPTIONS_MODEL=<model> ./gradlew -x webapp
Testing the Integration
- Start the DocApply server and client
- Log in as
professor1and create a position: let the AI assistant write the job description, check its quality score, and switch the language to see the translation - Log in as an applicant, open Settings → Application Information, upload a CV, and click AI Extraction
- View the LM Studio server logs, either with
lms log streamor in the Developer tab of LM Studio, and check that they show the prompts, the progress and the generated responses
If the extraction fails with a message that the model does not support image inputs, load a vision model instead, as described in Choosing a Model.
Performance Considerations
- Model size: Larger models give better results but need more memory and processing power. Start with a small model and move to a larger one if your machine handles it.
- Context length: The context length controls how much text the model can process at once. Adjust it to your hardware.
- GPU acceleration: LM Studio uses GPU acceleration automatically when available (Metal on macOS, CUDA on Linux and Windows).
🛠 Troubleshooting
Exit Code 6 When Loading a Model
If you encounter the following error:
🥲 Failed to load the model
Error loading model. (Exit code: 6)
This usually means the model cannot load because the required runtime engine is missing or broken.
✅ Fix: Repair the MLX Runtime (macOS Apple Silicon)
-
Open LM Studio
-
In the left menu, click LM Runtimes
-
Under Runtime Extension Packs, find:
LM Studio MLX
(Engine used for MLX / Apple Silicon models)
-
If LM Studio detects an issue, a Fix button will appear
-
Click Fix to reinstall, update, or repair the engine
After the repair completes, try loading your model again.