vindex
Evaluation metrics for Indic and code-mixed LLM output.
Install
pip install vindex
Example
from vindex import script_adherence
result = script_adherence(
prompt="Mumbai kahan hai?",
response="Mumbai is the capital of Maharashtra.",
)
print(result.label) # "language_mismatch"
print(result.passed) # False
print(result.reason) # "prompt is Romanized Hindi; response is Roman-script English."
script_adherence(prompt, response) checks whether a response came back
in the script and language the prompt used -- no reference answer
needed. Labels: matched, mixed, script_mismatch,
language_mismatch, empty.
The finding this package is built around
Same model, same 30 questions, one system-prompt change. The first prompt ("reply in the same language and script the user used") is ambiguous enough that a Romanized-Hindi ("Hinglish") prompt gets answered in Devanagari 4 times out of 5. A strict, script-forbidding prompt fixes it completely.
| variant | rate, original prompt | rate, strict prompt |
|---|---|---|
| en | 1.000 | 1.000 |
| hi | 0.900 | 0.900 |
| hinglish | 0.200 | 1.000 |
Reproduced by vindex.script_adherence against the two source datasets
in experiments/scripts/validate_vindex_port.py -- run it yourself:
python experiments/scripts/validate_vindex_port.py
Limitations
- 9 scripts recognized, nothing else. Devanagari, Kannada, Tamil,
Telugu, Bengali, Gujarati, Malayalam, Odia, Gurmukhi, plus Latin.
Anything else (Cyrillic, CJK, emoji, digits, punctuation-only text)
has no script bucket of its own and falls through to
mixed-- this is a real gap, not a rare edge case, if your data has other scripts in it. language_mismatchdetection is a v0 heuristic. It checks for 14 hand-picked Hindi function words (hai,hain,kya,nahi, ...) in Romanized text. No transliteration-variant coverage, no verb conjugations, no other Romanized Indic languages, not ML-based. One matching word is treated as a signal, not proof.- Devanagari's danda (।) is shared punctuation. It lives in the
Devanagari Unicode block but is reused as a sentence-ending mark in
Bengali, Odia, Gurmukhi, and others, so a couple of stray
devanagari_charscan show up in a purely non-Devanagari sentence. Documented invindex/script.py; doesn't change classification output in practice, since real sentences have far more dominant-script characters than stray punctuation. - No reference-based correctness check.
script_adherenceverifies script/language, not whether the answer is factually right.script_normalized_match(transliteration-aware answer comparison) is on the roadmap, not shipped yet.
Release files for vindex 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| vindex-0.1.0.tar.gz | 18.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| vindex-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.6 kB
Release files / vindex-0.1.0.tar.gz
| Download URL | vindex-0.1.0.tar.gz |
|---|---|
| Size | 18.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
87e359c1955a7cf254293804817a4ad9444c73ea9a012b0bcab3a23d4a6a7e62
|
|
BLAKE2b-256 checksum How to use checksums |
7c8ac880f6c7bdbc7b87c334240f81212b61370772abdc450c6d709c0bab4f6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.5
|
Release files / vindex-0.1.0-py3-none-any.whl
| Download URL | vindex-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8926584c3e8ae79278de04c3b3d9b270c485646368175ff3fe860aae6f9a72ef
|
|
BLAKE2b-256 checksum How to use checksums |
560b06fd5e394ac17c9298e8c1e623eec7781996e2ae77ae943cca12dcdd7faf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.5
|