Large language modeling method for hierarchical concept prediction

Through the large language modeling method of hierarchical concept prediction, the use of temporal multi-scale discrete quantization autoencoder and token tree probabilistic language model solves the problem of low data and computational efficiency of large language models in the temporal field in the existing technology. Efficient temporal modal generation is achieved.

CN118536087APending Publication Date: 2024-08-23李明
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410840141.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-26
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

Existing large language models have low data efficiency and computational efficiency in time series-related fields, especially when dealing with increasingly larger data and the need for larger context windows, and visual autoregressive models cannot establish relationships between concepts at different scales. The connection cannot directly adapt to the requirements for efficient and real-time generation of text, audio and video and other temporal modalities.

Method used

Using the large language modeling method of hierarchical concept prediction, the time series data is converted into hierarchical concept tokens through the temporal multi-scale discrete quantization autoencoder (Seq-MultiScale VQVAE), a hierarchical concept token tree is constructed, and a token-based The probabilistic language model of the card tree and the causal mask decoding transformer perform autoregressive modeling to predict the next concept to improve data and computational efficiency and achieve on-the-fly generation.

Benefits of technology

It achieves higher data and computing efficiency, has better reasoning capabilities, and has the characteristics of instant generation of temporal modalities, suitable for temporal modalities such as text, audio, and video.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118536087A
    Figure CN118536087A
Patent Text Reader

Abstract

The invention provides a large language modeling method for hierarchical concept prediction, and aims to improve the efficiency and reasoning performance of a large language model through the method. Comprising the following steps of: converting time sequence data represented by a text into a hierarchical concept token tree by using a time sequence multi-scale discrete quantization automatic encoder (Seq-Multiscale VQVAE), and providing a probability language model based on the hierarchical concept token tree and an autoregression modeling method based on the probability language model of the token tree. Compared with a traditional method for predicting the next word, the large language modeling method for hierarchical concept prediction has better data efficiency by predicting the next concept, and better reasoning performance can be obtained; in addition, the probability model based on the hierarchical concept token tree can greatly reduce the attention length of the corresponding autoregression method, thereby improving the training and reasoning efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of Big Language Modeling (LLM), including but not limited to time-series related fields such as language, audio, and video, and specifically to a big language modeling method for hierarchical concept prediction, and its application in time-series related fields. Background Art

[0002] With the rise of generative artificial intelligence (AIGC) such as ChatGPT, large language models (LLMs) dominate today's cutting-edge artificial intelligence research. In addition to modeling language and text, multimodalities such as sound and video are gradually being included in the application scope of LLM.

[0003] The core paradigm of the current large language model is to predict the next word (token). By using large-scale computing power to train massive data, the model is forced to learn reasoning capabilities. Since the next word's dependence on historical context decays exponentially, this learning method has low data efficiency. Considering the increasing computing power and data costs, a more efficient learning paradigm is urgently needed. In addition, large language models currently still mainly use the Transformer model based on the attention mechanism, and the complexity of the attention mechanism is quadratic with the context window. With the requirement for larger context windows, a more efficient modeling method is needed than the classic Transformer model.

[0004] Recently, the visual autoregressive model (VAR) has achieved good results in the field of image generation based on "predicting the next scale", but it has not established a connection between the concepts of different scales, especially without considering the order of time. Therefore, it cannot be directly adapted to time series modalities such as text, audio and video, especially their requirements for efficient and instant generation.

[0005] The large language modeling method for hierarchical concept prediction proposed in the present invention constructs hierarchical concepts at different scales of time series, and establishes connections between concepts at different levels through a probability model. It achieves higher data efficiency by predicting the next concept rather than the next word. In addition, it has both high computational efficiency and the instant generation characteristics of time series modality. Summary of the invention

[0006] The present invention provides a large language modeling method for hierarchical concept prediction, which has better data and computing efficiency and instant generation characteristics, and has the potential to show better reasoning ability. For the sake of brevity, the following takes text as an example, and other time series modalities can be adapted with slight adjustments (for example, for video modality, combining the time series modeling method of the present invention with the spatial modeling method of VAR can achieve instant video generation).

[0007] The present invention is implemented by the following technical solution, which is described in three parts:

[0008] 1. A Sequence Multi-Scale VQVAE (Seq-MultiScale VQVAE) is used to convert a time series data into hierarchical concept tokens, represented by text, including the following steps:

[0009] Step 1: Text segmentation and segmentation. Use a traditional tokenizer (such as BPE tokenizer) to convert the original long text corpus into a sequence of word tokens and segment it into several segments of length L as shown below: , W is the size of the word list obtained by the word segmenter:

[0010]

[0011] Step 2: Use the Seq-MultiScale VQVAE algorithm (as shown in the following pseudo code) to convert Segment s into a hierarchical concept token sequence set R. represents word embedding; K represents the number of hierarchical concept layers, represents the size of the concept token sequence at the kth level; Represents features for finding token sequences from word embeddings or codebooks; represents the encoder, you can choose the commonly used convolution or transformer model; Bilinear interpolation is used to downsample sequence features; Defined as: ,in represents the code book, Indicates the codebook size; It is a 1x1 convolution; represents nearest neighbor interpolation; Represents the decoder, using the Causal Mask Decoder-Only Transformer to achieve the requirements of real-time decoding.

[0012]

[0013] Step 3: Seq-MultiScale VQVAE training. The training is done in the same way as Multi-Scale VQVAE, except that the reconstruction loss is replaced by the classification loss for the text.

[0014] 2. A probabilistic language model based on a hierarchical concept token tree, comprising the following steps:

[0015] Step 1: Construct a hierarchical concept token tree. Through the above Seq-MultiScale VQVAE, Converted into a hierarchical concept token sequence ; first add s to R in an optional way, , It means that each element of s is added with the codebook size to prevent token ambiguity, so that the subsequent autoregressive model can directly obtain s without the need to use Seq-MultiScale VQVAE to decode R additionally. , ; Then for any , define its parent node as ,make Unified into a virtual root node , thus converting a segment s into a concept token tree , Seq-MultiScale VQVAE It is to perform neighbor interpolation according to the connection relationship between the token tree levels; multiple segments The long text composed of the corresponding multiple concept token trees is arranged from left to right in sequence, and all virtual root nodes are merged, so that the concept token tree of the long text is obtained. Starting from the virtual root node, traverse the concept token tree in depth-first order, and define a unique serial number from small to large for all concept tokens. , so that it can be Define different levels of front nodes: express The nth predecessor node of the i-th layer, for example express The parent node of .

[0016] Step 2: The probabilistic language model based on the token tree is as follows, where Indicates that the qth layer token depends on the number of previous nodes in the kth layer. Taking a smaller value can rely on a longer and more complete semantic range and different semantic granularities, so efficient sparse modeling can be performed based on this probabilistic language model.

[0017]

[0018] 3. The autoregressive modeling method based on the token tree probabilistic language model includes the following contents:

[0019] Adopt causal mask decoder-only transformer; according to Output in order from small to large , the corresponding input includes: the embedding of the parent node Or cumulative embedding , the first preceding node at the same level is embedded Or cumulative embedding , embedding(k) of level k, each item is interpolated and summed after full connection as input, where the cumulative embedding It refers to the sum of all node embeddings in the process of tracing back to the root node, and is defined as follows;

[0020]

[0021] Position coding uses absolute position coding or rotational position coding, corresponding to the position It refers to the average position of the corresponding leaf node and is defined as follows:

[0022]

[0023] The Attension Mask is a sparse lower triangular matrix composed of the token tree probabilistic language model OK; trained using cross-entropy loss For other continuous modalities such as video, tokens may be processed into continuous vector representations , Diffusion loss is used for training .

[0024] Similarly, a causal mask encoder-decoder transformer (Causual Mask Encoder-Decoder Transformer) can also be used. In this case, the position encoding and Self-Attension Mask of the Encoder and Decoder are the same as described above. The diagonal of the Mask is set to zero as the Cross-Attension Mask of the Decoder. The Encoder input is the level k embedding and the current node embedding or the cumulative embedding. The Decoder input is only the level k embedding. The rest is similar and will not be repeated. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. They are used to explain the present invention together with the embodiments of the present invention and do not constitute a limitation of the present invention.

[0026] In the attached picture:

[0027] Figure 1 It is the overall framework diagram in the example of the present invention.

[0028] Figure 2 It is a schematic diagram of word segmentation in an example of the present invention.

[0029] Figure 3 It is a schematic diagram of a temporal multi-scale discrete quantization automatic encoder in an example of the present invention.

[0030] Figure 4 It is a schematic diagram of the hierarchical concept token tree in the example of the present invention.

[0031] Figure 5 It is a schematic diagram of a probabilistic language model based on a token tree in an example of the present invention.

[0032] Figure 6 It is a schematic diagram of the concept token tree node position definition in the example of the present invention.

[0033] Figure 7 It is a schematic diagram of the causal mask decoding transformer autoregressive model in an example of the present invention. DETAILED DESCRIPTION

[0034] In order to more clearly illustrate the purpose, technical solutions and advantages of the present invention, the following is a further detailed description in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.

[0035] Example: Figure 1 As shown, the present invention provides a large language modeling method for hierarchical concept prediction, which includes three parts: first, a temporal multi-scale discrete quantization autoencoder; second, a probabilistic language model based on a hierarchical concept token tree; third, an autoregressive modeling method based on a token tree probabilistic language model; the following is an introduction according to these three parts:

[0036] 1. A Sequence Multi-Scale VQVAE (Seq-MultiScale VQVAE) is used to convert a time series data into hierarchical concept tokens, represented by text, including the following steps:

[0037] Step 1: Text segmentation and segmentation. Use a traditional tokenizer (such as BPE tokenizer) to convert the original long text corpus into a sequence of word tokens and segment it into several segments of length L as shown below: , W is the size of the word list obtained by the word segmenter:

[0038]

[0039] In this embodiment, if Figure 2As shown in the figure, after a long text is tokenized (using the BPE tokenizer, with W=10000), it is divided into several segments in sequence. , each segment contains 32 tokens, i.e., L=32.

[0040] Step 2: Use the Seq-MultiScale VQVAE algorithm (as shown in the following pseudo code) to convert Segments s into a hierarchical concept token sequence set R. represents word embedding; K represents the number of hierarchical concept layers, represents the size of the concept token sequence at the kth level; Represents features for finding token sequences from word embeddings or codebooks; represents the encoder, you can choose the commonly used convolution or transformer model; Bilinear interpolation is used to downsample sequence features; Defined as: ,in represents the code book, Indicates the codebook size; It is a 1x1 convolution; represents nearest neighbor interpolation; Representing the decoder, the Causal Mask Decoder-Only Transformer is selected to achieve the requirement of instant decoding.

[0041]

[0042] In this embodiment, if Figure 3 As shown in the figure, C=1024 represents the embedding dimension and V=10000 represents the codebook size. First, embedding The 32 tokens of are converted into 32x1024-dimensional input features; then Use CNN or Transformer to downsample by 4 times; Perform quantization and feature reconstruction; then Restore the original resolution using nearest neighbor upsampling and causal mask decoding transformer;

[0043] Step 3: Seq-MultiScale VQVAE training. The training is done in the same way as Multi-Scale VQVAE, except that the reconstruction loss is replaced by the classification loss for the text.

[0044] In this example, if Figure 3 As shown, after the training is completed, we get The hierarchical concept token set: R = [

[4297] , [6329, 4328], [8462, 3289, 7239, 238], [3298, 983, 8723, 7396, 1876, 2387,6832, 3953]].

[0045] 2. A probabilistic language model based on a hierarchical concept token tree, comprising the following steps:

[0046] Step 1: Construct a hierarchical concept token tree. Through the above Seq-MultiScale VQVAE, Converted into a hierarchical concept token sequence ; first add s to R in an optional way, , It means that each element of s is added with the codebook size to prevent token ambiguity, so that the subsequent autoregressive model can directly obtain s without the need to use Seq-MultiScale VQVAE to decode R additionally. , ; Then for any , define its parent node as ,make Unified into a virtual root node , thus converting a segment s into a concept token tree , Seq-MultiScale VQVAE It is to perform neighbor interpolation according to the connection relationship between the token tree levels; multiple segments The long text composed of can make the corresponding multiple concept token trees arranged in order from left to right, and merge all the virtual root nodes, so as to obtain the concept token tree of the long text Starting from the virtual root node, traverse the concept token tree in depth-first order, and define a unique serial number from small to large for all concept tokens. , so that it can be Define different levels of front nodes: express The nth predecessor node of the i-th layer, for example express The parent node of .

[0047] In this example, if Figure 4 As shown, Add R after adding V, because , so the conversion is a complete tree with a degree of 2 or 4. The corresponding complete tree merges the virtual root nodes from left to right to get Rt. Figure 5 As shown, starting from the virtual root node, traversing Rt in depth-first order, a unique sequence number from small to large can be defined for all concept tokens. .

[0048] Step 2: The probabilistic language model based on the token tree is as follows, where Indicates that the qth layer token depends on the number of previous nodes in the kth layer. Taking a smaller value can rely on a longer and more complete semantic range and different semantic granularities, so efficient sparse modeling can be performed based on this probabilistic language model.

[0049]

[0050] In this example, if Figure 5 As shown, take , and obtain the corresponding probabilistic language model. The dotted arrow in the figure indicates The concept of probabilistic dependencies of tokens.

[0051] 3. The autoregressive modeling method based on the token tree probabilistic language model includes the following contents:

[0052] Adopt causal mask decoder-only transformer; according to Output in order from small to large , the corresponding input includes: the embedding of the parent node Or cumulative embedding , the first preceding node at the same level is embedded Or cumulative embedding , embedding(k) of level k, each item is interpolated and summed after full connection as input, where the cumulative embedding It refers to the sum of all node embeddings in the process of tracing back to the root node, and is defined as follows;

[0053]

[0054] Position coding uses absolute position coding or rotational position coding, corresponding to the position It refers to the average position of the corresponding leaf node and is defined as follows:

[0055]

[0056] The Attension Mask is a sparse lower triangular matrix composed of the token tree probabilistic language model OK; trained using cross-entropy loss .

[0057] In this example, if Figure 6 As shown, the position of each node is shown by the node number in the figure; Figure 7 As shown in the figure, the causal mask decoding transformer model structure, the node input with id 20 includes the embedding of the parent node 14, the embedding of the first predecessor node 15 at the same level, and the embedding of level 4, the encoding of position 13.5, and then passes through several layers of transformers to obtain the logits for cross entropy loss training, and the true value of the corresponding cross entropy loss is Figure 4 The token number of the corresponding node in the token tree is 7396, and the arrow topology between layers in the graph is determined by the Atttension Mask.

