Skip to content

Optimize Question Classifier Performance by Removing category_name from LLM Output #31103

@FutaoSmile

Description

@FutaoSmile

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • Please do not modify this template :) and fill in all the required fields.

1. Is this request related to a challenge you're experiencing? Tell me about your story.

Issue Description

Problem

Currently, the question classifier requires the LLM to output both category_id and category_name in its response. When category descriptions are very long, the model spends most of its time generating the category name text, which significantly increases the classifier's latency.

Proposed Solution

Modify the question classifier to only require the LLM to output category_id. The category_name can be retrieved from the internal classes map using the category_id, eliminating the need for the LLM to generate it.

Benefits

  • Significant performance improvement: For classifiers with long category descriptions, this optimization can reduce response time to sub-second levels
  • Stable latency: Classification time becomes more predictable and consistent
  • Cost reduction: Fewer output tokens means lower API costs
  • No functionality loss: The final output still includes both category_id and category_name

2. Additional context or comments

No response

3. Can you help us with this feature?

  • I am interested in contributing to this feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions