---
title: Word Info. Lost
description: >-
  Word Information Lost (WIL) is a metric of the performance of an automatic
  speech recognition system.
canonical: 'https://lightning.ai/docs/torchmetrics/stable/text/word_info_lost'
---
# Word Info. Lost {#word-info-lost}

## Module Interface {#module-interface}

### `class torchmetrics.text.WordInfoLost(**kwargs)` {#torchmetrics.text.WordInfoLost}

[\[source\]](https://github.com/Lightning-AI/torchmetrics/blob/v1.9.0/src/torchmetrics/text/wil.py#L28-L138)

Word Information Lost ([WIL](https://www.isca-speech.org/archive/interspeech_2004/morris04_interspeech.html)) is a metric of the performance of an automatic speech recognition system.

This value indicates the percentage of words that were incorrectly predicted between a set of ground-truth sentences and a set of hypothesis sentences. The lower the value, the better the performance of the ASR system with a WordInfoLost of 0 being a perfect score. Word Information Lost rate can then be computed as:

```math
wil = 1 - \frac{C}{N} + \frac{C}{P}
```

where:

*   $`C`$ is the number of correct words,
    
*   $`N`$ is the number of words in the reference
    
*   $`P`$ is the number of words in the prediction
    

As input to `forward` and `update` the metric accepts the following input:

*   `preds` (`List`): Transcription(s) to score as a string or list of strings
    
*   `target` (`List`): Reference(s) for each speech input as a string or list of strings
    

As output of `forward` and `compute` the metric returns the following output:

*   `wil` ([`Tensor`](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "(in PyTorch v2.13)")): A tensor with the Word Information Lost score
    

Parameters:

**kwargs** ([`Any`](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.14)")) – Additional keyword arguments, see [Advanced metric settings](/docs/torchmetrics/1.9.0/user-guide/overview.md#metric-kwargs) for more info.

Examples

```python
>>> from torchmetrics.text import WordInfoLost
>>> preds = ["this is the prediction", "there is an other sample"]
>>> target = ["this is the reference", "there is another one"]
>>> wil = WordInfoLost()
>>> wil(preds, target)
tensor(0.6528)
```

#### `plot(val=None, ax=None)` {#torchmetrics.text.WordInfoLost.plot}

[\[source\]](https://github.com/Lightning-AI/torchmetrics/blob/v1.9.0/src/torchmetrics/text/wil.py#L96-L138)

Plot a single or multiple values from the metric.

Parameters:

*   **val** (`Union`\[[`Tensor`](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "(in PyTorch v2.13)"), [`Sequence`](https://docs.python.org/3/library/collections.abc.html#collections.abc.Sequence "(in Python v3.14)")\[[`Tensor`](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "(in PyTorch v2.13)")\], [`None`](https://docs.python.org/3/library/constants.html#None "(in Python v3.14)")\]) – Either a single result from calling metric.forward or metric.compute or a list of these results. If no value is provided, will automatically call metric.compute and plot that result.
    
*   **ax** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.14)")\[[`Axes`](https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.html#matplotlib.axes.Axes "(in Matplotlib v3.11.1)")\]) – An matplotlib axis object. If provided will add plot to that axis
    

Return type:

[`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.14)")\[[`Figure`](https://matplotlib.org/stable/api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure "(in Matplotlib v3.11.1)"), `Union`\[[`Axes`](https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.html#matplotlib.axes.Axes "(in Matplotlib v3.11.1)"), [`ndarray`](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray "(in NumPy v2.5)")\]\]

Returns:

Figure and Axes object

Raises:

[**ModuleNotFoundError**](https://docs.python.org/3/library/exceptions.html#ModuleNotFoundError "(in Python v3.14)") – If matplotlib is not installed

```python
>>> # Example plotting a single value
>>> from torchmetrics.text import WordInfoLost
>>> metric = WordInfoLost()
>>> preds = ["this is the prediction", "there is an other sample"]
>>> target = ["this is the reference", "there is another one"]
>>> metric.update(preds, target)
>>> fig_, ax_ = metric.plot()
```

[![../../\_images/word\_info\_lost-1.png](/docs/torchmetrics/1.9.0/static/_images/word_info_lost-1.png)](/docs/torchmetrics/1.9.0/static/_images/word_info_lost-1.png)

```python
>>> # Example plotting multiple values
>>> from torchmetrics.text import WordInfoLost
>>> metric = WordInfoLost()
>>> preds = ["this is the prediction", "there is an other sample"]
>>> target = ["this is the reference", "there is another one"]
>>> values = [ ]
>>> for _ in range(10):
...     values.append(metric(preds, target))
>>> fig_, ax_ = metric.plot(values)
```

[![../../\_images/word\_info\_lost-2.png](/docs/torchmetrics/1.9.0/static/_images/word_info_lost-2.png)](/docs/torchmetrics/1.9.0/static/_images/word_info_lost-2.png)

## Functional Interface {#functional-interface}

### `torchmetrics.functional.text.word_information_lost(preds, target)` {#torchmetrics.functional.text.word_information_lost}

[\[source\]](https://github.com/Lightning-AI/torchmetrics/blob/v1.9.0/src/torchmetrics/functional/text/wil.py#L72-L94)

Word Information Lost rate is a metric of the performance of an automatic speech recognition system.

This value indicates the percentage of characters that were incorrectly predicted. The lower the value, the better the performance of the ASR system with a Word Information Lost rate of 0 being a perfect score.

Parameters:

*   **preds** (`Union`\[[`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.14)"), [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.14)")\[[`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.14)")\]\]) – Transcription(s) to score as a string or list of strings
    
*   **target** (`Union`\[[`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.14)"), [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.14)")\[[`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.14)")\]\]) – Reference(s) for each speech input as a string or list of strings
    

Return type:

[`Tensor`](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "(in PyTorch v2.13)")

Returns:

Word Information Lost rate

Examples

```python
>>> from torchmetrics.functional.text import word_information_lost
>>> preds = ["this is the prediction", "there is an other sample"]
>>> target = ["this is the reference", "there is another one"]
>>> word_information_lost(preds, target)
tensor(0.6528)
```

---

**Navigation**

- Parent: [Text](/docs/torchmetrics/1.9.0/text.md)
