section introduction in this section we introduce the model architecture of llama Omni it consists of a speech encoder a speech adapter a large language model llm and a speech decoder we refer to the user speech instruction text response and speech response as X karat s y carat t and Y carat s respectively for the speech encoder we utilize the encoder from whisper large V3 whisper is a versatile speech recognition model trained on extensive audio data allowing it to extract meaningful representations from speech specifically for the user speech instruction X karat s the encoded speech representation is denoted as H which is a sequence of speech representations we keep the parameters of the speech encoder fixed during the entire training process next to help the llm understand the input speech we introduce a trainable speech adapter a this adapter Maps the speech representations into the llms embedding space it first reduces the sequence length by downsampling the speech representations H combining every K consecutive frames along the feature Dimension then H is processed through a two- layer perceptron with reu activation resulting in the final speech representation s for the llm we use LL ma 3. 1 to 8B instruct which is currently the leading open- Source llm known for its strong reasoning abilities in alignment with human preferences we fill the speech representation sequence s into a designated position in a prompt template and then input the entire sequence into the llm finally the llm generates the text response y carat t directly based on the speech instruction using cross entropy laws for training section summary in this section we introduce llama Omni a novel model architecture designed for low latency and highquality speech interaction with large language models llms it integrates a speech encoder a speech adapter an llm and a streaming speech decoder allowing direct generation of text and speech responses from user speech instructions while significantly reducing training data and computational resource requirements section speech decoder in this section we describe our speech decoder for the speech response we first convert the speech into discrete units we utilize a pre-trained Hubert model to obtain continuous speech representations which we then transform into discrete cluster indices using AKA means model we merge consecutive identical indices into single units resulting in a sequence of discrete units these units can be turned into waveforms with a unit-based vocoder to generate speech responses alongside text responses we add a streaming speech decoder after the language model this decoder consists of several Transformer layers similar to llama each with a causal self attention module and a feed forward Network it operates in a non- autoaggressive manner taking the output hidden States from the language model to produce the discrete unit sequence for the speech response we denote the output hidden States related to the text response as a sequence we first upsample each hidden State into chunks creating an upsampled hidden State sequence this sequence is then input into the speech decoder producing an output hidden State sequence we align this output with the discrete unit sequence using connectionist temporal classification CTC which includes a special blank token to extend the output space CTC helps model the variable length mapping between input and output by merging consecutive repeated tokens and removing blank tokens during training we use a two-stage strategy for llama Omni in the first stage we train the model to generate text responses from speech instructions keeping the speech encoder Frozen in the second stage we focus on generating speech responses freezing the speech encoder adapter and language model while training only the speech decoder during inference the language model generates text responses based on speech instructions as the model generates text the corresponding upsampled hidden states are fed into the speech decoder to create a partial alignment which gives us the discrete units for the generated text prefix when the number of generated units reaches a set chunk size we input this segment into the vocoder to synthesize a speech segment allowing users to hear the response without waiting for the full text to be generated this approach ensures low response latency unaffected by text length the algorithm outlines this process and since our speech decoder uses non-auto regressive modeling the alignment for each text token is generated in parallel maintaining a similar decoding speed for both text and speech Generation section summary in this section we describe our speech decoder which converts speech into discrete units using a pre-trained Hubert model and K means clustering and generates speech responses in parallel with text responses through a non-auto regressive trans Transformer based architecture we Implement a two-stage training strategy first focusing on text response generation and then on training the speech decoder allowing for low latency speech synthesis that begins as soon as a predefined number of units are generated section construction of speech instruction data instructs 2 S2000 K in this section we describe how we constructed the speech instruction data known as instructs 2s S2000 K to train llama Omni we require triplet data that includes speech instructions text responses and speech responses however most available instruction data is in text format first we rewrite the text instructions to better fit speech input we follow these rules one we add filler words like hey and um to mimic natural speech two we convert symbols such as numbers into their spoken equivalents for accurate text to speech synthesis three we keep the instructions brief and avoid unnecessary words we utilize the Llama 3 to 70b instruct model for this rewriting process next we generate responses for the speech instructions text responses are often too long and complex for speech so we apply these rules one we exclude any content that cannot be synthesized by the text to speech model like lists or parentheses two we ensure the responses are concise and direct again we use the Llama 3 to 70b instruct model for this task after we have the suitable instructions and responses we convert them into speech using text to speech models for the instructions we use the COS y v i C300 msft model randomly selecting a male or female voice for each one for the responses we apply the vixs model trained on the LJ speech data set to create a standard voice we gather around 50,000 instructions from the alpaca data set and about 15,000 from the ultra chat data set focusing on the first 150,000 entries this process results in a total of 200,000 speech instruction data which we call instructs 2 S2000 k for our experiments we use the instructs 2 S2000 K data set for training we extract discrete units for the Target speech using a pre-trained k means quantizer that has identified 1,000 clusters from Huber features we then synthesize these units into waveforms with the Hi-Fi gono coder for evaluation we select two subsets from alpaca eval removing math and code related questions resulting in 19 instructions we synthesize these into speech using the c y v i C300 mftt model referring to this test set as instructs 2 s ofal in terms of model configuration we use the encoder from whisper large V3 as our speech encoder and LL ma 3. 1 to 8B instruct as our language model the speech adapter downsamples the speech representations by five times the speech decoder consists of two Transformer layers similar to llama with specific dimensions and a total of 425 million parameters we set the upsample factor to 25 and the minimum unit chunk size to Infinity meaning we wait for the entire sequence to be generated before synthesizing speech in future experiments we will explore how adjusting this chunk size affects response latency and the balance between latency and speech quality finally llama Omni under there goes a two-stage training process in the first stage we train the speech adapter and the language model with a batch size of 32 for three epics using a cosine learning rate scheduler in the second stage we train the speech decoder with the same batch size and learning rate schedule but with a higher Peak learning rate the entire training takes about 65 hours on 4 Nvidia l40 GPS section summary in this section we describe the construction of the instructs 2 S2000 K data set which involves rewriting text instructions for natural speech generating concise speech responses and synthesizing them using TTS models ultimately resulting in 200k speech instruction data we also outline our training process for llama Omni which includes a two-stage training approach for the speech adapter and decoder taking approximately 65 hours on 4 Nvidia l40 GPS section evaluation in this section we evaluate llama omni's performance in generating both text and speech responses based on speech instructions we focus on two tasks speech to text instruction following s2t and speech to speech instruction following S2s using a greedy search method for consistent results to assess how well the model follows speech instructions we employ gp40 to score its responses for the S2 Tiff task we score based on the transcribed text of the speech instructions and the models text response for S2s we first convert the model speech responses to text using the whisper large V3 model and then score it similarly gp4 evaluates responses on content which checks if the model addresses the user's instruction and style which looks at the appropriateness of the response for speech interaction more details are available in the appendix next we examine the alignment between text and speech responses by transcribing the speech responses into text and calculating the word error rate weer and character error rate CER we label these metrics as oser weer and oser CER for speech quality we use a mean opinion score MOS prediction model called utmos to assess the naturalness of the generated speech referred to as the utmos score response latency is another important metric measuring the time from when a speech instruction is given to when the speech response starts we also track the number of words generated in the text response when the speech response begins which we call the hashtag lagging word We compare our model against Baseline systems speech GPT is a speech language model that handles both speech input and output using a chain of modality prompting method for decoding s m o NN is a large language model that accepts speech and audio inputs responding with text for the S2 Tiff task and we enhance it with a vits TTS model for S2 siif quen 2 audio is a versatile audio understanding model that also performs the S2 Tiff task and we build a cascaded system with vits for S2s our main results presented in a table show that for the S2 Tiff task llama Omni significantly outperforms previous models in content thanks to its foundation on the advanced Lama 3.
1 to 8B instruct model in terms of style salmon and others score lower because they are primarily speech to text models often producing formatted content that doesn't fit speech interactions in contrast speech GPT and llama Omni achieve higher style scores with llama Omni showing excellent alignment with speech interaction scenarios after training on our instructs 2 S2000 K data set for the S2s task llama Omni again excels in both content and style scores confirming its Effectiveness in addressing user instructions concisely additionally llama Omni achieves the lowest oser wer and AER CER scores indicating strong alignment between speech and text responses in comparison speech GPT struggles with this alignment due to its sequential generation process the cascaded systems like salmon plus TTS and quen 2 Audio Plus TTS also show suboptimal alignment particularly when generated text includes characters that can't be synthesized into speech llama omni's performance highlights the benefits of generating both text and speech responses simultaneously section summary in this section we evaluate llama omni's performance on speech to text and speech to speech instruction following tasks using various metrics including content and style scores from GPT 40 speech text alignment through word and character error rates and speech quality assessed by the utmos score our results show that llama Omni significantly outperforms previous models in both content and style achieving the best alignment between generated speech and text responses section tradeoff between speech quality and response latency in this section we discuss the balance between speech quality and response latency in our model llama Omni this model can generate both text and speech responses at the same time to facilitate streaming waveform generation we feed chunks of generated units into the vocoder for speech synthesis once we reach a specific size which we refer to as Omega by changing Omega we can manage the system's latency a smaller Omega leads to lower latency if Omega is set to Infinity we wait for all units to be generated before synthesizing speech however a smaller Omega can also affect speech quality as it breaks the speech into more segments which might create gaps and reduce coherence we analyze how different Omega settings impact latency the alignment of speech and text and the quality of the generated speech for instance when Omega is set to 10 we achieve a response latency of just 226 millisecs which is faster than GPT 40's average latency of 320 milliseconds although the speech response may lag by about 1. 82 words initially conversely setting Omega to Infinity increases latency to around 2 seconds interestingly we find that as Omega increases the error rates in our ocer metrics also o rise we suspect this is because the vocoder performs better with shorter sequences and our ocer model whisper large V3 is robust enough to handle some discontinuities without significantly affecting recognition accuracy we further assess the naturalness of the generated speech using the utmos metric which indicates that as Omega increases the speech becomes more natural due to fewer discontinuities thus we can adjust Omega based on specific needs to balance response latency and speech quality next we present average decoding times for different models on the S2 Tiff and S2s tasks for s2t speech GPT first generates a text instruction and then a text response while llama Omni provides concise answers directly resulting in an average decoding time of just 1. 49 seconds in the S2s if task speech GPT out puts text and speech responses sequentially leading to a decoding time about six times longer than generating only text in contrast llama Omni generates both responses simultaneously increasing total generation Time by only 1.