Skip to main content

LLaMA-Annotate—Visualizing Token-Level Confidences for LLMs

  • Conference paper
  • First Online:
Machine Learning and Knowledge Discovery in Databases. Research Track and Demo Track (ECML PKDD 2024)

Abstract

LLaMA-Annotate is a tool that allows visually inspecting the confidences that a large language model assigns to individual tokens, and the alternative tokens considered for that position. We provide both a simple, non-interactive command-line interface, as well as a more elaborate web application. Besides generally helping to form an intuition about the “thinking” of the LLM, our tool can be used for context-aware spellchecking, or to see how a different prompt or a differently trained LLM can impact the interpretation of a piece of text. The tool can be tried online at https://huggingface.co/spaces/s-t-j/llama-annotate.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

Notes

  1. 1.

    E.g., http://antirez.com/news/142, https://huggingface.co/blog/how-to-generate, https://towardsdatascience.com/exploring-token-probabilities-as-a-means-to-filter-gpt-3s-answers-3e7dfc9ca0c.

  2. 2.

    For a demonstration, see https://drive.google.com/file/d/1HEBbuhJL_vrrP8-WpxmdhoUA8GVmcdWo/view?usp=sharing.

  3. 3.

    Code is available at https://version.aalto.fi/gitlab/schulte1/llama-annotate.

  4. 4.

    https://en.wikipedia.org/wiki/LLaMA.

  5. 5.

    https://github.com/ggerganov/llama.cpp.

  6. 6.

    https://www.gradio.app/.

References

  1. Brown, T., et al.: Language models are few-shot learners. In: Advances in Neural Information Processing Systems, vol. 33, pp. 1877–1901 (2020)

    Google Scholar 

  2. Lin, B.Y., et al.: The unlocking spell on base LLMs: rethinking alignment via in-context learning. ArXiv preprint (2023)

    Google Scholar 

  3. Meister, C., Pimentel, T., Wiher, G., Cotterell, R.: Locally typical sampling. Trans. Assoc. Comput. Linguist. 11, 102–121 (2023)

    Article  Google Scholar 

  4. Sarti, G., Feldhus, N., Sickert, L., van der Wal, O., Nissim, M., Bisazza, A.: Inseq: an interpretability toolkit for sequence generation models. In: 61st Annual Meeting of the Association for Computational Linguistics, pp. 421–435 (2023)

    Google Scholar 

  5. Touvron, H., et al.: LLaMA 2: open foundation and fine-tuned chat models (2023). arXiv:2307.09288

  6. Vaswani, A., et al.: Attention is all you need. In: Advances in Neural Information Processing Systems, vol. 30 (2017)

    Google Scholar 

  7. Vig, J.: A multiscale visualization of attention in the transformer model. In: 57th Annual Meeting of the Association for Computational Linguistics, pp. 37–42 (2019)

    Google Scholar 

  8. Yun, Z., Chen, Y., Olshausen, B.A., LeCun, Y.: Transformer visualization via dictionary learning: contextualized embedding as a linear superposition of transformer factors. In: Deep Learning Inside Out (DeeLIO) NAACL: The Second Workshop on Knowledge Extraction and Integration for Deep Learning Architectures (2021)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Erik Schultheis .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2024 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Schultheis, E., John, S.T. (2024). LLaMA-Annotate—Visualizing Token-Level Confidences for LLMs. In: Bifet, A., et al. Machine Learning and Knowledge Discovery in Databases. Research Track and Demo Track. ECML PKDD 2024. Lecture Notes in Computer Science(), vol 14948. Springer, Cham. https://doi.org/10.1007/978-3-031-70371-3_33

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-70371-3_33

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-70370-6

  • Online ISBN: 978-3-031-70371-3

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics