Skip to main content

BiasInEar: Assessing Sensitivity in Audio Language Models Across Linguistic, Demographic, and Positional Variations

Project description

BiasInEar

Assessing Sensitivity in Audio Language Models Across Linguistic, Demographic, and Positional Variations

arXiv HuggingFace License

BiasInEar is a benchmark for evaluating speech bias in multilingual multimodal large language models (MLLMs). It provides 11,200 spoken multiple-choice questions across 3 languages, 7 accents, 2 genders, and 2 option orders.

Installation

# Core (metrics only)
pip install biasinear

# With data loading
pip install biasinear[data]

# With audio utilities
pip install biasinear[audio]

# With a specific model provider
pip install biasinear[gemini]     # Google Gemini
pip install biasinear[openai]     # OpenAI
pip install biasinear[nvidia]     # NVIDIA Build
pip install biasinear[mistral]    # Mistral

# Everything
pip install biasinear[all]

Note: Audio features ([audio]) require FFmpeg installed on your system. Install it via brew install ffmpeg (macOS), apt install ffmpeg (Ubuntu), or see ffmpeg.org.

Or with uv:

uv pip install biasinear[all]

Model Providers

BiasInEar includes built-in support for several audio language model APIs:

Provider Class Install Default Model
Google Gemini GeminiModel pip install biasinear[gemini] gemini-2.5-flash
OpenAI OpenAIModel pip install biasinear[openai] gpt-4o-audio-preview
NVIDIA Build NvidiaModel pip install biasinear[nvidia] google/gemma-3n-e4b-it
Mistral MistralModel pip install biasinear[mistral] voxtral-small-2507

API Keys

Set your API key as an environment variable:

export GEMINI_API_KEY="..."
export OPENAI_API_KEY="..."
export NVIDIA_API_KEY="..."
export MISTRAL_API_KEY="..."

Or pass directly when creating the model:

from biasinear.models import GeminiModel
model = GeminiModel(api_key="your-api-key")

Quick Example (Gemini)

import io
import soundfile as sf
from biasinear import load_dataset
from biasinear.models import GeminiModel
from biasinear.utils import concat_audio

def audio_dict_to_bytes(audio_dict: dict) -> bytes:
    """Convert HuggingFace audio dict to WAV bytes."""
    buf = io.BytesIO()
    sf.write(buf, audio_dict["array"], audio_dict["sampling_rate"], format="WAV")
    return buf.getvalue()

model = GeminiModel()  # uses GEMINI_API_KEY env var
dataset = load_dataset(config="en_Female")
sample = dataset[0]

q_bytes = audio_dict_to_bytes(sample["question"])
opt_bytes = [audio_dict_to_bytes(sample[f"option_{c}"]) for c in "abcd"]
combined = concat_audio(question=q_bytes, options=opt_bytes)

output = model.generate(combined)
print(output["answer"], output["raw_response"])

See examples/ for complete provider scripts.

Quick Start

1. Load Data

from biasinear import load_dataset

# Load a specific config
dataset = load_dataset(config="en_Female")

# Load all configs merged
dataset = load_dataset()

2. Run Inference

from biasinear.utils import concat_audio
from biasinear.models import BaseModel

# Implement your model by extending BaseModel
class MyModel(BaseModel):
    def generate(self, audio: bytes) -> dict:
        # Your API call here
        return {"answer": "A", "raw_response": "..."}

model = MyModel("my-model")
output = model.generate(audio_bytes)

3. Evaluate

from biasinear import Evaluator

evaluator = Evaluator(
    predictions=["A", "B", "A", ...],
    references=["A", "A", "A", ...],
    question_ids=["q1", "q1", "q2", ...],
    groups={
        "language": ["en", "en", "zh", ...],
        "gender": ["Female", "Male", "Female", ...],
        "order": ["original", "reversed", "original", ...],
    },
)
results = evaluator.run()
# {
#     "accuracy": 0.75,
#     "entropy": {"mean": 0.32, "per_question": {...}},
#     "apes": {"language": 0.12, "gender": 0.03, "order": 0.15},
#     "fleiss_kappa": {"language": 0.65, "gender": 0.88, "order": 0.52},
# }

Use Metrics Individually

from biasinear import accuracy, question_entropy, apes, fleiss_kappa

acc = accuracy(predictions, references)
ent = question_entropy(["A", "A", "B", "C"], num_categories=4)
apes_val = apes([0.3, 0.5, 0.4])
kappa = fleiss_kappa(ratings_matrix)

Metrics

Metric Description
Accuracy Standard MCQ correctness
Question Entropy Prediction uncertainty across configurations
APES Average Pairwise Entropy Shift across variable levels
Fleiss' Kappa Inter-rater agreement across perturbations

See the paper for details.

Citation

@inproceedings{wei-etal-2026-biasinear,
  title={Bias in the Ear of the Listener: Assessing Sensitivity in Audio Language Models Across Linguistic, Demographic, and Positional Variations},
  author={Wei, Sheng-Lun and Liao, Yu-Ling and Chang, Yen-Hua and Huang, Hen-Hsen and Chen, Hsin-Hsi},
  booktitle={Findings of the Association for Computational Linguistics: EACL 2026},
  year={2026},
  publisher={Association for Computational Linguistics}
}

License

Apache License 2.0. See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

biasinear-0.2.1.tar.gz (20.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

biasinear-0.2.1-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file biasinear-0.2.1.tar.gz.

File metadata

  • Download URL: biasinear-0.2.1.tar.gz
  • Upload date:
  • Size: 20.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for biasinear-0.2.1.tar.gz
Algorithm Hash digest
SHA256 8320b2969d63a6e402340c0eafa55fee914207f0f03fd54dc91188e9f0c6f526
MD5 8c1eb85ec8506a47af787073a694c653
BLAKE2b-256 e9540416f7a69a2b9dac86b75b74951d05cad953b8b724f35528ba9bb4999634

See more details on using hashes here.

Provenance

The following attestation bundles were made for biasinear-0.2.1.tar.gz:

Publisher: publish.yml on ntunlplab/BiasInEar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file biasinear-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: biasinear-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 21.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for biasinear-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b148ff2ffcbab79a72401015130dc4d31395c5e625d7e02d88ba31c205a68b0f
MD5 942889e4de11f8fbeb296cf5f2abeeda
BLAKE2b-256 3d86b0022fb71cf740609bae012b7aeb809ba3d9f2218a89fb7b02db94e1742e

See more details on using hashes here.

Provenance

The following attestation bundles were made for biasinear-0.2.1-py3-none-any.whl:

Publisher: publish.yml on ntunlplab/BiasInEar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page