Grammar-Constrained Generative Language Models for Flexible Classification

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Traditional classifiers require large training datasets and retraining when new categories are added, posing scalability challenges.

Innovation Solution

Employing a grammar-constrained generative language model to classify inputs by receiving a prompt, obtaining a grammar defining valid symbol sequences for categories, and generating a sequence of symbols identifying the classified categories.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If a typical classifier is trained on a large input sample to accurately classify inputs, then classification accuracy is improved, but the time and resources required for training increase

Engineering Contradiction:
Improveclassification accuracyVSAvoidtraining time
Core Design Contradiction:
Measurement precisionVSLoss of time

Solution Approach 1:

The generative language model is pre-trained on a broad corpus of text data to learn general language patterns, relationships, and world knowledge before being applied to classification tasks. This preliminary training enables the model to achieve accurate classification without requiring task-specific training on large labeled datasets, thereby reducing training time while maintaining or improving classification accuracy.

Inventive Principle:
Principle #10Preliminary action

2Measurement precision

If a classifier is recreated and retrained to classify within an updated taxonomy, then classification accuracy for new categories is improved, but the complexity and time required for model maintenance increase

Engineering Contradiction:
Improveclassification accuracy for new categoriesVSAvoidmodel maintenance complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The generative language model is designed to be universally applicable across multiple taxonomies and classification tasks. By leveraging its broad pre-trained knowledge and ability to understand contextual relationships, the model can adapt to new categories and taxonomies through prompt engineering or lightweight fine-tuning, rather than requiring complete model recreation. This multi-functionality reduces maintenance complexity while maintaining accuracy for both existing and new categories.

Inventive Principle:
Principle #6Universality (Multi-functionality)

3Measurement precision

If separate classifiers are used to classify each separate taxonomy, then classification accuracy for specific taxonomies is improved, but the number of models required and system complexity increase

Engineering Contradiction:
Improveclassification accuracy for specific taxonomiesVSAvoidscalability across taxonomies
Core Design Contradiction:
Measurement precisionVSAdaptability or versatility

Solution Approach 1:

A single generative language model is designed to handle multiple taxonomies and classification tasks simultaneously. The model's broad pre-trained knowledge and contextual understanding enable it to accurately classify inputs across different taxonomies (e.g., clothing items, car brands, products) without requiring separate specialized classifiers. This universality improves scalability while maintaining classification accuracy through techniques such as prompt engineering, few-shot learning, or task-specific fine-tuning.

Inventive Principle:
Principle #6Universality (Multi-functionality)

4Speed

If a typical classifier is provided only with limited input information, then processing speed is improved, but classification accuracy decreases

Engineering Contradiction:
Improveprocessing speedVSAvoidclassification accuracy
Core Design Contradiction:
SpeedVSMeasurement precision

Solution Approach 1:

The generative language model acts as an intermediary that enriches limited input information by leveraging its pre-trained knowledge. When presented with minimal input (e.g., 128 pixels or brief text), the model uses its internal representations of world knowledge, language patterns, and contextual relationships to infer and classify the input accurately. This intermediary role enables the model to maintain high classification accuracy even when provided with limited input information, while processing remains efficient compared to traditional classifiers requiring large training datasets.

Inventive Principle:
Principle #24Intermediary (Mediator)

Data Source

PatentUS20250292021A1Classification using a grammar-constrained generative language model
Publication Date: 2025.09.18 SHOPIFY INC
  • US20250292021A1 patent drawing
  • US20250292021A1 patent drawing
  • US20250292021A1 patent drawing

AI summary

Typical classifiers must be trained on a large input sample to accurately classify inputs. In addition, if a new classification category needs to be added to a taxonomy after the classifier has already been trained to classify within the taxonomy, the classifier must be recreated and retrained to classify within the updated taxonomy. To address at least these technical problems with classifiers, a generative language model may be used to perform classification. A generative language model is a machine learning model that generates language, typically in the form of a textual response to a data input. A generative language model may utilize a large neural network to determine probabilities for a next token of a sequence of text conditional on previous or historical tokens in the sequence of text. An LLM is an example of a generative language model.