[0058] Finally, it should be noted that the above are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A Sequence Multi-Scale Discrete Quantized Autoencoder (Seq-MultiScale VQVAE) is used to convert a time series data into hierarchical concept tokens, represented by text, characterized by: It includes the following steps: Step 1: Text segmentation and segmentation. Use a traditional tokenizer (such as BPE tokenizer) to convert the original long text corpus into a sequence of word tokens and segment it into several segments of length L as shown below: , W is the size of the word list obtained by the word segmenter: Step 2: Use the Seq-MultiScale VQVAE algorithm (as shown in the following pseudo code) to convert Segment s into a hierarchical concept token sequence set R. represents word embedding; K represents the number of hierarchical concept layers, represents the size of the concept token sequence at the kth level; Represents features for finding token sequences from word embeddings or codebooks; represents the encoder, you can choose the commonly used convolution or transformer model; Bilinear interpolation is used to downsample sequence features; Defined as: ,in represents the code book, Indicates the codebook size; It is a 1x1 convolution; represents nearest neighbor interpolation; Represents the decoder, using the Causal Mask Decoder-Only Transformer to achieve the requirements of real-time decoding. Step 3: Seq-MultiScale VQVAE training. The training is done in the same way as Multi-Scale VQVAE, except that the reconstruction loss is replaced by the classification loss for the text.

2. A probabilistic language model based on a hierarchical concept token tree, characterized in that It includes the following steps: Step 1: construct a hierarchical concept token tree. Through the Seq-MultiScale VQVAE of claim 1, Converted into a hierarchical concept token sequence ; first add s to R in an optional way, , It means that each element of s is added with the codebook size to prevent token ambiguity, so that the autoregressive model can directly obtain s without using Seq-MultiScale VQVAE to decode R additionally. , ; Then for any , define its parent node as ,make Unified into a virtual root node , thus converting a segment s into a concept token tree , in Seq-MultiScale VQVAE in Claim 1 It is to perform neighbor interpolation according to the connection relationship between the token tree levels; it consists of multiple segments The long text composed of multiple concept token trees is arranged in order from left to right, and all virtual root nodes are merged, so that the concept token tree of the long text is obtained. Starting from the virtual root node, traverse the concept token tree in depth-first order, and define a unique serial number from small to large for all concept tokens. , so that it can be Define different levels of front nodes: express The nth predecessor node of the i-th layer, such as express The parent node of . Step 2: The probabilistic language model based on the token tree is as follows, where Indicates that the qth layer token depends on the number of previous nodes in the kth layer. Taking a smaller value can rely on a longer and more complete semantic range and different semantic granularities, so efficient sparse modeling can be performed based on this probabilistic language model.

3. An autoregressive modeling method based on a token tree probabilistic language model, characterized in that: It includes the following: Adopt causal mask decoder-only transformer; according to Output in order from small to large , the corresponding input includes: the embedding of the parent node Or cumulative embedding , the first preceding node at the same level is embedded Or cumulative embedding , embedding(k) of level k, each item is interpolated and summed after full connection as input, where the cumulative embedding It refers to the sum of all node embeddings in the process of tracing back to the root node, and is defined as follows; Position coding uses absolute position coding or rotational position coding, corresponding to the position It refers to the average position of the corresponding leaf node and is defined as follows: The Attension Mask is a sparse lower triangular matrix composed of the token tree probabilistic language model OK; trained using cross-entropy loss For other continuous modalities such as video, tokens may be processed into continuous vector representations , Diffusion loss is used for training . Similarly, a causal mask encoder-decoder transformer (Causual Mask Encoder-Decoder Transformer) can also be used. In this case, the position encoding and Self-Attension Mask of the Encoder and Decoder are the same as described above. The diagonal of the Mask is set to zero as the Cross-Attension Mask of the Decoder. The Encoder input is the level k embedding and the current node embedding or the cumulative embedding. The Decoder input is only the level k embedding. The rest is similar and will not be repeated.

4. Application of large language modeling based on hierarchical concept prediction in real-time content generation of other temporal modalities such as audio and video, characterized by: It includes the following: For other time series modalities such as audio and video, the methods described in claims 1 to 3 are used for modeling in the time series dimension, and other dimensions are modeled using other autoregressive methods (such as VAR).

Citation Information

Cited By

  • Audio and video generation method, electronic equipment and computer readable storage medium

    CN119295618A

  • Three-dimensional model generation method and system based on multi-scale autoregression model

    CN119904582A