Simultaneous Masking, Not Prompting Optimization: A Paradigm Shift in Fine-tuning LLMs for Simultaneous Translation
필름·전자재료 · (13) 프리즘 필름
기본 정보
- 저자
- DOI
- 10.18653/v1/2024.emnlp-main.1017
- 저널
- –
- 발행년도
- 2024
- 발행기관
- –
- 피인용수
- 0
- 라이선스
- cc-by
- 논문 유형
- –
- 언어
- –
- 원문 페이지
- http://dx.doi.org/10.18653/v1/2024.emnlp-main.1017
- 토픽
- Fuel Cells and Related Materials
- OpenAlex ID
- W4404782222
평가 내용
- 관련도
- 사업분야
- 필름·전자재료 · (13) 프리즘 필름
- 부 분야
- –
- R&D 측면
- –
- 확신도
- –
- 근거 용어
- –
- 판단 근거
- 임베딩 유사도 기반 평가로 '필름·전자재료 > 프리즘 필름' 분야에 선정된 논문입니다.
- R&D 활용 포인트
- –
- 평가 입력
- –
초록
본문 53,442자
본문 펼치기
섹션 본문 77문단 · 36,160자
(제목 없음)
1Large language models (LLMs) have achieved state-of-the-art performance in various language processing tasks, motivating their adoption in simultaneous translation.Current finetuning methods to adapt LLMs for simultaneous translation focus on prompting optimization strategies using either data augmentation or prompt structure modifications.However, these methods suffer from several issues, such as unnecessarily expanded training sets, computational inefficiency from dumping the key and value cache, increased prompt sizes, or restriction to a single decision policy.To eliminate these issues, in this work, we propose Simul-Mask, a new paradigm for fine-tuning LLMs for simultaneous translation.It utilizes a novel attention mask approach that models simultaneous translation during fine-tuning by masking attention for a desired decision policy.Applying the proposed SimulMask on a Falcon LLM for the IWSLT 2017 dataset, we have observed a significant translation quality improvement compared to state-of-the-art prompting optimization strategies on five language pairs while reducing the computational cost.
Introduction
2Simultaneous translation refers to the process of producing a target output translation concurrently with an oncoming source input.In our increasingly interconnected world, where communication across languages in real-time is desired, simultaneous translation is becoming a requirement.As such, there is a need for machine learning models to fill this role.
3Current literature has primarily focused on adapting end-to-end Transformer models (Vaswani et al., 2017) to overcome the difficulties of simultaneous machine translation (SimulMT) due to their reduced parameter counts and greater inference speed (Ma et al., 2020b).However, the recent successes of large language models (LLMs) (Touvron et al., 2023;Jiang et al., 2023;Almazrouei et al., 2023) has prompted preliminary research applying them to SimulMT through fine-tuning and inference techniques (Agostinelli et al., 2023;Wang et al., 2023;Koshkin et al., 2024;Wang et al., 2024;Guo et al., 2024).Unfortunately, most modern works have neglected the computational increases created by dumping the target sequence's key and value (KV) cache (Wang et al., 2024).Furthermore, there has yet to be a universal approach to finetuning LLMs for SimulMT that is not unnecessarily computationally expensive by either expanding the dataset through data augmentation, a process referred to as prefix fine-tuning (Agostinelli et al., 2023;Wang et al., 2023;Koshkin et al., 2024) or increasing the prompt length through prompt restructuring (Koshkin et al., 2024;Wang et al., 2024).
4The lack of an efficient fine-tuning strategy of LLMs for SimulMT has led us to propose a new paradigm, referred to as SimulMask.SimulMask is a novel attention mask to model SimulMT during fine-tuning by redistributing the attention under a decision policy.By design, SimulMask is broadly applicable to both flexible and fixed decision policies, creating a path forward for future work to build upon it.Furthermore, if we avoid injecting positional information into the keys and values through a modified ALiBi (Press et al., 2021), SimulMask allows for KV caching during SimulMT without accuracy degradation.
5To validate the efficacy of SimulMask, we finetuned and evaluated 1.3 billion parameter Falcon models pre-trained on the RefinedWeb dataset using SimulMask (Almazrouei et al., 2023;Penedo et al., 2023) and compared them against identical Falcon models that adopt existing prefix fine-tuning or prompt restructuring methods on the IWSLT 2017 dataset (Cettolo et al., 2017).From the results, we demonstrate models fine-tuned with SimulMask outperform prefix fine-tuning and prompt restructuring models at SimulMT for a given latency arXiv:2405.10443v4[cs.CL] 9 Oct 2024 regime with a reduced computational cost.
6The main contributions of the paper include: 1. Providing insights on the shortcomings of current methods in adapting LLMs to SimulMT. 2. Proposing a novel attention masking approach to fine-tune SimulMT LLMs that enables efficient training and inference.3. Demonstrating the efficacy of our approach in terms of translation quality and computational costs by evaluating them on multiple language pairs across varied latencies.
72 Background and Related Work
Masked Transformer Self-Attention
8We briefly review self-attention functionality in Transformers (Vaswani et al., 2017) focusing on masking behavior in Equation 1. M is defined as an optional attention mask.
9Critically, M functions by modeling context limitations or time-based dependencies that might exist during inference but do not exist during training/fine-tuning.For generative Transformer blocks or architectures, M is defined as a causal attention mask, where each entry, M ij , is represented by Equation 2 to avoid attending to the future.
Simultaneous Translation
10SimulMT is dictated by read-write decision policies, whereby a model will wait a specific amount of time before alternating between reading and writing in fixed or flexible intervals.One fixed decision policy for SimulMT that is broadly adopted as a common baseline to build on due to its effectiveness and simplicity is the wait-k policy (Ma et al., 2019).As the name suggests, the wait-k policy will wait for k words before alternating between writing and reading a word.Although effective in SimulMT, alternative adaptive policies have gained traction, which base reading and writing on an auxiliary model or a predefined set of rules (Cho and Esipova, 2016;Gu et al., 2017;Zheng et al., 2019).While capable of impressive results, such adaptive policies often incur additional computational costs.A Transformer is trained for a SimulMT decision policy by masking attention scores in the encoder self-attention and the decoder cross-attention.In the case of the encoder self-attention, each source token is prevented from attending to future source tokens following a decision policy (Ma et al., 2019).An example mask is provided in Appendix A.1.
11Alternatively, in decoder cross-attention, each target token is prevented from attending to future source hidden states following the decision policy (Papi et al., 2022a).Equation 3 expresses each entry of the decoder cross-attention mask, M tj .
12In Equation 3, f (t), is a decision policy function that denotes the cumulative number of source hidden states to read when predicting target token t.
Applying LLMs to SimulMT
13LLMs have demonstrated remarkable performance on neural machine translation (NMT) (Moslem et al., 2023;Vilar et al., 2023;Xu et al., 2023;Zhang et al., 2023;Iyer et al., 2023).Such successes have prompted recent works to extend the reach of LLMs into the realm of SimulMT (Agostinelli et al., 2023;Wang et al., 2023;Koshkin et al., 2024;Wang et al., 2024;Guo et al., 2024).LLMs are especially promising for the field of SimulMT due to their strong understanding of language semantics and meaning.Intuitively, SimulMT LLMs inject holistic linguistic knowledge that could allow for correct translation decisions when facing difficult contextual obstacles (e.g., translating a verb in a target language without access to that verb in the source language).Unfortunately, Equation 3 is no longer effective in modeling SimulMT for decoder-only LLMs as with the decoder of a classical Transformer.The reason is that Equation 3 is constructed specifically for the cross-attention calculation between keys exclusively from the source and queries exclusively from the target, as in Transformers.In contrast, LLMs perform self-attentions involving the prompt, the source, and the target concurrently.Equation 3 can no longer properly mask the source (keys) from the target (queries), due to the additional prompt and target sequences in the keys and the additional prompt and source sequences in the queries.Furthermore, Equation 3 does not enforce the autoregressive language modeling behavior of LLMs.As such, alternative means to model SimulMT have been proposed, leveraging prompting optimization.
14Current methods of fine-tuning LLMs for SimulMT fall under prompting optimization.We define prompting optimization as either employing data augmentation to help with prompting (Koshkin et al., 2024;Wang et al., 2023;Agostinelli et al., 2023) or redefining the prompt structure (Wang et al., 2024;Koshkin et al., 2024) to somewhat simulate SimulMT.
Data Augmentation
15Prompting optimization focusing on data augmentation resorts to subdividing each sentence in a dataset into multiple partial sentence pairs.These partial sentence pairs mimic SimulMT, as SimulMT produces outputs with a partial input.We label such a method as prefix fine-tuning, and although the high-level procedure is identical amongst current works, the algorithms employed to obtain these partial sentence pairs are unique.In the case of Agostinelli et al. (2023), each sourcetarget sentence pair is subdivided according to the wait-k policy such that if we order the new samples from smallest to largest, each subsequent sentence pair will have one additional target word and source word so long as the end of the target or source is not reached.Upon completion there will be max(|S| − (k − 1), |T |) sentence pairs, where |S| and |T | are the original source and target sequence lengths.The approach requires the model to predict only the final target word in the sequence during fine-tuning.
16Alternatively, Wang et al. (2023) randomly sampled a subset of sentence pairs from the dataset and truncated the source sentence to be 20% to 80% of the full length according to a uniform distribution.They obtained the respective target translations by prompting ChatGPT (gpt-3.5-turbo).The new truncated source-target sentence pairs were then added to the complete dataset, expanding it.
Prompt Restructuring
17Prompting optimization that modifies the prompting structure adjusts the prompt to include the decision policy.In the case of Wang et al. (2024), a conversational prompting structure is adopted for the LLM, alternating between source and target subsequences of the original complete sequences using delimiting tokens to separate regions.For instance, if we have the source sequence S = [s 1 , s 2 , ..., s n ] and the target sequence T = [t 1 , t 2 , ..., t m ], then one potential conversational prompt expansion could be "<s>, [U], s 1 , s 2 , [A], t 1 , t 2 , </s>, ..., <s>, [U], s n , [A], t m , </s>", where the added <s>, </s>, [A], [U] are delimiting tokens.During fine-tuning, the choice of alternating subsequences is arrived at by attempting to maximize the relevant source context before each target sequence in the form of an oracle decision policy.For instance, the prompt will ensure an arbitrary target verb prediction only after the respective source verb is read.Some minor perturbations are added to the oracle decision policy to improve generalizability.Then, at inference, a prompt constructor provides the source sequence in fixed-size chunks.
18Similarly, Koshkin et al. (2024) leverages prompt restructuring; however, it also employs prefix finetuning.Like the conversational prompting structure, it constructs a fine-tuning prompt by aligning words between the source and target sequence to mimic an oracle decision policy.However, it deviates from conversational prompting by ensuring the alignment using padding tokens in the target sequence.Then, the causally aligned sentence prompt is subdivided using a prefix finetuning strategy to expand the dataset with partially filled source-target sentence pairs.At inference, the LLM contains the decision policy outputting padding tokens whenever it requires more source context tokens.
Analysis and Shortcomings of Prompting Optimization Methods
19Prompting optimization, while functional to a certain degree, is inherently deficient, possessing a host of fine-tuning and inference issues.These issues include a persistent fine-tuning-inference mismatch, consistent positional confusion in the target sequence, and high computational costs.
Fine-tuning/Inference Mismatch
20A fine-tuning-inference mismatch is a mismatch between a LLM's fine-tuning and inference environments.For instance, fine-tuning a LLM for NMT where the entire sentence is available and deploying it for SimulMT where little of the sentence is available when beginning generation will create a massive inference time fine-tuning-inference mismatch.Furthermore, the LLM must be finetuned to accommodate KV caching, the process of caching the keys and values at inference to prevent recomputation.Overall, fine-tuning for SimulMT aims to minimize the fine-tuning-inference mismatch.
21Unfortunately, prefix fine-tuning precludes highquality SimulMT with KV caching (Agostinelli et al., 2023;Koshkin et al., 2024;Wang et al., 2023) as with the continuously increasing prompt size, each key and value in the KV cache deviates more from the keys and values in its fine-tuning environment.For example, suppose we have a LLM in the middle of SimulMT using KV caching adhering to a wait-1 policy with the following prompting structure: "Translate the following sentence: s 1 , s 2 , ..., s i+1 [a]: t 1 , t 2 , ..., t i ".Then, at the current write step, the query of t i attends to the KV cache for [a]:, t 1 , t 2 , ..., t i−1 .By construction, each key and value in the KV cache was generated in a previous time step with a different subset of the source sequence s 1 , s 2 , ..., s i .For instance, the keys and values for delimiting token [a]: when it predicted t 1 were conditioned only on s 1 , whereas the keys and values for t i−1 when it predicted t i were conditioned on s 1 , s 2 , ..., s i .However, during prefix fine-tuning, the LLM was fine-tuned to predict t i+1 as if the KV cache for [a]:, t 1 , t 2 , ..., t i−1 were each generated with the same subset of the source sequence s 1 , s 2 , ..., s i .Such fine-tuning-inference mismatch is unsolved through conventional prompting structures.
22Prompting restructuring also creates additional fine-tuning-inference mismatches.In Koshkin et al. (2024) and Wang et al. (2024), they all fine-tune for an oracle decision policy.However, at inference, such an oracle decision policy is not truly achievable, creating a mismatch.Furthermore, since the LLMs that leverage prompt restructuring encapsulate a specific oracle decision policy into their finetuning curriculum, extending them to alternative decision policies at inference is infeasible without incurring a mismatch.This calls for a new, flexible method adaptable to a range of decision policies while also eliminating the fine-tuning-inference mismatch.
Positional Confusion
23Positional confusion describes the process whereby the relative and/or global positional information during SimulMT progressively becomes incorrect.Unfortunately, most SimulMT LLMs using KV caching suffer from this positional confusion (Agostinelli et al., 2023;Koshkin et al., 2024;Wang et al., 2023).The reason is that as the source sequence grows with SimulMT, the target sequence also shifts, necessitating the target sequence's positional information to follow suit.However, since KV caching is employed, the positional information held in the keys and values is not properly updated.Aligning with our previous example, for the sequence portion "[a]: t 1 , t 2 , ..., t i ", after the first prediction step, the positional distance between s 1 and [a]: and between s 1 and t 1 would be 1 and 2, respectively.Then, after the second read, where the source sequence is s 1 , s 2 , the positional distance between s 1 and [a]: and t 1 would change to 2 and 3, respectively.However, while using KV caching, this positional distance would remain 1 and 2 in the keys and/or values for subsequent predictions, causing positional confusion.Continuing translation would see the increased gap between the true positional distance and the stale positional distance in the KV cache.Therefore, we need to identify an effective method to deal with positional confusion that is essential to prevent LLM hallucinations.
Computational Inefficiency
24Avoiding KV caching and instead recomputing all the keys and values at each prediction step is the default solution for resolving the aforementioned fine-tuning-inference mismatch and positional confusion problems while employing prefix fine-tuning.Although effective from a translation quality standpoint, doing so incurs a large computational cost, an undesirable result for streaming tasks like SimulMT, where latency is equally important.
25Outside of KV caching, the computational costs necessary for prefix fine-tuning methods are excessive.By subdividing each sample into multiple, the dataset drastically expands, contributing toward an increased cost to complete each epoch (Agostinelli et al., 2023;Koshkin et al., 2024;Wang et al., 2023).Such an increase causes the duration of each epoch to rise by upwards of a factor of 10 (as exemplified in Table 1 in Section 7.2).However, unlike normal methods of expanding a dataset through data augmentation, prefix fine-tuning does not actually add additional information.It is from this added computational burden that Agostinelli et al. (2023) and Wang et al. (2023) are forced to fine-tune with a subset of their entire prefix datasets.
26Alternatively, methods of restructuring the prompt as in Koshkin et al. (2024) and Wang et al. (2024) have computational burdens of their own.For instance, Wang et al. (2024) requires adding delimiting tokens in the prompt sequence, expanding the sequence length.Similarly, the requirement of padding tokens to induce a causal alignment between the source and target sequences, as in Koshkin et al. (2024), also expands the sequence length.Since the computational cost of the selfattention cost in the LLM scales quadratically with the sequence length, such a method is undesirable for both inference and fine-tuning.
27Currently, no computationally efficient finetuning approach exists that enables computationally efficient inference.Identifying such a method is necessitated by the desire for low latency and high-quality translations and reducing the already high computational costs of fine-tuning LLMs.
SimulMask: A Paradigm Shift
28In this work, we propose SimulMask, which we believe could be a paradigm shift in fine-tuning LLMs for SimulMT that eschews current methods of prompting optimization.By restricting attention during fine-tuning, SimulMask efficiently solves the fine-tuning-inference mismatch and positional confusion problem.We demonstrate SimulMask through its application for the wait-k decision policy, but it should be noted that SimulMask broadly applies to various decision policies.
Inference Mirrored Attention
29We first introduce the concept of Inference Mirrored Attention that cleverly models SimulMT during LLM fine-tuning.Under SimulMT, the latest translation token at each prediction step is conditioned only on the running source tokens.For conventional Transformers, specialized attention masks could achieve such conditioning; however, directly mapping these to LLMs is impossible since they fail to enforce autoregressive language modeling and cannot mask properly when the prompt, source, and target sequences are collectively included in the queries and keys.As such, prior works attempted to achieve such conditioning during fine-tuning using prompting optimization strategies littered with shortcomings.The proposed inference mirrored attention is aimed to model SimulMT with attention masks for LLMs by mirroring the attention during inference at fine-tuning according to the chosen decision policy.
30As an example, suppose we model the attention for a wait-1 decision policy where the complete oracle input sequence is "p 1 , s 1 , s 2 , s 3 , s 4 , p 2 , t 1 , t 2 , t 3 , t 4 ".
31In the sequence, s 1 , s 2 , s 3 , s 4 and t 1 , t 2 , t 3 , t 4 are the 4-word source and target sequences and p 1 and p 2 are prompting regions.Then, at inference, by definition of the wait-1 policy, p 2 predicts t 1 while conditioned on the partial sequence p 1 , s 1 , p 2 .As such, as shown in Figure 1a the query of p 2 attends to the keys of p 1 , s 1 , p 2 .Thus, during fine-tuning, to eliminate the fine-tuning-inference mismatch, the query of p 2 should be limited to similarly attend to the keys of p 1 , s 1 , p 2 as shown in Figure 1b rather than the entire source sequence.For each successive prediction step, the previously predicted target word, t i , predicts the next target word, t i+1 by conditioning on an extra source word, s i+1 , acquired from the previous read step.To mimic such behavior at fine-tuning, the query for t i attends to identical keys as its inference step.The complete steps of this example are in Appendix A.2.
SimulMask
32To achieve the above inference mirrored attention, we opt for an attention mask to restrict attention during fine-tuning to mimic an arbitrary decision policy during SimulMT.An attention mask is preferable to prompting optimization as it is flexible and directly extends the LLM causal attention mask.We call such an attention mask SimulMask.
33As a demonstration, let us create a SimulMask for the wait-1 policy that extends our example from Section 5.1.As depicted in Figure 2, since the LLM is autoregressive, SimulMask begins with a causal attention mask from which attention is limited to be identical to the attention during SimulMT for the source sequence.Starting from the prompt p 2 , from the example in Figure 1b, p 2 generates the first target token, t 1 , conditioned on p 1 , s 1 , p 2 .As such, SimulMask eliminates the attention between p 2 and s 2 , s 3 , s 4 .Similarly, t 1 and t 2 are conditioned on p 1 , s 1 , s 2 , p 2 , t 1 and p 1 , s 1 , s 2 , s 3 , p 2 , t 1 , t 2 , respectively.Thus, attention is eliminated between t 1 and s 3 , s 4 and t 2 and s 4 .SimulMask is a flexible scheme that supports a range of decision policies.Since each decision policy performs read/write decisions differently and each limits attention differently, this requires a unique attention mask for every sentence.However, this can be done straightforwardly.The general procedure to construct a SimulMask for a given policy and sentence consists of the following steps:
341. Construct a causal attention mask using Equation 2 as a starting point for SimulMask.2. Starting from the intersection between the query that predicts the first target token and the first source key, apply the sub-attention mask expressed in Equation 3. The subattention mask prevents the target queries from attending to source keys following the arbitrary decision policy.3. Mask any non-source queries before the query predicting the first target token from attending to the source keys not included in the first read decision.Such a step is necessary to prevent the hidden states associated with these queries from holding information of the entire source sequence at later layers in the LLM.As reported in Section 7.2, the computation for constructing an arbitrary SimulMask is minor, and since SimulMask is not applied during inference, it does not impact computational cost at deployment.Therefore, SimulMask is an efficient option for mimicking SimulMT during fine-tuning and providing low-latency translations at inference.
Positional Reordering
35Since positional confusion during inference is a byproduct of retaining outdated positional information in either the keys or values, bypassing it requires providing a form of positional information without injecting it directly into the sequence or KV cache.One positioning method that satisfies such a constraint is the popular ALiBi, which supplies positional information through biases in attention (Press et al., 2021).The bias is applied to each query-key dot product row in the attention calculation as shown in Equation 4, where m is a head-specific constant.
36Though simple, ALiBi has demonstrated an ability to extrapolate to much larger sequence lengths than other state-of-the-art positional encodings, making it desirable for LLMs like Falcon (Penedo et al., 2023), BLOOM (Le Scao et al., 2023), etc.Unfortunately, ALiBi, by default, does not mesh with SimulMask as SimulMask removes attention between the target queries and source keys.This removed attention creates a gap in ALiBi biases during fine-tuning that are not present at inference.An example of such a gap is provided in Figure 3a, where both q 4 and q 5 have gaps in the position distance.
37To eliminate the bias gap, we modify ALiBi by reducing the bias values of all query rows influenced by SimulMask.For each query row, the reduction in bias values is equivalent to the amount of attention removed along the row using Simul-Mask.Figure 3b provides an example of such a modification.In the case of q 4 , it is no longer able to attend to k 2 and k 3 ; therefore, the bias on the right of the gap is reduced by 2. Together with the modified ALiBi, SimulMask eliminates positional confusion from the LLM during SimulMT.
386 Experimental Setup
Fine-tuning
39Our fine-tuning was conducted with the Simul-LLM framework (Agostinelli et al., 2023), which (c) English-Italian language pair results.
40(d) English-Romanian language pair results.
41(e) English-German language pair results.
42Figure 4: Translation quality plotted against latency for LLMs on the English-French, English-Dutch, English-Romanian, and English-German language pairs.contains our publicly available code for Simul-Mask1 .Each experiment used a 1.3 billion parameter Falcon model pre-trained on the Refined-Web dataset (Penedo et al., 2023).We compared 7 schemes:
43• causal-offline: Fine-tuned with a causal attention mask and evaluated for NMT (non-SimulMT).• causal-rec: Fined-tuned with a causal attention mask and evaluated with recomputing the KV cache.• prefix-rec and prefix-norec: Fined-tuned with prefix fine-tuning and evaluated with/without recomputing the KV cache.• converse-norec: Fined-tuned with a conversational prompting strategy and evaluated without recomputing the KV cache.• SM-norec-mod and SM-norec: Fined-tuned with SimulMask with/without modifying AL-iBi and evaluated without recomputing the KV cache.Appendix A.3 provides all model hyperparameters.Our fine-tuning experiments included the English-French (en-fr), English-Italian (en-it), English-Dutch (en-nl), English-Romanian (en-ro), and English-German (en-de) language pairs of the IWSLT 2017 dataset (Cettolo et al., 2017).
Evaluation
44We evaluated translation quality and latency for SimulMT using Simul-LLM inference agents (Agostinelli et al., 2023) interfacing with the SimulEval toolkit (Ma et al., 2020a).The translation quality was determined using detokenized BLEU with SacreBLEU (Post, 2018) and chrF++ (Popović, 2017).Latency was determined using Length-Adaptive Average Lagging (LAAL) (Papi et al., 2022b).The computational cost of SimulMT was recorded with GFLOPs.All metrics were obtained on a single A10 GPU with bfloat16 precision.The models fine-tuned for the wait-k policy were evaluated at a wait-k four lower, for which they were fine-tuned, as suggested by (Ma et al., 2019).
Translation Quality and Latency Results
45In this section, we demonstrate the efficacy of finetuning with the proposed SimulMask compared with other schemes using BLEU scores and LAAL.All wait-k model evaluations are performed across wait-{1,3,5,7}, and the converse-norec is evaluated for a chunk size of 1, 3, 5, 7, 9, and 11. Figure 4 provides the BLEU translation quality and latency results on the English-French, English-Dutch, English-Italian, English-Romanian, and English-German language pairs.We provide the numerical BLEU and chrF++ translation quality results in Tables 3 and 4 of Appendix A.4.
46Overall, throughout Figure 4, the proposed SMnorec-mod outperforms or matches the translation quality of causal-rec, prefix-rec, and conversenorec across all latencies.The only major exception occurs at wait-1, where converse-norec outperforms SM-norec-mod on the English-Romanian language pair.This overall excellent performance in terms of translation quality underscores the importance of the proposed method.
47Furthermore, Figure 4 provides two ablation studies.The first ablation demonstrates the importance of modifying ALiBi with SimulMask for high-quality translations by comparing SM-norecmod with SM-norec.For each wait-k value and language pair, SM-norec-mod outperforms SM-norec.Unsurprisingly, at higher wait-k values where the setting approaches NMT, the difference in BLEU scores becomes less pronounced between the models.
48A secondary ablation is provided in Figure 4 by comparing prefix-rec and prefix-norec.Doing so demonstrates that translation quality increases by recomputing the KV cache across all wait-k values.Similarly, as with the previous ablation, the difference in the BLEU score becomes less pronounced for the higher wait-k values.
49An interesting observation is that models evaluated at lower wait-k values have their LAAL deviate from their respective k to a greater degree than those evaluated at higher wait-k.Such an increase is a byproduct of the lower wait-k models generating longer predictions than their corresponding references.The increased generation length is a byproduct of the model hallucinating on sequences provided insufficient contexts.These hallucinations are most noticeable with prefix-rec and prefixnorec in Figure 4e.
Compuational Saving Results
50Fine-tuning LLMs with SimulMask also features reduced training time compared with LLMs leveraging prefix fine-tuning or conversational prompting.For instance, this is reflected in the finetuning times for one epoch on an H100 GPU on the English-French dataset of the IWSLT 2017 dataset, as reported in Table 1 (Cettolo et al., 2017).Furthermore, we find that SM-norec is also more computationally efficient at inference than prefixrec and converse-norec.We report these results in GFLOPs that are needed to complete a sentence translation in Figure 5.The data used to obtain the results was a random 1000 samples from the English-French split of the IWSLT 2017 test set (Cettolo et al., 2017).The models chosen either used wait-3 or a chunk size of 5.
Fine-tuning
51By leveraging SimulMask during fine-tuning, we eschew the need to recompute the KV cache at inference.In doing so, SimulMask saves computation compared to prefix-rec and causal-rec.We demonstrate the proportions of computation in GFLOPs dedicated to re-computing the KV cache and processing/predicting initial tokens in Figure 6 (based on prefix-rec).The sequence length is the number of tokens in the predicted target and input source.As can be seen, it is critical to avoid recomputing KV cache, as achieved by SimulMask, to provide low latency translations, especially at longer sequence lengths.
Conclusion
52In this work, we first examine current LLM finetuning approaches for SimulMT and identify their shortcomings.We then propose a new paradigm for fine-tuning LLMs for SimulMT that we call SimulMask, which avoids the shortcomings of previous methods.When employing SimulMask, the target sequence is prevented from attending to a portion of the source sequence according to an arbitrary decision policy modeling SimulMT.Through the application of SimulMask, we can efficiently fine-tune a LLM for SimulMT and reduce the computational costs of inference by eliminating the recomputation of the KV cache for the target sequence, unlike prior works.Furthermore, we can exceed or match the translation quality of prior works at all wait-k values across multiple language pairs.
Limitations
53Given the translation quality benefits at a reduced computational cost of fine-tuning with SimulMask, it would be beneficial to evaluate the approach to larger and more powerful LLMs, adapting them for SimulMT.Also, while SimulMask is broadly applicable to various decision policies, our current evaluation was limited to only testing the effectiveness of SimulMask on the wait-k policy and did not evaluate alternative fixed or more flexible decision policies.Additionally, we did not explore simultaneous speech-to-text or speech-to-speech translation, which SimulMask has yet to be tested on.
A Appendix
54A.1 Encoder Attention Mask
55An example of an encoder attention mask used to model simultaneous translation during training is provided in Figure 7.The attention mask in Figure 7 is designed for a source sequence length of 5 tokens where the first read step reads 2 tokens, the second read step reads 1 token, and the third read step reads 2 tokens.
A.2 Inference Mirrored Attention and SimulMask
56Figure 8 provides the complete example of inference mirrored attention for the wait-1 policy explained in Section 5.1.To reiterate in Figure 8a, the query of p 2 attends to the keys of p 1 , s 1 , p 2 .Thus, during fine-tuning, to eliminate the fine-tuninginference mismatch, the query of p 2 is limited to similarly attend to the keys of p 1 , s 1 , p 2 as shown in Figure 8b rather than the entire source sequence.
57Then for the second and third decoding steps at inference, the queries of t 1 and t 2 attend to the keys of p 1 , s 1 , s 2 , p 2 and p 1 , s 1 , s 2 , s 3 , p 2 , respectively as shown in Figures 8c and 8e.Once again, to eliminate the fine-tuning-inference mismatch, the queries of t 1 and t 2 must attend to an identical set of keys as shown in Figures 8d and 8f.
A.3 Hyperparameters
58The fine-tuning hyperparameters used for SMnorec, causal-rec, causal-offline, prefix-rec, prefix-norec, and converse-norec models are provided in Table 2.
59The prompts used for the SM-norec, causal-rec, causal-offline, prefix-rec, and prefix-norec models consisted of the following format: Our implementation for converse-norec followed Wang et al. (2024).However, we used the Itermax method from the SimAlign toolkit leveraging XLM-RoBERTa base (Conneau et al., 2019) to align words due to their work reporting better alignments than fast-align (Jalili Sabet et al., 2020;Dyer et al., 2013).
A.4 Extended Translation Results
60The translation quality results in Table 3 provide the numerical BLEU and LAAL values from Figure 4 for prefix-rec, converse-norec, and SM-norec-mod.Alternatively, Table 4 provides the numerical chrF++ values associated with each of these models from Figure 4.
A.5 Sequence Lengths
61Figure 9 reports the number of occurrences on the English-French IWSLT2017 validation set (Cettolo et al., 2017) that the combined length of the source sequence and the predicted target sequence are within a specified range for prefix-rec at wait-3.
A.6 Licensing Information
62The SimulEval toolkit is licensed under CC BY-SA-4.0 license (Ma et al., 2020a).The Simul-LLM framework and SimAlign toolkit are licensed under the MIT license (Agostinelli et al., 2023;Jalili Sabet et al., 2020).The IWSLT 2017 dataset is licensed under CC BY-NC-ND (Cettolo et al., 2017).
63The Falcon model we used from Hugging Face
Figure 1 :
64Figure 1: Inference Mirror Attention for matching attention during inference and fine-tuning for SimulMT.
Figure 2 :
65Figure 2: SimulMask for modeling SimulMT according to a wait-1 decision policy during fine-tuning.
Figure 3 :
66Figure 3: ALiBi biases with SimulMask.
67(a) English-French language pair results.(b)English-Dutch language pair results.
Figure 5 :
68Figure 5: Box plots of the computational cost of each method in GFLOPs during inference.
Figure 6 :
69Figure6: Separated computational cost in GFLOPs between initial (or required) computational cost and the cost of recomputing already emitted target words in a provided prompt during translation versus the sequence length of a given sample.
Figure 7 :
70Figure 7: An attention mask to model simultaneous translation for a Transformer encoder during training.
71Translate the following sentence from [SRC] to [TGT]: [SRC-Sentence]\n Assistant: [TGT-Sentence] Alternatively, the converse-norec model used the prompt: Translate the following sentence from [SRC] to [TGT]\nAssistant: <s><t> [SRC-Chunk-1]</t>[TGT-Chunk-1] </s><s><t>...<s><t> [SRC-Chunk-n]</t>[TGT-Chunk-n]</s>
72(a) Attention for the first prediction step.(b) Inference mirrored attention for the first prediction step.(c) Attention for the second prediction step.(d) Inference mirrored attention for the second prediction step.(e) Attention for the third prediction step.(f)Inference mirrored attention for the third prediction step.
Figure 8 :
73Figure 8: Attention during inference and finetuning for SimulMT.
Figure 9 :
74Figure 9: Histogram of the distribution of sequence lengths.
Table 1 :
75Time to complete one epoch for different finetuning approaches on an H100.
76MinghanWang, Jinming Zhao, Thuy-Trang Vu, Fatemeh Shiri, Ehsan Shareghi, and Gholamreza Haffari.2023.Simultaneous machine translation with large language models.arXiv preprint arXiv:2309.06706.
Table 2 :
77Fine-tuning hyperparameters for all models in Section 7. Group 1: SM-norec, SM-norec-mod.Group 2: prefix-rec, prefix-norec.Group 3: converse-norec.Group 4: causal-rec, causal-offline.
참고문헌
참고문헌 정보가 없습니다.