For the Streaming mode, we mix up the text and speech tokens in a pre-defined ratio of N to M, i.e. every N text tokens are followed by M speech tokens. If the next token is a text token, the model is expected to predict a filling token (rather than the text token), which indicates that the next N text tokens should be concatenated at the inference stage. Once the text tokens are ran out of, the ``turn of speech'' token and the remaining speech tokens are concatenated sequentially, forming the hybrid text-speech token sequence in the streaming mode. In our experiments, N and M are set to 5 and 15, respectively. By training the text-speech LM on the above two sequences simultaneously, we can perform streaming and non-streaming speech generation within a single unified model. In real-life scenarios, such as speaker fine-tuning (SFT) and in-context learning (ICL), the inference sequence differs. In ICL Non-Streaming, the prompt and to-synthesize text tokens are concatenated as the whole entity, and the prompt speech tokens are treated as the pre-generated results and are fixed. The autoregressive generation of LM is started from such sequence until the ``End of sequence'' token is detected. In ICL Streaming, we assume the to-generate text is already known and the speech tokens should be generated in a streaming manner. Similarly, we treat the prompt and to-generate text as a whole entity. Then, we mix it up with the prompt speech tokens on the ratio of N to M. If the length of text is greater than that of prompt speech tokens, the LM will generate a ``filling token''. In this situation, we manually pad N text tokens. If the text tokens run out of, the ``Turn of speech'' token will be added. In the streaming mode, we return generation results every M tokens until the end token is detected. In SFT Non-Streaming, the LM is fine-tuned on a specific speaker, and the prompt text and speech are no longer needed. Thus, the initial sequence is very simple: a ``start of sequence'' token, the text, and a ``turn of speech'' token. Starting from this, the text-speech LM can generate speech tokens autoregressively. In SFT Streaming, we start the speech generation from the sequence containing a ``start of sequence'' token and the first N text tokens. Then, the LM will generate M speech tokens, and we manually pad the next N text tokens. We repeat the above process until all text tokens run out of, and then a ``turn of speech'' token is added. Note that this mode can also be adopted by the speech-to-speech multi-modal large language models to obtain an extremely low latency. Chunk-aware Flow Matching In CosyVoice 2, we employ the Mel spectrogram as the acoustic feature with the frame rate of 50 Hz and the sampling rate of 24000. Due the frame-rate mismatch between speech tokens and Mel features, we up-sample the speech tokens with the ratio of two to match the frame rate of Mel spectrogram. Before the up-sampling operation, we add an additional look-ahead convolution layer to provide the future information for the following causal modules. The look-ahead layer is implemented by a right-padded 1-D convolution with the pad size of P and the kernel size of P+1. After these, several chunk-aware causal Transformer blocks are followed to align the representation space of speech tokens to match acoustic features. Subsequently, our goal is to further decode the speech tokens into the Mel spectrogram specified by the speaker embedding and reference speech.