Skip to main content
You can use Serverless AI jobs to work with AI models and perform such operations as fine-tuning, scientific simulations, data processing or batch inference. The example below demonstrates how to fine-tune the Qwen/Qwen2.5-0.5B large language model (LLM) with the support of the Low-Rank Adaptation (LoRA). This example also includes Axolotl, an open-source tool for fine-tuning. Axolotl provides a public container image, which you deploy in a job and, as a result, run fine-tuning.

Prerequisites

Make sure that you are in a group that has the admin role within your tenant; for example, the default admins group.

Steps

Prepare an Object Storage bucket

To store job results, mount an Object Storage bucket to your job. Serverless AI deletes the job after its completion. Thus, the bucket preserves the job data: checkpoints and LoRA adapter weights of a fine-tuned model. To prepare a bucket:
  1. Create it:
    1. In the web console, go to https://mintcdn.com/nebius-ai-cloud/1Ha0sWR6e1mnIaHS/_assets/sidebar/storage.svg?fit=max&auto=format&n=1Ha0sWR6e1mnIaHS&q=85&s=0a2dad6b48aea10e85f6f3e2343aee26 Storage → Object Storage.
    2. Click https://mintcdn.com/nebius-ai-cloud/1Ha0sWR6e1mnIaHS/_assets/plus.svg?fit=max&auto=format&n=1Ha0sWR6e1mnIaHS&q=85&s=7c9efc69d65fc58db0eb73702fd81aa1 Create bucket.
    3. Specify the fine-tuning-axalotl name for the bucket.
    4. In the Maximum size field, select Unlimited. Leave other settings at their default values.
    5. Click Create bucket.
  2. Save the config.yaml file specified below. It is required for Axolotl to run fine-tuning.
    base_model: Qwen/Qwen2.5-0.5B
    
    load_in_4bit: true
    adapter: qlora
    
    datasets:
      - path: Salesforce/wikitext
        name: wikitext-2-raw-v1
        split: "train[:2000]"
        type: completion
        field: text
    
    sequence_len: 128
    micro_batch_size: 1
    gradient_accumulation_steps: 1
    
    learning_rate: 2e-4
    max_steps: 30
    val_set_size: 0
    logging_steps: 5
    
    output_dir: /workspace/output
    
    lora_r: 8
    lora_alpha: 16
    lora_dropout: 0.05
    lora_target_modules:
      - q_proj
      - k_proj
      - v_proj
      - o_proj
      - gate_proj
      - up_proj
      - down_proj
    
  3. Upload this configuration file to the bucket:
    1. In the web console, go to https://mintcdn.com/nebius-ai-cloud/1Ha0sWR6e1mnIaHS/_assets/sidebar/storage.svg?fit=max&auto=format&n=1Ha0sWR6e1mnIaHS&q=85&s=0a2dad6b48aea10e85f6f3e2343aee26 Storage → Object Storage.
    2. Open the page of the fine-tuning-axalotl bucket.
    3. Click AddObject.
    4. Upload the config.yaml file.

Run a fine-tuning job

Create a job that performs the following actions:
  1. Runs an Axolotl container.
  2. Mounts the bucket with the prepared configuration file in the read-write mode.
  3. Executes fine-tuning.
  4. Saves the fine-tuning results to the bucket.
To create and run such a job:
  1. In the web console, go to https://mintcdn.com/nebius-ai-cloud/1Ha0sWR6e1mnIaHS/_assets/sidebar/ai-services.svg?fit=max&auto=format&n=1Ha0sWR6e1mnIaHS&q=85&s=ab4ff229f7690c99deb1dc52d3daf987 AI Services → Jobs.
  2. Click https://mintcdn.com/nebius-ai-cloud/1Ha0sWR6e1mnIaHS/_assets/plus.svg?fit=max&auto=format&n=1Ha0sWR6e1mnIaHS&q=85&s=7c9efc69d65fc58db0eb73702fd81aa1 Create job.
  3. On the page that opens, specify the following job settings:
    • Name: fine-tuning-axalotl-qwen-lora.
    • Image path: docker.io/axolotlai/axolotl:main-20260309-py3.11-cu128-2.9.1.
    • Advanced settings → Arguments: -c "RUN_ID=run-$(date +%Y%m%d-%H%M%S); axolotl train /workspace/data/config.yaml && mkdir -p /workspace/data/output/$RUN_ID && cp -r /workspace/output/. /workspace/data/output/$RUN_ID".
    • Computing resources: With GPU.
    • Available platform: NVIDIA® L40S PCIe with Intel Ice Lake.
    • Preset: 1 GPU — 8 CPUs — 32 GiB RAM.
    • Container disk, Size GiB: 450.
    • Mount volumes: Bucket.
    • Mount path: /workspace/data. After that, click https://mintcdn.com/nebius-ai-cloud/1Ha0sWR6e1mnIaHS/_assets/plus.svg?fit=max&auto=format&n=1Ha0sWR6e1mnIaHS&q=85&s=7c9efc69d65fc58db0eb73702fd81aa1 Attach bucket and then select the fine-tuning-axalotl bucket.
  4. Click Create.
The job takes several minutes to complete.

Check the job results

  1. View information about the job:
    In the web console, go to https://mintcdn.com/nebius-ai-cloud/1Ha0sWR6e1mnIaHS/_assets/sidebar/ai-services.svg?fit=max&auto=format&n=1Ha0sWR6e1mnIaHS&q=85&s=ab4ff229f7690c99deb1dc52d3daf987 AI Services → Jobs and then open the page of the fine-tuning-axalotl-qwen-lora job. It contains information about the job state and configuration.
  2. Download LoRA adapter weights of the fine-tuning job. They are stored as files in the output directory, in the fine-tuning-axalotl bucket. To check these files, open the page of the fine-tuning-axalotl bucket in the web console.
    To download a file, in its line, click https://mintcdn.com/nebius-ai-cloud/1Ha0sWR6e1mnIaHS/_assets/button-vellipsis.svg?fit=max&auto=format&n=1Ha0sWR6e1mnIaHS&q=85&s=e80b8e57c43bfd117679262e6a1334ad → Download.

See also