Treewalker maps ungrounded Gemini outputs by evaluating token log-probability values, converting them to confidence percentages, and isolating alternative candidate tokens from the response's top-5 candidates to explore alternative associative branches.

flowchart TD
    A[Initial Prompt] --> B[Token Step 1]
    B --> C[Token Step 2]
    C --> D{Top-5 Logprobs}

    D -->|Prob >= Threshold| E[Primary Token]
    D -->|Prob >= Threshold| F[Candidate Branch A]
    D -->|Prob >= Threshold| G[Candidate Branch B]
    D -->|Prob < Threshold| H[Pruned Candidate]

    E --> I[Primary Completion]
    F --> J[Spawn Run A]
    G --> K[Spawn Run B]

    J --> L[Associative Subtree A]
    K --> M[Associative Subtree B]