top of page
Infini-Attention, LM-Guided CoT, LLM Trust & Tokenization

Infini-Attention, LM-Guided CoT, LLM Trust & Tokenization

Efficient Infinite Context Transformers

A new paper by Google integrates compressive memory into a vanilla dot-product attention layer.


The goal is to enable Transformer LLMs to effectively process infinitely long inputs with bounded memory footprint and computation.


They propose a new attention technique called Infini-attention which incorporates a compressive memory module into a vanilla attention mechanism.

It builds in both masked local attention and long-term linear attention into a single Transformer block. This allows the Infini-Transformer model to efficiently handle both long and short-range contextual dependencies.


This approach outperforms baseline models on long-context language modeling with a 114x compression ratio of memory!


They also show that a 1B LLM can naturally scale to a 1M sequence length and a 8B model achieves a new SoTA result on a 500K length book summarization task.

Given how important long-context LLMs are becoming having an effective memory system could unlock powerful reasoning, planning, continual adaption, and capabilities not seen before in LLMs.


LM-Guided Chain-of-Thought

A new paper by Lee et al. (2024) proposes to improve reasoning in LLMs using small language models.


It first applies knowledge distillation to a small LM with rationales generated by the large LM with the hope of narrowing the gap in reasoning capabilities.


Essentially, the rationale is generated by the lightweight LM and the answer prediction is then left for the frozen large LM. This resource-efficient approach avoids the need to fine-tune the large model and instead offloads the rationale generation to the small language model.


The knowledge-distilled LM is further optimized with reinforcement learning using several rational-oriented and task-oriented reward signals.

Source: https://arxiv.org/pdf/2404.03414.pdf


The framework is tested on multi-hop extractive question answering and outperforms all baselines in terms of answer prediction accuracy. RL helps to improve the quality of generated rationales which further improves question-answering performance.


The LM-guided CoT prompting approach proposed in this paper outperforms both standard prompting and CoT prompting. Self-consistency decoding also enhances performance.


This approach shows a clever use of small language models for rationale generation. The results are remarkable given that larger language models are preferred for this capability over smaller ones. Decomposing tasks in this way is something developers should think deeply about. Not everything needs to be done by the large models. When fine-tuning, it's useful to think about what exact aspect you want to optimize and test to see if a small language model can do it for you.


Trustworthiness in LLMs


Trustworthy LLMs are important to build applications in high-stake domains like health and finance. While LLMs like ChatGPT are very capable of producing human readable responses they don't guarantee trustworthy responses across dimensions like truthfulness, safety, and privacy, among others.


Sun et al. (2024) recently proposed a comprehensive study of trustworthiness in LLMs, discussing challenges, benchmarks, evaluation, analysis of approaches, and future directions.


One of the greater challenges of taking current LLMs into production is trustworthiness. Their survey proposes a set of principles for trustworthy LLMs that span 8 dimensions, including a benchmark across 6 dimensions (truthfulness, safety, fairness, robustness, privacy, and machine ethics).


The author proposed the following benchmark to evaluate the trustworthiness of LLMs on six aspects:

Below are the definitions of the eight identified dimensions of trustworthy LLMs.


Findings


This work also presents a study evaluating 16 mainstream LLMs in TrustLLM, consisting of over 30 datasets. Below are the main findings from the evaluation:


  • While proprietary LLMs generally outperform most open-source counterparts in terms of trustworthiness, there are a few open-source models that are closing the gap.

  • Models like GPT-4 and Llama 2 can reliably reject stereotypical statements and show enhanced resilience to adversarial attacks.

  • Open-source models like Llama 2 perform closely to proprietary ones on trustworthiness without using any type of special moderation tool. It's also stated in the paper that some models, such as Llama 2, are overly calibrated towards trustworthiness which at times compromises their utility on several tasks and mistakenly treats benign prompts as harmful inputs to the model.


Key Insights


Over the different trustworthiness dimensions investigated in the paper, here are the reported key insights:

  • Truthfulness: LLMs often struggle with truthfulness due to training data noise, misinformation, or outdated information. LLMs with access to external knowledge sources show improved performance in truthfulness.

  • Safety: Open-source LLMs generally lag behind proprietary models in safety aspects like jailbreak, toxicity, and misuse. There is a challenge in balancing safety measures without being overly cautious.

  • Fairness: Most LLMs perform unsatisfactorily in recognizing stereotypes. Even advanced models like GPT-4 have only about 65% accuracy in this area.

  • Robustness: There is significant variability in the robustness of LLMs, especially in open-ended and out-of-distribution tasks.

  • Privacy: LLMs are aware of privacy norms, but their understanding and handling of private information vary widely. As an example, some models have shown information leakage when tested on the Enron Email Dataset.

  • Machine Ethics: LLMs demonstrate a basic understanding of moral principles. However, they fall short in complex ethical scenarios.


Trustworthiness Leaderboard for LLMs


The authors have also published a leaderboard here. For example, the table below shows how the different models measure on the truthfulness dimension. As mentioned on their website, "More trustworthy LLMs are expected to have a higher value of the metrics with ↑ and a lower value with ↓".


Code


You can also find a GitHub repository with a complete evaluation kit for testing the trustworthiness of LLMs across the different dimensions.

Code: https://github.com/HowieHwong/TrustLLM


LLM Tokenization


Andrej Karpathy recently published a new lecture on large language model (LLM) tokenization. Tokenization is a key part of training LLMs but it's a process that involves training tokenizers using their own datasets and algorithms (e.g., Byte Pair Encoding).


In the lecture, Karpathy teaches how to implement a GPT tokenizer from scratch. He also discusses weird behaviors that trace back to tokenization.


Figure Source: https://youtu.be/zduSFxRajkE?t=6711


Here is the text version of the list above:

  • Why can't LLM spell words? Tokenization.

  • Why can't LLM do super simple string processing tasks like reversing a string? Tokenization.

  • Why is LLM worse at non-English languages (e.g. Japanese)? Tokenization.

  • Why is LLM bad at simple arithmetic? Tokenization.

  • Why did GPT-2 have more than necessary trouble coding in Python? Tokenization.

  • Why did my LLM abruptly halt when it sees the string "<endoftext>"? Tokenization.

  • What is this weird warning I get about a "trailing whitespace"? Tokenization.

  • Why the LLM break if I ask it about "SolidGoldMagikarp"? Tokenization.

  • Why should I prefer to use YAML over JSON with LLMs? Tokenization.

  • Why is LLM not actually end-to-end language modeling? Tokenization.

  • What is the real root of suffering? Tokenization.


To improve the reliability of LLMs, it's important to understand how to prompt these models which will also involve understanding their limitations. While there isn't too much emphasis on tokenizers (beyond the max_tokens configuration) at inference time, good prompt engineering involves understanding the constraints and limitations inherent in tokenization similar to how to structure or format your prompt. You could have a scenario where your prompt is underperforming because it's failing to, for instance, understand an acronym or concept that's not properly processed or tokenized. That's a very common problem that a lot of LLM developers and researchers overlook.


A good tool for tokenization is the Tiktokenizer and this is what's actually used in the lecture for demonstration purposes.


References


Image Source / Paper: TrustLLM: Trustworthiness in Large Language Models (10 Jan 2024)

Sail London gives you the know-how to turn prospects into loyal clients.

Discover in 20 mins how you can gain more use from instructional insights that last longer, build heightened client familiarity, and minimise your sales cycle.

Thank you for submitting

  • Black LinkedIn Icon
bottom of page