npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

project_void

v1.0.6

Published

LLM entropy-aware token compression for prompts

Readme

Project Void

Repository: github.com/SaBA26-void/project_void · Author: @SaBA26-void

Entropy-aware prompt compression for large language models.

Project Void analyzes token probability and entropy to remove low-information tokens while preserving semantic structure.

Designed for:

  • Prompt optimization
  • Token-cost reduction
  • LLM preprocessing pipelines
  • Entropy-based NLP experiments

Installation

Requires Node.js 18+.

npm install project_void

On first use, the Hugging Face model (e.g. Xenova/gpt2) is downloaded from the network and cached locally.

Install size

The published project_void package is small (source only). npm install also pulls in @huggingface/transformers (ONNX Runtime, native addons), which is typically hundreds of MB on disk. That footprint comes from running a local causal LM, not from this library’s compression code.


Usage

Probability mode

import { compressPrompt } from "project_void";

const result = await compressPrompt(
  "Xenova/gpt2",
  // optional
  { dtype: "fp32" }, // "q4"|"q5"|"q8"|"fp16"|"fp32"   by default {dtype = "fp16"}
  "What is the capital city of France?",
  {
    probability: 0.1,
  },
);

console.log(result.text);

Entropy mode

import { compressPrompt } from "project_void";

const result = await compressPrompt("Xenova/gpt2", {}, prompt, { entropy: 7 });

// or with explicit dtype:

const result = await compressPrompt("Xenova/gpt2", { dtype: "q8" }, prompt, {
  entropy: 7,
});

console.log(result.text);

Full Example

import { compressPrompt } from "project_void";

const prompt = "What is the capital city of France?";

const result = await compressPrompt("Xenova/gpt2", {}, prompt, {
  probability: 0.1,
});

const originalTokenCount =
  result.kept.reduce((s, w) => s + w.tokenCount, 0) +
  result.removed.reduce((s, w) => s + w.tokenCount, 0);

const compressedTokenCount = result.kept.reduce((s, w) => s + w.tokenCount, 0);

console.log(`Original: "${prompt}" (${originalTokenCount} tokens)`);

console.log(
  `Compressed: "${result.text.trim()}" (${compressedTokenCount} tokens)`,
);

console.log("\nKept:");

for (const w of result.kept) {
  console.log(
    `"${w.text}" prob=${w.probability.toFixed(4)} entropy=${w.entropy.toFixed(2)} bits`,
  );
}

console.log("\nRemoved:");

for (const w of result.removed) {
  console.log(
    `"${w.text}" prob=${w.probability.toFixed(4)} entropy=${w.entropy.toFixed(2)} bits`,
  );
}

API

compressPrompt(modelId, quantization, prompt, options)

Compresses text using token-level probability or entropy filtering.

Parameters

| Name | Type | Description | | --------------------- | -------- | -------------------------------------------------- | | modelId | string | Hugging Face model identifier (e.g. Xenova/gpt2) | | quantization | object | quantization alocas q4 4 bits fp16 16bits etc | | prompt | string | Input text | | options.probability | number | Keep tokens below probability threshold | | options.entropy | number | Keep tokens above entropy threshold |

Use either:

  • probability

or

  • entropy

Returns

{
  text: string,
  kept: Word[],
  removed: Word[]
}

Each word contains:

{
  text: string,
  probability: number,
  entropy: number,
  tokenCount: number
}

Mutual exclusivity: you must pass probability or entropy, not both; omitting both throws. First word always kept: compressAndJoin uses alwaysKeepFirst = true, so the first word is never removed regardless of threshold. Word shape: returned words also include id and ids (internal fields from merging), not just text, probability, entropy, tokenCount.



Compression Strategy

Probability mode

Keeps low-probability (informative) tokens.


Entropy mode

Keeps high-entropy (uncertain / information-rich) tokens.


Example Output

{
  text: "capital France",
  kept: [...],
  removed: [...]
}

Features

  • Token probability pruning
  • Entropy-based filtering
  • Claude Shannon information theory
  • Hugging Face transformer support (@huggingface/transformers)
  • ESM package with a single public export: compressPrompt
  • Token-level analysis output
  • Research-friendly compression pipeline

Use Cases

  • Reduce LLM prompt cost
  • Compress retrieval context
  • Token saliency analysis
  • Prompt engineering experiments
  • Information-density filtering

License

MIT


Author

Saba Bakuradze@SaBA26-void