Last updated: 2026-09-04
TKBEN is a local web application for understanding how tokenizers behave on real text. It helps you inspect datasets, examine tokenizer vocabularies, measure tokenizer performance, and compare several tokenizers under the same conditions.
The application is useful when you need to answer questions such as:
TKBEN runs locally. The browser is the user interface, while a local Python service performs the analysis and stores datasets, tokenizer assets, and reports in the application workspace. SQLite is the default local store; an externally managed PostgreSQL store is also supported for advanced setups. Hugging Face provides optional dataset and tokenizer sources, and completed dashboards can be exported as PDF files.
tokenizer.json. Inspect vocabulary size, token-length and token-shape behavior, special tokens, and a paginated vocabulary preview.The application opens on the Dataset page and provides three primary pages: Dataset, Tokenizers, and Cross Benchmark. A normal session moves from dataset preparation to tokenizer preparation and then to comparison, but saved reports can be reopened at any time without repeating the work.
A tokenizer converts text into smaller pieces called tokens. Those pieces are the units that a language model reads. Different tokenizers can represent the same sentence with different numbers and kinds of pieces, which affects speed, memory use, context-window usage, and how well unusual words or characters are handled.
TKBEN keeps the comparison grounded in the text you choose:
No single metric identifies the best tokenizer for every purpose. TKBEN presents several complementary signals so you can balance speed, token usage, fidelity, vocabulary behavior, and resource consumption for your own data.
Windows users should use the project launcher. From the repository root, run:
.\start_on_windows.ps1
Choose Launch application from the menu. On first use, the launcher prepares the required local runtimes and dependencies, creates settings/.env, starts the application services, waits for them to become ready, and reports the address to open in your browser. The first launch may take a few minutes and requires an internet connection so that missing runtimes and packages can be obtained.
On later launches, the prepared environment is reused when it is still valid. You normally do not need to start the frontend or backend separately on Windows.
If Windows blocks the automatic browser opening, this does not necessarily mean that TKBEN failed to start. Copy the local URL printed by the launcher and open it manually.
The automatic portable-runtime setup is Windows-only. On macOS or Linux, install these prerequisites using your normal system tools:
uvFrom the repository root, use two terminals. In the first terminal, prepare and start the local service:
cd app/server
uv sync
uv run python -m uvicorn server.app:app --app-dir .. --host 127.0.0.1 --port 5000
In the second terminal, prepare and start the web interface:
cd app/client
npm ci
npm run preview -- --host 127.0.0.1 --port 8000 --strictPort
Then open http://127.0.0.1:8000. Keep both terminals running while you use the application. Stop each process with Ctrl+C when finished.
On Windows, run the launcher from the repository root:
.\start_on_windows.ps1
The launcher prints the active local address. Use that address rather than guessing a port, especially if you have changed local settings or another application is already using the default port. TKBEN is local by default: the address is intended for use on the same computer.
Long downloads, validation runs, and benchmarks are handled as background jobs. Progress is shown in the interface; wait for the job to finish before opening its report or starting a dependent workflow.
Use the Dataset page to build a local, reusable text collection.
.csv, .xls, or .xlsx file.The predefined C4 option intentionally uses a manageable sample of up to 10,000 documents for local work. If you need a different portion or the full source, add the Hugging Face dataset by its name instead.
The saved dashboard includes aggregate and word-level statistics, character composition, document- and word-length histograms, frequency views, entropy, duplicate indicators, concentration signals, and a word cloud when the selected data supports them. Histogram views can be switched between counts and cumulative distribution, and the word-cloud frame expands with its panel while keeping every displayed label inside the frame. A missing chart or unavailable measure means that the relevant data was not available for that run; it is not silently replaced with a zero.
Use the Tokenizers page to prepare and understand tokenizer assets.
tokenizer.json for a tokenizer that is not hosted there.Only tokenizers that download and load successfully become available for benchmarking. If a download fails, check the identifier, network connection, and access rights before trying again.
Use Cross Benchmark to compare tokenizer behavior on the same saved dataset.
The report dashboard presents comparable metrics as charts. Each widget keeps its compatible visualization switches beside its title, and long titles wrap within the available heading space without covering those controls. Depending on the data, you can switch between compatible chart styles, reorder widgets, hide measures that are not useful for the current question, and open a data table beneath a chart. Dashboard layout choices are saved in the browser for later visits; changing the layout does not rerun the benchmark.
The report also shows tokenizer-specific failures and unavailable measures explicitly. A failed tokenizer is not displayed as a misleading zero-value result. You can cancel an active benchmark from the run wizard; a cancelled run does not create a completed benchmark report.
For a fair comparison, keep the following consistent:
Performance values are affected by CPU, memory, operating system, background activity, batch size, and the number of trials. Treat them as measurements for the selected environment, not universal properties of a tokenizer.
When reviewing a report:
N/A, unavailable, or missing values should be read as “not measured or not applicable,” not as zero.The following full-page captures show the main screens with populated sample data. Your counts, charts, and report values will depend on the datasets, tokenizers, metrics, and sampling choices you use.
The settings view centralizes optional local runtime choices. Most users can keep the generated defaults and work entirely from the launcher.
Settings page showing the local runtime, port, logging, and integration controls used by the launcher.
Dataset dashboard with a loaded validation session, aggregate statistics, switchable histograms, and word-cloud analytics.
Full-page dataset dashboard for a populated local text dataset. Review dataset health, lexical metrics, histogram and cumulative-distribution views, entropy, concentration, and contained word-cloud signals before benchmarking.
Tokenizers dashboard with an opened tokenizer report, vocabulary statistics, token-length views, and a populated token preview table.
Full-page custom tokenizer report showing vocabulary metadata, token-length distribution and summary shape metrics, and a paginated token preview.
Cross-benchmark dashboard with a loaded run summary, comparative metric panels, and in-title visualization switches.
Full-page cross-benchmark report comparing two tokenizers across throughput, vocabulary, latency, round-trip fidelity, and run diagnostics.
Most users only need Launch application in the Windows launcher menu. Use the other options when the menu or a release note specifically calls for them.
The maintenance menu can help you:
The launcher checks the local database when the application starts and applies required updates automatically. Do not delete the database or saved resource folders manually while the application is running.
The Remove All Data action is permanent for the local workspace. It removes saved datasets, tokenizer files, reports, logs, and stored Hugging Face access-key material while preserving the application files themselves. Back up anything you may need before confirming this action.
Copy the local address printed by the launcher and open it manually. On managed Windows machines, browser auto-open can be blocked even when the services started correctly.
The first launch may be downloading runtimes, installing packages, preparing the database, or building the web interface. Allow the progress indicators to finish. If there is no progress, check your internet connection and available disk space, close duplicate TKBEN windows, and run the launcher again.
Close another TKBEN instance or the application using that local address, then restart TKBEN. If you intentionally need different ports, change the local settings and restart both parts of the application. Always use the URL printed by the launcher after the change.
Check the repository name and optional dataset configuration, then retry with a stable network connection. For gated or private resources, accept the source’s terms and add a Hugging Face read-access key using the key button in the application header. If a key is already configured but access is denied, verify that it belongs to an account allowed to use that resource.
Make sure the file is one of the supported formats and contains a column with document text. Remove empty rows, confirm that the file is not damaged, and try a smaller sample if the file is very large. A spreadsheet with only numeric fields or unrelated metadata cannot provide a useful text analysis.
Confirm that the relevant dataset validation or benchmark finished successfully and that you opened the saved report rather than only selecting an input. Reset catalog filters if no items are visible. Some measures require enough documents or observations and may correctly appear as unavailable.
Open the run diagnostics to see which tokenizer failed. Check that the tokenizer was downloaded or uploaded completely, that its source is accessible, and that the dataset contains usable text. Remove and prepare the tokenizer again if necessary, then start a new run.
Large datasets, many selected metrics, optional language-model measures, and detailed per-document statistics require more time and memory. Start with a smaller document sample and the default settings. For speed comparisons, repeat runs under similar computer conditions and compare the same sample.
Open a completed report before exporting and choose a folder where you can create files. If you cancel the native save dialog, no PDF is created and no error is expected. If export still fails, reduce the dashboard to the measures you need and try again.
Confirm that Python, Node.js, and uv are installed and available in the terminal you are using. Run the commands from the repository directories shown above, use a shell with permission to read the project, and keep the backend and frontend terminals separate. The Windows launcher is not available on these platforms, so the two manual processes must both be started.
TKBEN keeps its working data locally so that completed analyses can be reopened after a restart.
app/resources: saved datasets, tokenizer assets, reports, the local database, and logs. Back up the relevant contents of this folder if you need to preserve your work.settings: local settings and templates used by the launcher. Most users never need to edit this folder.assets/figures: screenshots used in this guide.assets/docs: deeper project and runtime reference material for advanced users and maintainers.The application does not provide cloud synchronization by default. Moving TKBEN to another computer therefore requires you to preserve any local data you want to keep and then prepare the local runtime on the new machine.
The Windows launcher creates settings/.env automatically and supplies sensible defaults. Most users should leave those defaults unchanged.
You may need to edit the local settings only when you want to:
Restart TKBEN after changing settings/.env. Keep this file private: it can contain machine-specific paths, database connection details, or other sensitive values. Hugging Face access keys should be added and managed through the application’s key manager rather than placed in screenshots or shared documentation.
Versioned source releases are available from the GitHub releases page. A source archive contains the application files, not your local datasets, downloaded tokenizer assets, credentials, logs, or generated reports.
Before updating to a new release:
This project is licensed under the MIT License. See LICENSE for details.
558 commits
Python
67.7%
TypeScript
13.4%
CSS
7.3%
HTML
6.7%
PowerShell
3.8%
Last updated: 2026-09-04
TKBEN is a local web application for understanding how tokenizers behave on real text. It helps you inspect datasets, examine tokenizer vocabularies, measure tokenizer performance, and compare several tokenizers under the same conditions.
The application is useful when you need to answer questions such as:
TKBEN runs locally. The browser is the user interface, while a local Python service performs the analysis and stores datasets, tokenizer assets, and reports in the application workspace. SQLite is the default local store; an externally managed PostgreSQL store is also supported for advanced setups. Hugging Face provides optional dataset and tokenizer sources, and completed dashboards can be exported as PDF files.
tokenizer.json. Inspect vocabulary size, token-length and token-shape behavior, special tokens, and a paginated vocabulary preview.The application opens on the Dataset page and provides three primary pages: Dataset, Tokenizers, and Cross Benchmark. A normal session moves from dataset preparation to tokenizer preparation and then to comparison, but saved reports can be reopened at any time without repeating the work.
A tokenizer converts text into smaller pieces called tokens. Those pieces are the units that a language model reads. Different tokenizers can represent the same sentence with different numbers and kinds of pieces, which affects speed, memory use, context-window usage, and how well unusual words or characters are handled.
TKBEN keeps the comparison grounded in the text you choose:
No single metric identifies the best tokenizer for every purpose. TKBEN presents several complementary signals so you can balance speed, token usage, fidelity, vocabulary behavior, and resource consumption for your own data.
Windows users should use the project launcher. From the repository root, run:
.\start_on_windows.ps1
Choose Launch application from the menu. On first use, the launcher prepares the required local runtimes and dependencies, creates settings/.env, starts the application services, waits for them to become ready, and reports the address to open in your browser. The first launch may take a few minutes and requires an internet connection so that missing runtimes and packages can be obtained.
On later launches, the prepared environment is reused when it is still valid. You normally do not need to start the frontend or backend separately on Windows.
If Windows blocks the automatic browser opening, this does not necessarily mean that TKBEN failed to start. Copy the local URL printed by the launcher and open it manually.
The automatic portable-runtime setup is Windows-only. On macOS or Linux, install these prerequisites using your normal system tools:
uvFrom the repository root, use two terminals. In the first terminal, prepare and start the local service:
cd app/server
uv sync
uv run python -m uvicorn server.app:app --app-dir .. --host 127.0.0.1 --port 5000
In the second terminal, prepare and start the web interface:
cd app/client
npm ci
npm run preview -- --host 127.0.0.1 --port 8000 --strictPort
Then open http://127.0.0.1:8000. Keep both terminals running while you use the application. Stop each process with Ctrl+C when finished.
On Windows, run the launcher from the repository root:
.\start_on_windows.ps1
The launcher prints the active local address. Use that address rather than guessing a port, especially if you have changed local settings or another application is already using the default port. TKBEN is local by default: the address is intended for use on the same computer.
Long downloads, validation runs, and benchmarks are handled as background jobs. Progress is shown in the interface; wait for the job to finish before opening its report or starting a dependent workflow.
Use the Dataset page to build a local, reusable text collection.
.csv, .xls, or .xlsx file.The predefined C4 option intentionally uses a manageable sample of up to 10,000 documents for local work. If you need a different portion or the full source, add the Hugging Face dataset by its name instead.
The saved dashboard includes aggregate and word-level statistics, character composition, document- and word-length histograms, frequency views, entropy, duplicate indicators, concentration signals, and a word cloud when the selected data supports them. Histogram views can be switched between counts and cumulative distribution, and the word-cloud frame expands with its panel while keeping every displayed label inside the frame. A missing chart or unavailable measure means that the relevant data was not available for that run; it is not silently replaced with a zero.
Use the Tokenizers page to prepare and understand tokenizer assets.
tokenizer.json for a tokenizer that is not hosted there.Only tokenizers that download and load successfully become available for benchmarking. If a download fails, check the identifier, network connection, and access rights before trying again.
Use Cross Benchmark to compare tokenizer behavior on the same saved dataset.
The report dashboard presents comparable metrics as charts. Each widget keeps its compatible visualization switches beside its title, and long titles wrap within the available heading space without covering those controls. Depending on the data, you can switch between compatible chart styles, reorder widgets, hide measures that are not useful for the current question, and open a data table beneath a chart. Dashboard layout choices are saved in the browser for later visits; changing the layout does not rerun the benchmark.
The report also shows tokenizer-specific failures and unavailable measures explicitly. A failed tokenizer is not displayed as a misleading zero-value result. You can cancel an active benchmark from the run wizard; a cancelled run does not create a completed benchmark report.
For a fair comparison, keep the following consistent:
Performance values are affected by CPU, memory, operating system, background activity, batch size, and the number of trials. Treat them as measurements for the selected environment, not universal properties of a tokenizer.
When reviewing a report:
N/A, unavailable, or missing values should be read as “not measured or not applicable,” not as zero.The following full-page captures show the main screens with populated sample data. Your counts, charts, and report values will depend on the datasets, tokenizers, metrics, and sampling choices you use.
The settings view centralizes optional local runtime choices. Most users can keep the generated defaults and work entirely from the launcher.
Settings page showing the local runtime, port, logging, and integration controls used by the launcher.
Dataset dashboard with a loaded validation session, aggregate statistics, switchable histograms, and word-cloud analytics.
Full-page dataset dashboard for a populated local text dataset. Review dataset health, lexical metrics, histogram and cumulative-distribution views, entropy, concentration, and contained word-cloud signals before benchmarking.
Tokenizers dashboard with an opened tokenizer report, vocabulary statistics, token-length views, and a populated token preview table.
Full-page custom tokenizer report showing vocabulary metadata, token-length distribution and summary shape metrics, and a paginated token preview.
Cross-benchmark dashboard with a loaded run summary, comparative metric panels, and in-title visualization switches.
Full-page cross-benchmark report comparing two tokenizers across throughput, vocabulary, latency, round-trip fidelity, and run diagnostics.
Most users only need Launch application in the Windows launcher menu. Use the other options when the menu or a release note specifically calls for them.
The maintenance menu can help you:
The launcher checks the local database when the application starts and applies required updates automatically. Do not delete the database or saved resource folders manually while the application is running.
The Remove All Data action is permanent for the local workspace. It removes saved datasets, tokenizer files, reports, logs, and stored Hugging Face access-key material while preserving the application files themselves. Back up anything you may need before confirming this action.
Copy the local address printed by the launcher and open it manually. On managed Windows machines, browser auto-open can be blocked even when the services started correctly.
The first launch may be downloading runtimes, installing packages, preparing the database, or building the web interface. Allow the progress indicators to finish. If there is no progress, check your internet connection and available disk space, close duplicate TKBEN windows, and run the launcher again.
Close another TKBEN instance or the application using that local address, then restart TKBEN. If you intentionally need different ports, change the local settings and restart both parts of the application. Always use the URL printed by the launcher after the change.
Check the repository name and optional dataset configuration, then retry with a stable network connection. For gated or private resources, accept the source’s terms and add a Hugging Face read-access key using the key button in the application header. If a key is already configured but access is denied, verify that it belongs to an account allowed to use that resource.
Make sure the file is one of the supported formats and contains a column with document text. Remove empty rows, confirm that the file is not damaged, and try a smaller sample if the file is very large. A spreadsheet with only numeric fields or unrelated metadata cannot provide a useful text analysis.
Confirm that the relevant dataset validation or benchmark finished successfully and that you opened the saved report rather than only selecting an input. Reset catalog filters if no items are visible. Some measures require enough documents or observations and may correctly appear as unavailable.
Open the run diagnostics to see which tokenizer failed. Check that the tokenizer was downloaded or uploaded completely, that its source is accessible, and that the dataset contains usable text. Remove and prepare the tokenizer again if necessary, then start a new run.
Large datasets, many selected metrics, optional language-model measures, and detailed per-document statistics require more time and memory. Start with a smaller document sample and the default settings. For speed comparisons, repeat runs under similar computer conditions and compare the same sample.
Open a completed report before exporting and choose a folder where you can create files. If you cancel the native save dialog, no PDF is created and no error is expected. If export still fails, reduce the dashboard to the measures you need and try again.
Confirm that Python, Node.js, and uv are installed and available in the terminal you are using. Run the commands from the repository directories shown above, use a shell with permission to read the project, and keep the backend and frontend terminals separate. The Windows launcher is not available on these platforms, so the two manual processes must both be started.
TKBEN keeps its working data locally so that completed analyses can be reopened after a restart.
app/resources: saved datasets, tokenizer assets, reports, the local database, and logs. Back up the relevant contents of this folder if you need to preserve your work.settings: local settings and templates used by the launcher. Most users never need to edit this folder.assets/figures: screenshots used in this guide.assets/docs: deeper project and runtime reference material for advanced users and maintainers.The application does not provide cloud synchronization by default. Moving TKBEN to another computer therefore requires you to preserve any local data you want to keep and then prepare the local runtime on the new machine.
The Windows launcher creates settings/.env automatically and supplies sensible defaults. Most users should leave those defaults unchanged.
You may need to edit the local settings only when you want to:
Restart TKBEN after changing settings/.env. Keep this file private: it can contain machine-specific paths, database connection details, or other sensitive values. Hugging Face access keys should be added and managed through the application’s key manager rather than placed in screenshots or shared documentation.
Versioned source releases are available from the GitHub releases page. A source archive contains the application files, not your local datasets, downloaded tokenizer assets, credentials, logs, or generated reports.
Before updating to a new release:
This project is licensed under the MIT License. See LICENSE for details.
558 commits
Python
67.7%
TypeScript
13.4%
CSS
7.3%
HTML
6.7%
PowerShell
3.8%