Laya Sentiment Multilingual β€” CoreML FP16

The CoreML conversion of Ramg77/laya-sentiment-multilingual, packaged for on-device inference on Apple Silicon (Neural Engine / GPU).

This repository contains no new model: it is the same fine-tuned checkpoint, converted to CoreML at FP16 precision. Every metric, caveat and limitation of the source model applies here unchanged β€” in particular, the accuracy is 86.0% [84.3, 87.5] on the full 1,740-example test set, and the shipped temperature correction does not reproduce its holdout magnitude out of sample. Read that card before using this one.

Provenance

The conversion records the hash of the weights it came from, so this package can be tied to the published checkpoint byte for byte:

Field Value
Source Ramg77/laya-sentiment-multilingual
source_weights_sha256 1701a2f936d82eaa7a5e3f4da8c236d6f0fe47d03fad9a49f9e5f5a2483d08c9
Precision float16
Attention sdpa
Attention mask construction integer positions v2
Minimum deployment target macOS 15 / iOS 18
Sequence length 512 max, enumerated shapes: 16, 32, 64, 96, 128, 192, 256, 384, 512
Max options 32
Built with coremltools 9.0, torch 2.7.0, numpy 2.1.3
Conversion time 12.1 s

source_weights_sha256 matches the model.safetensors of the source repository exactly.

File hashes

File Bytes sha256
model.mlpackage/Data/com.apple.CoreML/weights/weight.bin 643,902,784 e5530bbd6ff0c0e4c8c238e4a2088943398a9a7e46f3667038e3340e9dca7b48
model.mlpackage/Data/com.apple.CoreML/model.mlmodel 487,682 49953b1887e3122504082788257ac01d8274ca46518d204f9fb691f3f1a4e06a
model.mlpackage/Manifest.json 617 40a5023522ca298559cb5e146d3db6a8d2056528914fb24d055b812306d2dbc5
tokenizer/tokenizer.json 34,363,188 609d8f4c067cd3950f88594c5a802616cea245823836ef5848ee4fc40aab5b6f
tokenizer/tokenizer_config.json 666 bb135a9337286a06936ef5ca4cca89a09e2e270080ab6bbaab4eabfbd339e014
encoder/config.json 1,939 fad4076bcae03044a509e35a2d36c1cdff482fd4c2d6e7c5d187bbc7d8b91590
rl_agent_config.json 471 3147c012b7ecc683d8d4b1a729b3c364f47809c563e45d393a72af5911ee7e74

Layout

A Laya CoreML package is a folder, not just the .mlpackage:

laya-sentiment-multilingual-coreml/
β”œβ”€β”€ model.mlpackage/          # the compiled CoreML model (615 MiB)
β”œβ”€β”€ tokenizer/                # 256k-token multilingual tokenizer (33 MiB)
β”œβ”€β”€ encoder/config.json
β”œβ”€β”€ rl_agent_config.json
└── coreml_config.json        # the provenance record above

Download the whole folder; the loader needs all of it.

Usage

pip install laya-coreml
import laya_coreml as laya

agent = laya.load("Ramg77/laya-sentiment-multilingual-coreml")   # or a local path to the folder
result = agent.predict(
    "I love this product, it changed my life!",
    {
        "sentiment": {
            "type": "noul",
            "instructions": "Does this text express positive sentiment?"
        }
    }
)
print(result["answers"]["sentiment"])   # {'type': 'noul', 'confidence': 0.97, 'noul': 0.97, ...}

For the noul primitive, noul is P(true), i.e. P(positive). Apply the temperature from the source repository's calibration.json (T = 0.9) only with the caveats documented there.

Note: do not pass criteria for a noul question unless you trained with them β€” the head was trained without option descriptions and adding them degrades predictions.

Requirements

  • macOS 15 or iOS 18 and later
  • Apple Silicon for Neural Engine execution; the package also runs on GPU/CPU via CoreML
  • laya-coreml (which brings coremltools) β€” only needed to load or rebuild

Rebuilding

laya-coreml convert <model_dir> laya-sentiment-coreml \
    --max-length 512 --precision float16 --attention sdpa --shape-mode enumerated

<model_dir> must contain model.safetensors, encoder/, tokenizer/ and rl_agent_config.json β€” i.e. a clone of the source repository. Verify the resulting weight.bin against the hash in the table above.

Limitations

  • Same model, same limits. Binary only (no neutral), three languages (EN/ES/DE, Latin script), short social-media text, and a calibration correction that does not transfer out of sample. See the source card for the full list.
  • Latency figures are the author's. 16 ms steady state and 375 ms warmup on an M3 Air (ANE). Not independently verified; measure on your own hardware before relying on it.
  • Not for high-stakes decisions, and not for routing or escalation: this detects expressed sentiment, not customer intent.
  • The source model is published in safetensors and is the canonical artifact. This repository is a convenience build for Apple platforms; if it ever disagrees with the source weights, the source weights win β€” check source_weights_sha256.

Citation

@misc{laya-sentiment-multilingual-coreml,
  author = {Ramg77},
  title = {Laya Sentiment Multilingual β€” CoreML FP16},
  year = {2026},
  publisher = {Hugging Face},
  note = {Conversion of Ramg77/laya-sentiment-multilingual}
}

License

Apache 2.0 β€” and for this repository the point is that a conversion does not relicense anything.

  • The source weights, Ramg77/laya-sentiment-multilingual, are Apache 2.0, and they are in turn a fine-tune of convaiinnovations/laya-multilingual, also Apache 2.0. A derived artifact keeps the license of what it derives from; converting to CoreML FP16 changes the format, not the terms.
  • The initial intent was GPL-2.0, to follow the Laya project's path. Verifying it changed the answer: Laya β€”its GitHub repository, the laya and laya-coreml packages, and the base modelβ€” declares Apache 2.0, not GPL, and the FSF considers Apache 2.0 incompatible with GPL-2.0 (the patent-termination clause), though compatible with GPL-3.0.

The training data carries its own terms, and they do not change with the format either. The dataset (tyqiangz/multilingual-sentiments, Apache 2.0) and its provenance chain β€”identical to the cardiffnlp/tweet_sentiment_multilingual benchmark, which declares no license, with SemEval-2017 Task 4, SB-10K and InterTASS 2017 behind itβ€” are documented in the source model's License section. Review it before commercial use.

Acknowledgments

  • Laya by Nandha Kishor M and Convai Innovations β€” Apache 2.0.
  • multilingual-sentiments by tyqiangz β€” Apache 2.0.
  • Conversion built with the laya-coreml tooling.
Downloads last month
7
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for Ramg77/laya-sentiment-multilingual-coreml

Quantized
(1)
this model