Dec 18, 2025

LLMs for Optimization: What Worked in My JSSP Pipeline

My practical lessons from modeling Job Shop Scheduling with disjunctive graphs, constrained prompts, and LoRA fine-tuning.

OptimizationNLPMLOpsResearch Notes

When I started working on LLMs for optimization, the tempting framing was to ask whether a language model could solve Job Shop Scheduling directly. That turned out to be the wrong first question. The useful question was whether I could expose the structure of the optimization problem clearly enough for the model to reason over it.

The most important change I made was representing each instance as a disjunctive graph and then serializing the hard constraints explicitly. Once precedence rules and machine conflicts were visible in the input format, the model outputs became easier to inspect. They were still wrong in many cases, but they were wrong in more diagnosable ways.

Step through the JSSP pipeline

Step 1 of 5: Raw JSSP instance

Another practical lesson was that feasibility matters more than fluency. A schedule can sound coherent and still be invalid. I had to inspect violations systematically instead of treating natural-sounding output as a sign of progress. That forced me to track constraint failures, not just generic text quality.

Fine-tuning also became much more manageable after I reduced the runtime burden with 4-bit LoRA. That did not magically solve the core reasoning problem, but it let me iterate faster and test representation changes without turning every experiment into a multi-day wait.

Fine-tuning runtime (hover a bar)
Initial setup70 h
Filtered data + 4-bit LoRA11.5 h

6.1× faster iteration

Run on a single NVIDIA RTX A6000 with Unsloth.

STARJOB instances before and after cleaning
Raw instances (approx.)130,000
Usable instances9,525

Filtering noisy and malformed instances was a large part of the runtime win.

The biggest caveat is that optimization tasks punish vague prompting. If the structure is underspecified, the model fills gaps with plausible but infeasible decisions. My main takeaway is simple: for constrained optimization, representation design is the real work. The model only becomes useful after the structure is explicit enough to support valid reasoning.

Back to blog
Role Fit Check