Skip to content

Instantly share code, notes, and snippets.

@gbraad
Last active July 2, 2025 03:12
Show Gist options
  • Save gbraad/e46bd2ddffbc2108b45747f55a032c96 to your computer and use it in GitHub Desktop.
Save gbraad/e46bd2ddffbc2108b45747f55a032c96 to your computer and use it in GitHub Desktop.
Investigating how well LLMs can generate sequence diagrams

Sequence diagrams

Investigating how well LLMs can generate sequence diagrams, based on simple prompts on the crc-org/vfkit codebase.

Honestly, a lot of tools in the 00's were able to generate more insightful images.

Claude 3.7

sequenceDiagram
    participant User
    participant VFKit as vfkit CLI
    participant RunVFKit as runVFKit()
    participant Config as VM Configuration
    participant NewVM as NewVirtualMachine()
    participant RunVM as runVirtualMachine()
    participant VM as Virtual Machine
    
    User->>VFKit: Executes vfkit command with VM configuration<br>(--cpus, --memory, --bootloader, --device, etc.)
    VFKit->>Config: Parse command line options into VM configuration
    VFKit->>RunVFKit: Call runVFKit() with VM config
    RunVFKit->>NewVM: vf.NewVirtualMachine(*vmConfig)
    NewVM-->>RunVFKit: Return VM instance
    
    opt REST API is enabled
        RunVFKit->>RunVFKit: Start REST API server
    end
    
    RunVFKit->>RunVFKit: Set up signal handling for graceful shutdown
    RunVFKit->>RunVM: Call runVirtualMachine() with VM config and instance
    
    opt Ignition config exists
        RunVM->>RunVM: Start Ignition provisioner server in goroutine
    end
    
    RunVM->>VM: vm.Start()
    RunVM->>VM: Wait for VM state to become Running
    RunVM-->>User: Log "virtual machine is running"
    
    opt VirtioVsock devices exist
        RunVM->>VM: Configure VirtioVsock devices
        RunVM->>VM: Call vf.ExposeVsock() for each device
    end
    
    RunVM->>VM: Configure network block devices
    RunVM->>VM: Set up guest time sync
    RunVM-->>User: Log "waiting for VM to stop"
    
    opt VM has GUI configured
        RunVM->>VM: Start graphic application
    end
    
    RunVM->>RunVM: Wait for VM to stop in goroutine
    
    alt User terminates vfkit
        User->>VFKit: Ctrl+C or kill signal
        VFKit->>VM: Request VM stop
        VM->>VM: Graceful shutdown
    else VM exits on its own
        VM->>RunVM: VM stopped
    end
    
    VM-->>RunVM: Return VM stopped state
    RunVM-->>RunVFKit: VM execution completed
    RunVFKit-->>VFKit: Process exits
Loading

Gemini 2.5

sequenceDiagram
    participant user as User
    participant vfkit as vfkit CLI
    participant main as cmd/vfkit/main.go
    participant vf as pkg/vf/vm.go
    participant vz as VirtualizationFramework

    user->>vfkit: Executes `vfkit` command with arguments
    vfkit->>main: `runVFKit(vmConfig, opts)`
    main->>vf: `NewVirtualMachine(vmConfig)`
    vf-->>main: returns `vfVM`
    main->>main: `runVirtualMachine(vmConfig, vfVM)`
    main->>vf: `vm.Start()`
    vf->>vf: `toVz()`
    vf->>vz: `NewVirtualMachine(config)`
    vz-->>vf: returns `vz.VirtualMachine`
    vf->>vz: `vz.VirtualMachine.Start()`
    vz-->>vf: returns error (or nil)
    vf-->>main: returns error (or nil)
    main->>main: `waitForVMState(vm, vz.VirtualMachineStateRunning)`
    main-->>user: Logs "virtual machine is running"
Loading

GTP 4o

sequenceDiagram
    participant User
    participant CLI
    participant VirtualizationManager
    participant Hypervisor
    participant VMInstance

    User->>CLI: Start Virtualization
    CLI->>VirtualizationManager: Initialize Virtualization
    VirtualizationManager->>Hypervisor: Load Hypervisor
    Hypervisor->>VMInstance: Create Virtual Machine Instance
    VMInstance->>Hypervisor: Report Ready
    Hypervisor->>VirtualizationManager: Virtual Machine Ready
    VirtualizationManager->>CLI: Virtualization Started
    CLI->>User: Virtualization Successfully Started
Loading

GPT 4.1

FAILED, with parsing errors... over and over...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment