File size: 23,294 Bytes
30951e5
5cd6cd7
 
 
 
30951e5
db9bd92
900c2aa
 
30951e5
 
 
8816e37
30951e5
f106958
30951e5
 
 
a29dcac
3e08ac3
b5e196d
4ae2931
 
5cd6cd7
 
b5e196d
6b1edc8
3e08ac3
5cd6cd7
 
 
 
 
 
b5e196d
4ae2931
 
5cd6cd7
 
 
 
 
 
30951e5
385b92d
790450f
385b92d
a6099b9
385b92d
4fa06ea
385b92d
d08ae83
348431a
2818fd1
900c2aa
70b9712
735299c
251bc20
0b80915
 
 
385b92d
790450f
385b92d
a6099b9
385b92d
ba814b7
385b92d
ba814b7
385b92d
de49693
9feb397
790450f
385b92d
a6099b9
 
a5b451f
385b92d
a6099b9
ea45b1a
 
9be92e3
a6099b9
 
 
 
 
1cf35a4
 
 
a6099b9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99868b2
 
a6099b9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99868b2
 
a6099b9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99868b2
 
a6099b9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99868b2
 
a6099b9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99868b2
 
a6099b9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99868b2
 
a6099b9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
385b92d
 
 
790450f
385b92d
a6099b9
7c98006
385b92d
790450f
385b92d
5392f0a
 
 
 
edf339b
5392f0a
 
 
 
 
 
 
 
 
 
 
790450f
93a13eb
5392f0a
790450f
5392f0a
790450f
5392f0a
 
 
 
 
 
 
 
a5b451f
5392f0a
1ee1019
790450f
 
5392f0a
385b92d
790450f
385b92d
790450f
385b92d
790450f
 
 
385b92d
edf339b
385b92d
790450f
 
 
 
 
 
 
 
 
385b92d
790450f
93a13eb
790450f
385b92d
790450f
 
 
 
385b92d
790450f
 
 
 
 
385b92d
790450f
 
a5b451f
385b92d
1ee1019
790450f
 
 
385b92d
a5b451f
a2391de
251bc20
220b3d4
7c98006
385b92d
7c98006
385b92d
790450f
385b92d
 
 
790450f
385b92d
790450f
385b92d
edf339b
385b92d
790450f
385b92d
790450f
385b92d
1cf35a4
385b92d
1cf35a4
 
ce98fbe
8c1d564
1cf35a4
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
---
base_model:
- openai/whisper-large-v2
datasets:
- MERaLiON/MNSC
library_name: transformers
license: other
license_name: meralion-public-license
license_link: https://huggingface.co/MERaLiON/MERaLiON-AudioLLM-Whisper-SEA-LION/blob/main/MERaLiON-Public-Licence-v1.pdf
metrics:
- bleu
- wer
pipeline_tag: automatic-speech-recognition
tags:
- vllm
- LLM-as-a-Judge
- chat
- audio
- safetensors
widget:
- example_title: Sentence-level ASR
  src: librispeech_clean.wav
  output:
    text: "USER Instruction: Please transcribe this speech.\n MODEL Output: <Speaker1>\
      \ When they were outside, Ung simply latched the door and started up the path."
- example_title: Dialogue-level ASR
  src: IMDA_conversation.wav
  output:
    text: "USER Instruction: Please turn this speech into written format.\n MODEL\
      \ Output: <Speaker1> Okay, (um) in that case, (uh) how do I apply? <Speaker2>\
      \ Alright, you can just (um) apply it online and then (um) we'll need some documents\
      \ from you. (um) let's say the bank statement with your address and your name,\
      \ and also the (um) Nsf card that you have to enjoy the promotion. <Speaker1>\
      \ (mmhmm) (mmhmm) (mmhmm) [ah] I see the green one, right?"
