
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
@atjsh/llmlingua-2
Advanced tools
LLMLingua-2, Originally developed and implemented in Python by Microsoft, is a small-size yet powerful prompt compression method.
llmlingua-2-js, ported by atjsh, is a pure JavaScript/TypeScript implementation of LLMLingua-2, designed to run in web browsers and Node.js environments.
You can try it on the GitHub Pages without any installation.
The source code for demo is available in the examples directory. You can run it locally using the following command:
cd examples/react-vite-webgpu
yarn install
This implementation depends on the following libraries:
Especially, the @huggingface/transformers library utilizes various computational optimizations to achieve high performance. Please consult if the running environment supports the minimum requirements from these libraries.
You can use the library by downloading the library from npm and importing it into your JavaScript/TypeScript project.
First, install the dependencies:
npm install @huggingface/transformers @tensorflow/tfjs js-tiktoken
Then, install the library:
npm install @atjsh/llmlingua-2
You can choose between models based on your needs.
| Model | Size | Pros | Cons | Public Model |
|---|---|---|---|---|
| TinyBERT | 57.1 MB | Very small, fast | Lower accuracy than larger models | atjsh/llmlingua-2-js-tinybert-meetingbank |
| MobileBERT | 99.2 MB | Small, optimized for mobile | Moderate accuracy, tradeoff in depth | atjsh/llmlingua-2-js-mobilebert-meetingbank |
| BERT | 710 MB | Faster, smaller size | Lower accuracy than XLM-RoBERTa | Arcoldd/llmlingua4j-bert-base-onnx |
| XLM-RoBERTa | 2240 MB | High accuracy | Slower, slightly larger in size | atjsh/llmlingua-2-js-xlm-roberta-large-meetingbank |
Learn More about the performance of each model (actual performance may vary).
The model files will be downloaded automatically by default.
For more details on how to use the library, please refer to the API reference documentation.
Unit tests are not available at the moment.
E2E tests are partially available in following directories:
src/e2eexamples/**See LICENSE for details.
This software includes other software related under the following licenses:
FAQs
JavaScript/TypeScript Implementation of LLMLingua-2
The npm package @atjsh/llmlingua-2 receives a total of 818 weekly downloads. As such, @atjsh/llmlingua-2 popularity was classified as not popular.
We found that @atjsh/llmlingua-2 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.