Simplismart Training API

LLM/VLM model training endpoints

OpenAPI Specification

simplismart-training-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: DeepSeek R1 Distil Qwen-32B Chat Completion Training API
  description: High-capacity LLM for complex tasks
  version: 1.0.0
servers:
- url: https://api.simplismart.live
  description: DeepSeek-R1-Distill-Qwen-32B Proxy Server
security:
- BearerAuth: []
tags:
- name: Training
  description: LLM/VLM model training endpoints
paths:
  /job/:
    post:
      tags:
      - Training
      summary: Start a new LLM/VLM training job
      description: Submit a new training job with dataset configuration, model details, training configuration, and infrastructure requirements.
      operationId: createTrainingJob
      parameters:
      - in: header
        name: Authorization
        schema:
          type: string
        required: true
        description: Bearer token for authentication and authorization.
        example: Bearer <jwt-token>
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                org:
                  type: string
                  description: Organization ID associated with the training job.
                  example: 0bf00b43-430a-4ca3-a8b3-b13cc8dc6d4f
                experiment_name:
                  type: string
                  description: Name assigned to the training experiment.
                  example: launch-simplismart-causal_lm-lora
                dataset_config:
                  type: string
                  description: JSON-formatted string containing dataset preprocessing and split configuration.
                  example: "{\n  \"preprocessing\": {\n    \"lazy_tokenize\": true,\n    \"streaming\": false,\n    \"prompt\": {\n      \"system\": null,\n      \"max_length\": 4096,\n      \"template\": null\n    }\n  },\n  \"split\": {\n    \"type\": \"random\",\n    \"ratios\": [0.9, 0.1]\n  }\n}\n"
                model_details:
                  type: string
                  description: JSON-formatted string containing model configuration including base model, quantization, and ownership details.
                  example: "{\n  \"base_model\": \"meta-llama/Llama-3.2-1B-Instruct\",\n  \"ownership\": \"public\",\n  \"source_type\": \"hf\",\n  \"model_type\": \"llm\",\n  \"quantization\": {\n    \"quant_bits\": 4\n  }\n}\n"
                train_config:
                  type: string
                  description: JSON-formatted string containing training configuration including hyperparameters, adapter settings, and distributed training options.
                  example: "{\n  \"type\": \"sft\",\n  \"torch_dtype\": \"bfloat16\",\n  \"task_type\": \"causal_lm\",\n  \"train_type\": \"lora\",\n  \"tuner_backend\": \"simplismart\",\n  \"hyperparameters\": {\n    \"num_epochs\": 1,\n    \"per_device_train_batch_size\": 8,\n    \"per_device_eval_batch_size\": 8,\n    \"gradient_checkpointing\": true,\n    \"save_steps\": 500,\n    \"save_total_limit\": 2,\n    \"eval_steps\": 500,\n    \"logging_steps\": 5,\n    \"learning_rate\": 0.0001,\n    \"dataloader_num_workers\": 1\n  },\n  \"adapter_config\": {\n    \"r\": 16,\n    \"alpha\": 16,\n    \"dropout\": 0.1,\n    \"targets\": [\"all-linear\"]\n  },\n  \"distributed\": {\n    \"type\": \"ddp\"\n  }\n}\n"
                dataset_details:
                  type: string
                  description: JSON-formatted string containing dataset information including path, format, and access credentials.
                  example: "{\n  \"dataset_name\": \"dataset-name\",\n  \"dataset_path\": \"s3://training-dev-datasets/ds/sharegpt_ds_half.jsonl\",\n  \"dataset_description\": \"\",\n  \"dataset_type\": \"jsonl\",\n  \"dataset_format\": \"sharegpt\",\n  \"source_type\": \"s3\",\n  \"ownership\": \"private\",\n  \"secret_id\": \"<your-secret-key>\",\n  \"region\": \"us-west-2\"\n}\n"
                infra_config:
                  type: string
                  description: JSON-formatted string containing infrastructure requirements including GPU type, count, and node configuration.
                  example: "{\n  \"gpu_type\": \"h100\",\n  \"gpu_count\": 2,\n  \"infra_type\": \"simplismart\",\n  \"node_count\": 2\n}\n"
              required:
              - org
              - experiment_name
              - dataset_config
              - model_details
              - train_config
              - dataset_details
              - infra_config
      responses:
        '200':
          description: Training job submitted successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TrainingJobResponse'
        '400':
          description: Invalid request, such as missing or incorrect parameters.
        '401':
          description: Unauthorized access due to invalid or missing authorization token.
        '500':
          description: Internal server error while creating the training job.
  /job/list/:
    get:
      tags:
      - Training
      summary: Retrieve a list of all LLM/VLM training jobs
      description: Fetches a list of all LLM or VLM training jobs associated with the specified organization. Each job includes details such as its ID, name, status, creation time, and other metadata.
      operationId: listTrainingJobs
      parameters:
      - in: query
        name: org_id
        schema:
          type: string
        required: true
        description: The unique identifier of the organization for which the training jobs are being retrieved.
        example: 0bf00b43-430a-4ca3-a8b3-b13cc8dc6d4f
      - in: header
        name: Authorization
        schema:
          type: string
        required: true
        description: The authorization token used to authenticate the request. It must be provided in the "Bearer {token}" format.
        example: Bearer <jwt-token>
      responses:
        '200':
          description: Successful response containing a list of training jobs.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListTrainingJobsResponse'
        '400':
          description: Invalid request, such as missing or incorrect parameters.
        '401':
          description: Unauthorized access due to invalid or missing authorization token.
        '500':
          description: Internal server error while retrieving the training jobs.
  /job/get/:
    get:
      tags:
      - Training
      summary: Retrieve details of a specific LLM/VLM training job
      description: Fetch metadata and configuration details of a training job identified by the provided request_id and org_id.
      operationId: getTrainingJob
      parameters:
      - in: query
        name: org_id
        schema:
          type: string
        required: true
        description: Organization ID to which the training job belongs.
        example: 0bf00b43-430a-4ca3-a8b3-b13cc8dc6d4f
      - in: query
        name: request_id
        schema:
          type: string
        required: true
        description: Unique identifier for the training job request.
        example: 3fe92c25-e5fd-4281-93df-5aa886064dbd
      - in: header
        name: Authorization
        schema:
          type: string
        required: true
        description: Bearer token for authentication and authorization.
        example: Bearer <jwt-token>
      responses:
        '200':
          description: The requested training job details were retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetTrainingJobResponse'
        '400':
          description: Invalid request, such as missing or incorrect parameters.
        '401':
          description: Unauthorized access due to invalid or missing authorization token.
        '404':
          description: Training job not found for the provided request_id and org_id.
        '500':
          description: Internal server error while retrieving the training job.
  /job/metrics/:
    get:
      tags:
      - Training
      summary: Retrieve LLM/VLM training metrics
      description: This endpoint allows you to fetch performance metrics for a specific LLM or VLM training job. Metrics include training accuracy, validation loss, and other relevant statistics logged during the training process.
      operationId: getTrainingMetrics
      parameters:
      - in: query
        name: org_id
        schema:
          type: string
        required: true
        description: The unique identifier of the organization for which the metrics are being requested.
        example: 0bf00b43-430a-4ca3-a8b3-b13cc8dc6d4f
      - in: query
        name: request_id
        schema:
          type: string
        required: true
        description: A unique identifier corresponding to the training job whose metrics are being fetched.
        example: c3c840b8-aee0-4b76-9da8-0ac4e0c0df8e
      - in: header
        name: Authorization
        schema:
          type: string
        required: true
        description: The authorization token used to authenticate the request. It should be provided in the "Bearer {token}" format.
        example: Bearer <jwt-token>
      responses:
        '200':
          description: Successful response containing the requested metrics.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MetricsResponse'
        '400':
          description: Invalid request, such as missing or incorrect parameters.
        '401':
          description: Unauthorized access due to invalid or missing authorization token.
        '404':
          description: Training job or metrics not found for the provided request_id and org_id.
        '500':
          description: Internal server error while retrieving the metrics.
components:
  schemas:
    DatasetConfig:
      type: object
      properties:
        preprocessing:
          type: object
          properties:
            lazy_tokenize:
              type: boolean
              description: Whether to tokenize lazily during training
            streaming:
              type: boolean
              description: Whether to use streaming mode for large datasets
            prompt:
              type: object
              properties:
                system:
                  type: string
                  nullable: true
                  description: System prompt to prepend to inputs
                max_length:
                  type: integer
                  description: Maximum token length for sequences
                template:
                  type: string
                  nullable: true
                  description: Custom prompt template
        split:
          type: object
          properties:
            type:
              type: string
              enum:
              - random
              - sequential
              description: Type of dataset split
            ratios:
              type: array
              items:
                type: number
              description: Split ratios for train/validation/test
    InfraConfig:
      type: object
      properties:
        gpu_type:
          type: string
          enum:
          - h100
          - a100
          - a10g
          - v100
          - t4
          description: Type of GPU to use for training
        gpu_count:
          type: integer
          minimum: 1
          description: Number of GPUs per node
        infra_type:
          type: string
          description: Infrastructure provider type
        node_count:
          type: integer
          minimum: 1
          description: Number of compute nodes for distributed training
    TrainConfig:
      type: object
      properties:
        type:
          type: string
          enum:
          - sft
          - dpo
          - ppo
          description: Training type (Supervised Fine-Tuning, Direct Preference Optimization, Proximal Policy Optimization)
        torch_dtype:
          type: string
          enum:
          - float16
          - bfloat16
          - float32
          description: PyTorch data type for training
        task_type:
          type: string
          enum:
          - causal_lm
          - seq2seq
          description: Task type for the model
        train_type:
          type: string
          enum:
          - lora
          - qlora
          - full
          description: Training method (LoRA, QLoRA, or Full fine-tuning)
        tuner_backend:
          type: string
          description: Backend used for parameter-efficient fine-tuning
        hyperparameters:
          type: object
          properties:
            num_epochs:
              type: integer
              description: Number of training epochs
            per_device_train_batch_size:
              type: integer
              description: Batch size per device for training
            per_device_eval_batch_size:
              type: integer
              description: Batch size per device for evaluation
            gradient_checkpointing:
              type: boolean
              description: Whether to use gradient checkpointing for memory efficiency
            save_steps:
              type: integer
              description: Save checkpoint every N steps
            save_total_limit:
              type: integer
              description: Maximum number of checkpoints to keep
            eval_steps:
              type: integer
              description: Evaluate model every N steps
            logging_steps:
              type: integer
              description: Log metrics every N steps
            learning_rate:
              type: number
              description: Learning rate for optimization
            dataloader_num_workers:
              type: integer
              description: Number of workers for data loading
        adapter_config:
          type: object
          properties:
            r:
              type: integer
              description: LoRA rank parameter
            alpha:
              type: integer
              description: LoRA alpha parameter for scaling
            dropout:
              type: number
              description: Dropout rate for adapter layers
            targets:
              type: array
              items:
                type: string
              description: Target modules for applying adapters
        distributed:
          type: object
          properties:
            type:
              type: string
              enum:
              - ddp
              - fsdp
              - deepspeed
              description: Distributed training strategy
    ListTrainingJobsResponse:
      type: object
      properties:
        jobs:
          type: array
          items:
            $ref: '#/components/schemas/TrainingJobSummary'
        total_count:
          type: integer
          description: Total number of training jobs
    TrainingJobSummary:
      type: object
      properties:
        request_id:
          type: string
          description: Unique identifier for the training job request
        experiment_name:
          type: string
          description: Name of the training experiment
        status:
          type: string
          description: Current status of the training job
          enum:
          - QUEUED
          - RUNNING
          - COMPLETED
          - FAILED
          - CANCELED
        created_at:
          type: string
          format: date-time
          description: Timestamp when the job was created
        updated_at:
          type: string
          format: date-time
          description: Timestamp when the job was last updated
        model_type:
          type: string
          description: Type of model being trained (LLM or VLM)
          enum:
          - llm
          - vlm
        base_model:
          type: string
          description: Base model used for training
        train_type:
          type: string
          description: Type of training (LoRA, QLoRA, Full)
          enum:
          - lora
          - qlora
          - full
        progress:
          type: number
          description: Progress percentage of the training job (0-100)
    MetricEntry:
      type: object
      properties:
        key:
          type: string
          description: Name of the metric (e.g., train_loss, eval_loss, learning_rate)
        value:
          type: number
          description: Value of the metric
        timestamp:
          type: string
          format: date-time
          description: Timestamp when the metric was recorded
        step:
          type: integer
          description: Training step at which the metric was recorded
        epoch:
          type: number
          description: Training epoch at which the metric was recorded
    DatasetDetails:
      type: object
      properties:
        dataset_name:
          type: string
          description: Name of the dataset
        dataset_path:
          type: string
          description: Path or URI to the dataset
        dataset_description:
          type: string
          description: Description of the dataset
        dataset_type:
          type: string
          enum:
          - jsonl
          - csv
          - parquet
          description: File format of the dataset
        dataset_format:
          type: string
          enum:
          - sharegpt
          - alpaca
          - instruction
          description: Data format/schema of the dataset
        source_type:
          type: string
          enum:
          - s3
          - gcs
          - local
          - hf
          description: Source location type
        ownership:
          type: string
          enum:
          - public
          - private
          description: Whether the dataset is publicly accessible or private
        secret_id:
          type: string
          description: ID of the secret containing credentials for private datasets
          nullable: true
        region:
          type: string
          description: Cloud region for the dataset storage
          nullable: true
    MetricsResponse:
      type: object
      properties:
        metrics:
          type: array
          items:
            $ref: '#/components/schemas/MetricEntry'
        request_id:
          type: string
          description: Training job request ID
    ModelDetails:
      type: object
      properties:
        base_model:
          type: string
          description: Base model identifier (e.g., HuggingFace model path)
        ownership:
          type: string
          enum:
          - public
          - private
          description: Whether the model is publicly accessible or private
        source_type:
          type: string
          enum:
          - hf
          - s3
          - local
          description: Source type for the base model
        model_type:
          type: string
          enum:
          - llm
          - vlm
          description: Type of model (Language Model or Vision-Language Model)
        quantization:
          type: object
          properties:
            quant_bits:
              type: integer
              enum:
              - 4
              - 8
              - 16
              description: Quantization bit precision
    TrainingJobResponse:
      type: object
      properties:
        request_id:
          type: string
          description: Unique identifier for the training job request
        status:
          type: string
          description: Initial status of the training job
          enum:
          - QUEUED
          - RUNNING
          - COMPLETED
          - FAILED
          - CANCELED
        message:
          type: string
          description: Additional information about the job submission
        experiment_name:
          type: string
          description: Name of the training experiment
    GetTrainingJobResponse:
      type: object
      properties:
        request_id:
          type: string
          description: Unique identifier for the training job request
        experiment_name:
          type: string
          description: Name of the training experiment
        status:
          type: string
          description: Current status of the training job
          enum:
          - QUEUED
          - RUNNING
          - COMPLETED
          - FAILED
          - CANCELED
        created_at:
          type: string
          format: date-time
          description: Timestamp when the job was created
        updated_at:
          type: string
          format: date-time
          description: Timestamp when the job was last updated
        started_at:
          type: string
          format: date-time
          description: Timestamp when the job started running
          nullable: true
        completed_at:
          type: string
          format: date-time
          description: Timestamp when the job completed
          nullable: true
        progress:
          type: number
          description: Progress percentage of the training job (0-100)
        dataset_config:
          $ref: '#/components/schemas/DatasetConfig'
        model_details:
          $ref: '#/components/schemas/ModelDetails'
        train_config:
          $ref: '#/components/schemas/TrainConfig'
        dataset_details:
          $ref: '#/components/schemas/DatasetDetails'
        infra_config:
          $ref: '#/components/schemas/InfraConfig'
        output_model_path:
          type: string
          description: Path to the trained model output (when completed)
          nullable: true
        error_message:
          type: string
          description: Error message if the job failed
          nullable: true
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT token for authentication