- example_title: Spoken Dialogue Summarization
  src: IMDA_conversation.wav
  output:
    text: "USER Instruction: Please briefly summarize this conversation.\n MODEL Output:\
      \ Speaker1 and Speaker2 discussed the application process for a promotion. Speaker2\
      \ explained that the application can be done online and provided a list of required\
      \ documents, including a bank statement with the applicant's address and name,\
      \ and an NSF card. Speaker1 acknowledged the information and confirmed the details\
      \ of the required documents."
---

# MERaLiON

MERaLiON-AudioLLM is a Speech-Text Large Language Model tailored for Singapore’s multilingual and multicultural landscape. Integrating a localised [Whisper-large-v2](https://huggingface.co/openai/whisper-large-v2) speech encoder and [SEA-LION V3](https://huggingface.co/aisingapore/gemma2-9b-cpt-sea-lionv3-instruct) text decoder, MERaLiON-AudioLLM is finetuned on **260,000 hours of speech and audio data**, **6 various tasks**, to address the diverse linguistic nuances of Singapore's local accents and dialects.

MERaLiON stands for **M**ultimodal **E**mpathetic **R**easoning **a**nd **L**earning **i**n **O**ne **N**etwork.

- **Developed by:** I<sup>2</sup>R, A\*STAR, with collaboration with AISG, Singapore
- **Model type:** Multimodal LLM
- **Language(s):** Primarily English (Global and Singapore), with support for input and output in other languages compatible with Whisper and SEA-LION models.
- **License:** [MERaLiON Public License](https://huggingface.co/MERaLiON/MERaLiON-AudioLLM-Whisper-SEA-LION/blob/main/MERaLiON-Public-Licence-v1.pdf)
- **Demo:** [MERaLiON-AudioLLM Web Demo](https://huggingface.co/spaces/MERaLiON/MERaLiON-AudioLLM)

We support model inference using the [Huggingface](#inference) and [vLLM](vllm_plugin_meralion/README.md) frameworks. For more technical details, please refer to our [technical report](https://arxiv.org/abs/2412.09818).

## Acknowledgement
This research is supported by the National Research Foundation, Singapore and Infocomm Media Development Authority, Singapore under its National Large Language Models Funding Initiative.

## Model Description

MERaLiON-AudioLLM is designed to take in an **audio-text pair** as input and generate a **text output**.

The architecture comprises three key components: an **audio encoder** that transforms speech or audio inputs into sequences of vector representations, a **text decoder** that interprets and responds to natural language instructions, and an **adaptor module** that compresses the encoder representations while aligning the encoder’s hidden dimension with the text decoder’s embedding size.

Specifically, we fine-tuned the **MERaLiON-Whisper** encoder from Whisper-large-v2 for the audio encoder and used SEA-LION V3, a localised LLM developed by our partner AI Singapore as the text decoder.

<img src="model_architecture.png" alt="model_architecture" width="400" style="margin-left:'auto' margin-right:'auto' display:'block'"/>

## Capabilities

MERaLiON-AudioLLM is trained to mainly address 6 tasks, namely `Automatic Speech Recognition` (ASR), 
`Speech Translation` (ST), `Spoken Question Answering` (SQA), 
`Spoken Dialogue Summarization` (SDS), `Speech Instruction` (SI), and `Paralinguistics` (PARA). 

We benchmark MERaLiON-AudioLLM with a series of test sets from the [AudioBench benchmark](https://github.com/AudioLLMs/AudioBench) 
against three well-known AudioLLMs: `Qwen2-Audio 7B`, `WavLLM`, `SALMONN`, and a cascaded model. 
As is shown in the following table, MERaLiON-AudioLLM performs better in the Singapore local context, 
as evidenced by evaluation results on Singapore's [Multitask National Speech Corpus](https://huggingface.co/datasets/MERaLiON/Multitask-National-Speech-Corpus-v1) (MNSC) datasets. 

> [!NOTE]
> MNSC is a multitask speech understanding dataset derived and further annotated from [IMDA NSC Corpus](https://www.imda.gov.sg/how-we-can-help/national-speech-corpus).
> It focuses on the knowledge of Singapore's local accent, localised terms, and code-switching.

We assess ASR and ST tasks using Word Error Rate (WER) and BLEU scores, respectively. For other tasks, we employ the LLM-as-a-Judge framework,
which uses a pre-trained large language model to evaluate task performance by generating and scoring responses based on relevance, coherence, and accuracy criteria.
Refer to the [AudioBench paper](https://arxiv.org/abs/2406.16020) for more details.

<div class="table*">
<table>
<thead>
<tr>
  <th style="text-align: center;"><strong>Task</strong></th>
  <th style="text-align: center;"><strong>Dataset</strong></th>
  <th style="text-align: center;"><strong>MERaLiON</strong></th>
  <th style="text-align: center;"><strong>Qwen2-Audio 7B</strong></th>
  <th style="text-align: center;"><strong>WavLLM</strong></th>
  <th style="text-align: center;"><strong>SALMONN-7B</strong></th>
  <th style="text-align: center;"><strong>Cascaded Model</strong></th>
</tr>
</thead>
<tbody>
<tr>
  <td style="text-align: center;" rowspan="11"><strong>Automatic Speech Recognition</strong><br>WER (<span
  class="math inline"></span>)</td>
  <td style="text-align: center;">LibriSpeech-Test-Clean</td>
  <td style="text-align: center;">0.03</td>
  <td style="text-align: center;">0.03</td>
  <td style="text-align: center;"><strong><u>0.02</u></strong></td>
  <td style="text-align: center;">0.10</td>
  <td style="text-align: center;">0.03</td>
</tr>
<tr>
  <td style="text-align: center;">LibriSpeech-Test-Other</td>
  <td style="text-align: center;"><strong><u>0.05</u></strong></td>
  <td style="text-align: center;">0.06</td>
  <td style="text-align: center;"><strong><u>0.05</u></strong></td>
  <td style="text-align: center;">0.10</td>
  <td style="text-align: center;"><u>0.05</u></td>
</tr>
<tr>
  <td style="text-align: center;">Common-Voice-15-En-Test</td>
  <td style="text-align: center;"><strong><u>0.10</u></strong></td>
  <td style="text-align: center;">0.11</td>
  <td style="text-align: center;">0.15</td>
  <td style="text-align: center;">0.31</td>
  <td style="text-align: center;">0.11</td>
</tr>
<tr>
  <td style="text-align: center;">Earnings21-Test</td>
  <td style="text-align: center;"><strong>0.17</strong></td>
  <td style="text-align: center;">0.19</td>
  <td style="text-align: center;">0.65</td>
  <td style="text-align: center;">0.26</td>
  <td style="text-align: center;"><u>0.11</u></td>
</tr>
<tr>
  <td style="text-align: center;">Earnings22-Test</td>
  <td style="text-align: center;"><strong>0.20</strong></td>
  <td style="text-align: center;">0.24</td>
  <td style="text-align: center;">0.67</td>
  <td style="text-align: center;">0.36</td>
  <td style="text-align: center;"><u>0.14</u></td>
</tr>
<tr>
  <td style="text-align: center;">MNSC-ASR-Part 1</td>
  <td style="text-align: center;"><u><strong>0.05</strong></u></td>
  <td style="text-align: center;">0.07</td>
  <td style="text-align: center;">-</td>
  <td style="text-align: center;">0.09</td>
  <td style="text-align: center;">0.07</td>
</tr>
<tr>
  <td style="text-align: center;">MNSC-ASR-Part 2</td>
  <td style="text-align: center;"><u><strong>0.05</strong></u></td>
  <td style="text-align: center;">0.19</td>
  <td style="text-align: center;">-</td>
  <td style="text-align: center;">0.42</td>
  <td style="text-align: center;">0.33</td>
</tr>
<tr>
  <td style="text-align: center;">MNSC-ASR-Part 3</td>
  <td style="text-align: center;"><u><strong>0.28</strong></u></td>
  <td style="text-align: center;">0.35</td>
  <td style="text-align: center;">-</td>
  <td style="text-align: center;">0.66</td>
  <td style="text-align: center;">0.30</td>
</tr>
<tr>
  <td style="text-align: center;">MNSC-ASR-Part 4</td>
  <td style="text-align: center;"><u><strong>0.40</strong></u></td>
  <td style="text-align: center;">0.56</td>
  <td style="text-align: center;">-</td>
  <td style="text-align: center;">0.76</td>
  <td style="text-align: center;">0.48</td>
</tr>
<tr>
  <td style="text-align: center;">MNSC-ASR-Part 5</td>
  <td style="text-align: center;"><u><strong>0.21</strong></u></td>
  <td style="text-align: center;">0.28</td>
  <td style="text-align: center;">-</td>
  <td style="text-align: center;">0.35</td>
  <td style="text-align: center;">0.23</td>
</tr>
<tr>
  <td style="text-align: center;">MNSC-ASR-Part 6</td>
  <td style="text-align: center;"><u><strong>0.15</strong></u></td>
  <td style="text-align: center;">0.22</td>
  <td style="text-align: center;">-</td>
  <td style="text-align: center;">0.25</td>
  <td style="text-align: center;">0.18</td>
</tr>
<tr>
  <td style="text-align: center;" rowspan="6"><strong>Speech Translation</strong><br>BLEU (<span
  class="math inline"></span>)</td>
  <td style="text-align: center;">CoVoST 2 En <span
  class="math inline"></span> Id</td>
  <td style="text-align: center;"><strong><u>32.62</u></strong></td>
  <td style="text-align: center;">16.33</td>
  <td style="text-align: center;">13.84</td>
  <td style="text-align: center;">14.14</td>
  <td style="text-align: center;">27.62</td>
</tr>
<tr>
  <td style="text-align: center;">CoVoST 2 En <span
  class="math inline"></span> Zh</td>
  <td style="text-align: center;"><strong><u>37.98</u></strong></td>
  <td style="text-align: center;">25.77</td>
  <td style="text-align: center;">31.96</td>
  <td style="text-align: center;">33.89</td>
  <td style="text-align: center;">35.27</td>
</tr>
<tr>
  <td style="text-align: center;">CoVoST 2 En <span
  class="math inline"></span> Ta</td>
  <td style="text-align: center;"><strong><u>8.50</u></strong></td>
  <td style="text-align: center;">0.03</td>
  <td style="text-align: center;">0.00</td>
  <td style="text-align: center;">0.00</td>
  <td style="text-align: center;">8.46</td>
</tr>
<tr>
  <td style="text-align: center;">CoVoST 2 Id <span
  class="math inline"></span> En</td>
  <td style="text-align: center;"><strong>37.07</strong></td>
  <td style="text-align: center;">6.33</td>
  <td style="text-align: center;">5.93</td>
  <td style="text-align: center;">26.89</td>
  <td style="text-align: center;"><u>46.80</u></td>
</tr>
<tr>
  <td style="text-align: center;">CoVoST 2 Zh <span
  class="math inline"></span> En</td>
  <td style="text-align: center;">15.01</td>
  <td style="text-align: center;"><strong><u>16.47</u></strong></td>
  <td style="text-align: center;">2.37</td>
  <td style="text-align: center;">5.30</td>
  <td style="text-align: center;">15.21</td>
</tr>
<tr>
  <td style="text-align: center;">CoVoST 2 Ta <span
  class="math inline"></span> En</td>
  <td style="text-align: center;"><strong><u>3.97</u></strong></td>
  <td style="text-align: center;">0.04</td>
  <td style="text-align: center;">0.17</td>
  <td style="text-align: center;">0.36</td>
  <td style="text-align: center;">2.83</td>
</tr>
<tr>
  <td style="text-align: center;" rowspan="8"><strong>Spoken Question Answering</strong><br>LLM-as-a-Judge (<span
  class="math inline"></span>)</td>
  <td style="text-align: center;">SLUE-SQA-5</td>
  <td style="text-align: center;">82.94</td>
  <td style="text-align: center;">80.05</td>
  <td style="text-align: center;"><strong>83.92</strong></td>
  <td style="text-align: center;">83.48</td>
  <td style="text-align: center;"><u>88.58</u></td>
</tr>
<tr>
  <td style="text-align: center;">Spoken-SQuAD</td>
  <td style="text-align: center;">70.33</td>
  <td style="text-align: center;">64.86</td>
  <td style="text-align: center;"><strong>77.65</strong></td>
  <td style="text-align: center;">66.40</td>
  <td style="text-align: center;"><u>88.62</u></td>
</tr>
<tr>
  <td style="text-align: center;">CN-College-Listen-Test</td>
  <td style="text-align: center;"><strong>85.03</strong></td>
  <td style="text-align: center;">74.51</td>
  <td style="text-align: center;">65.43</td>
  <td style="text-align: center;">50.90</td>
  <td style="text-align: center;"><u>91.85</u></td>
</tr>
<tr>
  <td style="text-align: center;">Singapore-Public-Speech-SQA</td>
  <td style="text-align: center;"><strong>60.32</strong></td>
  <td style="text-align: center;">58.31</td>
  <td style="text-align: center;">58.55</td>
  <td style="text-align: center;">59.24</td>
  <td style="text-align: center;"><u>73.11</u></td>
</tr>
<tr>
  <td style="text-align: center;">MNSC-SQA-Part 3</td>
  <td style="text-align: center;"><strong>51.4</strong></td>
  <td style="text-align: center;">42.0</td>
  <td style="text-align: center;">-</td>
  <td style="text-align: center;">40.60</td>
  <td style="text-align: center;"><u>53.20</u></td>
</tr>
<tr>
  <td style="text-align: center;">MNSC-SQA-Part 4</td>
  <td style="text-align: center;"><strong>49.0</strong></td>
  <td style="text-align: center;">39.6</td>
  <td style="text-align: center;">-</td>
  <td style="text-align: center;">36.60</td>
  <td style="text-align: center;"><u>60.20</u></td>
</tr>
<tr>
  <td style="text-align: center;">MNSC-SQA-Part 5</td>
  <td style="text-align: center;"><strong>58.2</strong></td>
  <td style="text-align: center;">51.6</td>
  <td style="text-align: center;">-</td>
  <td style="text-align: center;">44.60</td>
  <td style="text-align: center;"><u>67.20</u></td>
</tr>
<tr>
  <td style="text-align: center;">MNSC-SQA-Part 6</td>
  <td style="text-align: center;"><strong>65.2</strong></td>
  <td style="text-align: center;">53.6</td>
  <td style="text-align: center;">-</td>
  <td style="text-align: center;">46.80</td>
  <td style="text-align: center;"><u>71.60</u></td>
</tr>
<tr>
  <td style="text-align: center;" rowspan="4"><strong>Spoken Dialogue Summarization</strong><br>LLM-as-a-Judge (<span
  class="math inline"></span>)</td>
  <td style="text-align: center;">MNSC-SDS-Part 3</td>
  <td style="text-align: center;"><u><strong>46.80</strong></u></td>
  <td style="text-align: center;">33.80</td>
  <td style="text-align: center;">-</td>
  <td style="text-align: center;">9.0</td>
  <td style="text-align: center;">45.40</td>
</tr>
<tr>
  <td style="text-align: center;">MNSC-SDS-Part 4</td>
  <td style="text-align: center;"><u><strong>45.80</strong></u></td>
  <td style="text-align: center;">24.80</td>
  <td style="text-align: center;">-</td>
  <td style="text-align: center;">7.0</td>
  <td style="text-align: center;">44.00</td>
</tr>
<tr>
  <td style="text-align: center;">MNSC-SDS-Part 5</td>
  <td style="text-align: center;"><strong>55.2</strong></td>
  <td style="text-align: center;">40.4</td>
  <td style="text-align: center;">-</td>
  <td style="text-align: center;">17.2</td>
  <td style="text-align: center;"><u>58.00</u></td>
</tr>
<tr>
  <td style="text-align: center;">MNSC-SDS-Part 6</td>
  <td style="text-align: center;"><strong>61.8</strong></td>
  <td style="text-align: center;">46.2</td>
  <td style="text-align: center;">-</td>
  <td style="text-align: center;">24.2</td>
  <td style="text-align: center;"><u>65.40</u></td>
</tr>
<tr>
  <td style="text-align: center;" rowspan="2"><strong>Speech Instruction</strong><br>LLM-as-a-Judge (<span
  class="math inline"></span>)</td>
  <td style="text-align: center;">OpenHermes-Audio</td>
  <td style="text-align: center;"><strong>71.4</strong></td>
  <td style="text-align: center;">44.8</td>
  <td style="text-align: center;">22.40</td>
  <td style="text-align: center;">15.80</td>
  <td style="text-align: center;"><u>72.20</u></td>
</tr>
<tr>
  <td style="text-align: center;">Alpaca-GPT4-Audio</td>
  <td style="text-align: center;"><strong>73.4</strong></td>
  <td style="text-align: center;">52.6</td>
  <td style="text-align: center;">21.60</td>
  <td style="text-align: center;">17.20</td>
  <td style="text-align: center;"><u>73.80</u></td>
</tr>
<tr>
  <td style="text-align: center;" rowspan="4"><strong>Paralinguistics</strong><br>LLM-as-a-Judge (<span
  class="math inline"></span>)</td>
  <td style="text-align: center;">VoxCeleb-Gender-Test</td>
  <td style="text-align: center;"><strong><u>99.53</u></strong></td>
  <td style="text-align: center;">99.12</td>
  <td style="text-align: center;">69.68</td>
  <td style="text-align: center;">88.81</td>
  <td style="text-align: center;">35.25</td>
</tr>
<tr>
  <td style="text-align: center;">VoxCeleb-Accent-Test</td>
  <td style="text-align: center;"><strong><u>46.35</u></strong></td>
  <td style="text-align: center;">29.18</td>
  <td style="text-align: center;">-</td>
  <td style="text-align: center;">34.22</td>
  <td style="text-align: center;">24.64</td>
</tr>
<tr>
  <td style="text-align: center;">MELD-Sentiment-Test</td>
  <td style="text-align: center;">42.26</td>
  <td style="text-align: center;"><strong>53.49</strong></td>
  <td style="text-align: center;">50.08</td>
  <td style="text-align: center;">42.07</td>
  <td style="text-align: center;"><u>56.67</u></td>
</tr>
<tr>
  <td style="text-align: center;">MELD-Emotion-Test</td>
  <td style="text-align: center;">30.15</td>
  <td style="text-align: center;">40.54</td>
  <td style="text-align: center;"><strong>41.07</strong></td>
  <td style="text-align: center;">30.73</td>
  <td style="text-align: center;"><u>47.39</u></td>
</tr>
</tbody>
</table>
</div>

## Uses

Here we provide a code snippet illustrating the process of loading both the processor and model, alongside detailed instructions on executing the MERaLiON-AudioLLM model for content generation.

> [!WARNING]
> **Out of Scope use**: This model is not intended for use in tool calling, math, and coding tasks.

### Inference

```python
from datasets import load_dataset
from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor

repo_id = "MERaLiON/MERaLiON-AudioLLM-Whisper-SEA-LION"

processor = AutoProcessor.from_pretrained(
    repo_id, 
    trust_remote_code=True,
    )
model = AutoModelForSpeechSeq2Seq.from_pretrained(
    repo_id,
    use_safetensors=True,
    trust_remote_code=True,
)

prompt = "Given the following audio context: <SpeechHere>\n\nText instruction: {query}"
query = "Please transcribe this speech."
conversation = [
    {"role": "user", "content": prompt.format(query=query)}
]

chat_prompt = processor.tokenizer.apply_chat_template(
    conversation=conversation,
    tokenize=False,
    add_generation_prompt=True
)

libri_data = load_dataset("distil-whisper/librispeech_long", "clean", split="validation")
audio_array = libri_data[0]["audio"]["array"]
inputs = processor(text=chat_prompt, audios=audio_array)

outputs = model.generate(**inputs, max_new_tokens=256, do_sample=True, temperature=0.1, top_p=0.9, repetition_penalty=1.1)
generated_ids = outputs[:, inputs['input_ids'].size(1):]
response = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
```

### Batch Inference

MERaLiON-AudioLLM also supports batch inference.

```python
from datasets import load_dataset
from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor

repo_id = "MERaLiON/MERaLiON-AudioLLM-Whisper-SEA-LION"

processor = AutoProcessor.from_pretrained(
    repo_id, 
    trust_remote_code=True,
    )
model = AutoModelForSpeechSeq2Seq.from_pretrained(
    repo_id,
    use_safetensors=True,
    trust_remote_code=True,
)

prompt = "Given the following audio context: <SpeechHere>\n\nText instruction: {query}"
transcribe_query = "Please transcribe this speech."
translate_query = "Can you please translate this speech into written Chinese?"

conversation = [
    [{"role": "user", "content": prompt.format(query=transcribe_query)}],
    [{"role": "user", "content": prompt.format(query=translate_query)}],
]

chat_prompt = processor.tokenizer.apply_chat_template(
    conversation=conversation,
    tokenize=False,
    add_generation_prompt=True
)

libri_data = load_dataset("distil-whisper/librispeech_long", "clean", split="validation")
audio_array = [libri_data[0]["audio"]["array"]]*2
inputs = processor(text=chat_prompt, audios=audio_array)

outputs = model.generate(**inputs, max_new_tokens=256, do_sample=True, temperature=0.1, top_p=0.9, repetition_penalty=1.1)
generated_ids = outputs[:, inputs['input_ids'].size(1):]
response = processor.batch_decode(generated_ids, skip_special_tokens=True)
```

### vLLM Inference

We support hosting the model using vLLM framework. Refer to the guide [here](vllm_plugin_meralion/README.md).

## Disclaimer

The current MERaLiON-AudioLLM has not been specifically aligned for safety and may generate content that is inappropriate, offensive, or harmful. Developers and users are responsible for performing their own safety fine-tuning and implementing necessary security measures. The authors shall not be held liable for any claims, damages, or other liabilities arising from the use of the released models, weights, or code.

## Technical Specifications 

### Training Data

MERaLiON-AudioLLM is trained on a diverse collection of publicly available datasets, alongside synthesised and augmented samples carefully curated by the team and native speakers, totaling 260,000 hours of audio.

### Compute and Infrastructure

MERaLiON-AudioLLM is trained on the **ASPIRE 2A+** Supercomputer Cluster, provided by **National Supercomputing Centre (NSCC)**, Singapore. ASPIRE 2A+ cluster provides multiple H100 nodes, with each compute node equipped with 8 Nvidia H100 GPUs, 2 TB of RAM, and 30 TB of locally attached NVMe storage. These nodes are interconnected via a rail-optimised, full fat-tree topology, utilising 400 Gb/s NDR InfiniBand cables. Additionally, the cluster incorporates a 2.5 PB SSD-based Lustre file system, linked to the H100 nodes through high-speed InfiniBand connections. 

With a global batch size of 640, we train the current release of MERaLiON-AudioLLM for around 200k steps, which took 2 days to complete using 16 nodes, 128 H100 GPUs.

## Citation

If you find our work useful, please cite our paper:

```
@misc{he2024meralionaudiollmtechnicalreport,
      title={MERaLiON-AudioLLM: Bridging Audio and Language with Large Language Models}, 
      author={{MERaLiON Team}},
      year={2024},
      eprint={2412.09818},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2412.09818}, 
}
```