Skip to main content

Creates basicness-scores of software

Project description

Basic Score

How basic is that file?

Measure how unsurprising text is by asking an LLM, unsurprising is roughly the double negation of probable, and large language models just predict the next token.

screenshot

By feeding the text through an LLM and inspecting the token probabilities for the known next character basic score generates the probabilities for all tokens in your text.

Why would you want to do that?

While I don't think this is sufficient, the main idea is to give a third party opinion for code. I'm currently working on evaluating the idea by comparing relative scores with third party code bases and adding noise to them.

Once the evaluation setup is good I'll implement a RAG loop to create better contexts, to see if I can get code convention violations to penalize the score.

Besides that this can potentially detect LLM generated output.

Installation

For CPU inference it's easy:

pip install basicscore

For GPU inference you must force reinstall llama-cpp-python

for example:

CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python --force-reinstall --upgrade --no-cache-dir

Usage

Typical usage:

basicscore --model model.gguf --gpu-layers 50 --html-out=basicscore_file.html file.py

However you use a config-file, passed as argument, in $CWD/.basicscore.json or in $HOME/.config/basicscore/config.json in falling precedence. There you can specify all the options for ease of use.

To run it like this:

basicscore file.py

Why didn't you use tinygrad?

I tried at first but I could not get acceptable performance on my hardware and for this to be possible to evaluate I needed to squeeze out more toks/s than what I could. A lot has happened since I started this project and I'll likely revisit it later.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

basicscore-0.0.3.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

basicscore-0.0.3-py2.py3-none-any.whl (9.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file basicscore-0.0.3.tar.gz.

File metadata

  • Download URL: basicscore-0.0.3.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for basicscore-0.0.3.tar.gz
Algorithm Hash digest
SHA256 ab0dab297021ff6c336f4f94820acf984d2c172e94bbd0db43d5d4cdddad4e86
MD5 5112d3554f05e2eb286bb0184d53d3b1
BLAKE2b-256 5016fc4bb4dad83daf3dff06e56b1ee43053797718daf1791b26f3ad8f0e5b65

See more details on using hashes here.

File details

Details for the file basicscore-0.0.3-py2.py3-none-any.whl.

File metadata

  • Download URL: basicscore-0.0.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for basicscore-0.0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3d9d5ef84d6c3a23bd6dd1953a887cc4ec5353c3fe27e4ce9e32e3f0dd37f172
MD5 8b56935744c35c153525ea6f71e3ac59
BLAKE2b-256 6d1e08560edadadff1f19bd504841d814b7b19aaf65057e44744bbe359bc93f4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page