A full fine-tune of
LFM2.5-Encoder-350M
with a rule-matching head that scores every text token against free-text policy rules in a single encoder pass.
Find more details about our encoders in our
blog post
.
💻
Demos
: Try this fine-tuned model running in a CPU-only Hugging Face space:
Zero-shot policy linting
** — check text against your company's rules, written as free text. It scores every token against every rule in one pass.
Usage
⚠️ Loads custom code via
trust_remote_code=True
(the model wraps a
trust_remote_code
encoder).
Install the required packages:
pip install torch transformers
Run zero-shot policy linting:
import sys
from pathlib import Path
import torch
from transformers import AutoTokenizer
repo = Path(".")
sys.path.insert(0, str(repo))
from train_bizlint_v02 import Lfm2BidirForRuleMatching
rules = [
"Flag direct mentions of competitor companies.",
"Flag promises about guaranteed financial returns.",
]
text = "Our product is better than AcmeAI and will guarantee 30% savings."
prefix = "Policy:\n" + "\n".join(f"- {rule}"for rule in rules) + "\n\nText:\n"
full_text = prefix + text
tokenizer = AutoTokenizer.from_pretrained(repo, trust_remote_code=True)
model = Lfm2BidirForRuleMatching.from_pretrained(repo, trust_remote_code=True).eval()
enc = tokenizer(full_text, return_offsets_mapping=True, return_tensors="pt")
offsets = enc.pop("offset_mapping")[0].tolist()
rule_pool = torch.zeros(1, len(rules), len(offsets))
pos = len("Policy:\n")
for rule_idx, rule inenumerate(rules):
start = pos + 2
end = start + len(rule)
token_idxs = [
i for i, (a, b) inenumerate(offsets)
if a < end and b > start and a != b
]
rule_pool[0, rule_idx, token_idxs] = 1 / len(token_idxs)
pos = end + 1with torch.no_grad():
probs = model(**enc, rule_pool=rule_pool)["logits"].sigmoid()[0]
text_start = len(prefix)
for token_idx, (a, b) inenumerate(offsets):
if b <= text_start or a == b:
continue
token_text = full_text[a:b]
for rule_idx, prob inenumerate(probs[token_idx]):
if prob.item() > 0.5:
print(f"{token_text!r} -> {prob.item():.3f}: {rules[rule_idx]}")
If you are interested in custom solutions with edge deployment, please contact
our sales team
.
Citation
@article{liquidAI2026Encoders,
author = {Liquid AI},
title = {LFM2.5-Encoders: Fast at Long Context, Even on CPU},
journal = {Liquid AI Blog},
year = {2026},
note = {www.liquid.ai/blog/lfm2-5-encoders},
}
Runs of LiquidAI LFM2.5-Encoder-350M-Policy-Linter on huggingface.co
518
Total runs
0
24-hour runs
274
3-day runs
292
7-day runs
514
30-day runs
More Information About LFM2.5-Encoder-350M-Policy-Linter huggingface.co Model
More LFM2.5-Encoder-350M-Policy-Linter license Visit here:
LFM2.5-Encoder-350M-Policy-Linter huggingface.co is an AI model on huggingface.co that provides LFM2.5-Encoder-350M-Policy-Linter's model effect (), which can be used instantly with this LiquidAI LFM2.5-Encoder-350M-Policy-Linter model. huggingface.co supports a free trial of the LFM2.5-Encoder-350M-Policy-Linter model, and also provides paid use of the LFM2.5-Encoder-350M-Policy-Linter. Support call LFM2.5-Encoder-350M-Policy-Linter model through api, including Node.js, Python, http.
LFM2.5-Encoder-350M-Policy-Linter huggingface.co is an online trial and call api platform, which integrates LFM2.5-Encoder-350M-Policy-Linter's modeling effects, including api services, and provides a free online trial of LFM2.5-Encoder-350M-Policy-Linter, you can try LFM2.5-Encoder-350M-Policy-Linter online for free by clicking the link below.
LiquidAI LFM2.5-Encoder-350M-Policy-Linter online free url in huggingface.co:
LFM2.5-Encoder-350M-Policy-Linter is an open source model from GitHub that offers a free installation service, and any user can find LFM2.5-Encoder-350M-Policy-Linter on GitHub to install. At the same time, huggingface.co provides the effect of LFM2.5-Encoder-350M-Policy-Linter install, users can directly use LFM2.5-Encoder-350M-Policy-Linter installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
LFM2.5-Encoder-350M-Policy-Linter install url in huggingface.co: