Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

MLX LoRA Fine-Tuning: A Rigorous Developer Workflow

Описание и применение

Руководство по тонкой настройке LLM с помощью MLX LoRA на Apple Silicon. Акцент делается на строгую оценку, правильную подготовку данных и осторожное слияние адаптеров для обеспечения их полезности и предотвращения типичных ошибок.

Задача

Starting an MLX LoRA fine-tuning run is straightforward, but determining whether the resulting adapter is actually useful requires rigorous evaluation and careful handling of data contracts, frozen baselines, and post-training metrics.

Результат

The workflow provides a robust method for fine-tuning LLMs on Apple Silicon, emphasizing rigorous evaluation, proper data handling, and cautious fusion of adapters to ensure utility and prevent common failure modes.

Рабочий процесс

  • Prepare environment and data: Use local JSONL files (train, valid, test) or Hugging Face datasets. Ensure each example is on one line and verify the base model's chat template.
  • Run bounded adapter experiment: Use mlx_lm.lora with explicit base model, data path, iteration budget, and output path. Record base revision, MLX LM version, config, seed, and machine details.
  • Verify loss application: If prompt masking is enabled, confirm loss is applied only to intended completion tokens.
  • Evaluate before fusing: Run both the unchanged base model and the adapter against the same frozen examples.
  • Apply task-specific metrics: Use perplexity for general checks but rely on specific metrics (e.g., tool argument checks, protected-span measurements) for specialized tasks.
  • Check for regressions: Evaluate on out-of-domain slices to ensure gains do not hide breadth regressions.
  • Qualitative generation: Perform qualitative checks only after passing quantitative gates.
  • Fuse and package: Fuse the adapter only if evidence supports it. Package with base identity, artifact, tokenizer, quantization details, runtime requirements, model card, license checks, and evaluation revision.

Доказательства

MLX LM gives Apple Silicon a native path for adapting open language models with LoRA or QLoRA. Starting the run is straightforward. Deciding whether the resulting adapter is useful is the real work.

Источник

Perplexity can reveal some training problems, but it cannot replace task metrics.

Источник

  • Дата записи: 2026-09-09T20:15:58.925Z