gonzo-обзоры ML статей
17.6K subscribers
1.9K photos
3 files
823 links
Авторы:
Гриша Сапунов, ранее руководитель разработки Яндекс-Новостей, ныне CTO Intento. Области интересов: AI/ML/DL, биоинформатика.
Лёша Тихонов, ранее аналитик в Яндексе, автор Автопоэта, Нейронной Обороны... Области интересов: discrete domain, NLP, RL.
Download Telegram
This media is not supported in your browser
VIEW IN TELEGRAM
Some interesting educational materials

1) Intento prepared a set of learning materials on machine translation (MT) called Machine Translation University.
It's completely FREE!

https://inten.to/machine-translation-university/

The topics include:
- Why Machine Translation (MT): An Introduction
- Selecting and Customizing Machine Translation Engines. An Overview
- An overview of the MT landscape
- Considerations for Selecting Machine Translation Engines
- Best Practices for Training MT Models using Translation Memories and Glossaries
- Mastering Custom Machine Translation: A Practical Guide
- Selecting MT systems based on available assets

More topics coming soon!
- Automated scoring and evaluation of MT engines
- Linguistic quality analysis and ROI estimation

2) Andrew Ng prepared a beginner-friendly course on Prompt Engineering called "ChatGPT Prompt Engineering for Developers"

https://www.deeplearning.ai/short-courses/chatgpt-prompt-engineering-for-developers/

It's a short course taught by Isa Fulford (OpenAI) and Andrew Ng (DeepLearning.AI) who will describe how LLMs work, provide best practices for prompt engineering, and show how LLM APIs can be used in applications for a variety of tasks, including:
- Summarizing (e.g., summarizing user reviews for brevity)
- Inferring (e.g., sentiment classification, topic extraction)
- Transforming text (e.g., translation, spelling & grammar correction)
- Expanding (e.g., automatically writing emails)

In addition, you’ll learn two key principles for writing effective prompts, how to systematically engineer good prompts, and also learn to build a custom chatbot.

Happy Learning!
https://www.nytimes.com/2023/05/01/technology/ai-google-chatbot-engineer-quits-hinton.html

"Until last year, he said, Google acted as a “proper steward” for the technology, careful not to release something that might cause harm. But now that Microsoft has augmented its Bing search engine with a chatbot — challenging Google’s core business — Google is racing to deploy the same kind of technology. The tech giants are locked in a competition that might be impossible to stop, Dr. Hinton said."

“The idea that this stuff could actually get smarter than people — a few people believed that,” he said. “But most people thought it was way off. And I thought it was way off. I thought it was 30 to 50 years or even longer away. Obviously, I no longer think that.”
Just in case, если кто в Словении или рядом и хочет двигать интересное будущее:

https://www.nanocenter.si/qt-future/

Quantum Technology initiative QT Future will be started in the Fall of 2023 within PhD Program in Physics at University of Ljubljana (Faculty of Mathematics and Physics). Students enrolled to QT Future will be able to implement their PhD research in the most advanced QT labs across Europe (Paris, Grenoble, Karlsruhe-KIT, Lausanne-EPFL, Weizmann Inst., etc.). The initiative is developing with major support from Google Quantum AI. It covers both theoretical and experimental research and education in quantum many-body physics, physics of quantum computers and simulators, new quantum materials, nano-electronics and quantum optics.
TWIMC

string2string: A Modern Python Library for String-to-String Algorithms
https://arxiv.org/abs/2304.14395

We introduce string2string, an open-source library that offers a comprehensive suite of efficient algorithms for a broad range of string-to-string problems. It includes traditional algorithmic solutions as well as recent advanced neural approaches to tackle various problems in string alignment, distance measurement, lexical and semantic search, and similarity analysis -- along with several helpful visualization tools and metrics to facilitate the interpretation and analysis of these methods. Notable algorithms featured in the library include the Smith-Waterman algorithm for pairwise local alignment, the Hirschberg algorithm for global alignment, the Wagner-Fisher algorithm for edit distance, BARTScore and BERTScore for similarity analysis, the Knuth-Morris-Pratt algorithm for lexical search, and Faiss for semantic search. Besides, it wraps existing efficient and widely-used implementations of certain frameworks and metrics, such as sacreBLEU and ROUGE, whenever it is appropriate and suitable. Overall, the library aims to provide extensive coverage and increased flexibility in comparison to existing libraries for strings. It can be used for many downstream applications, tasks, and problems in natural-language processing, bioinformatics, and computational social sciences. It is implemented in Python, easily installable via pip, and accessible through a simple API. Source code, documentation, and tutorials are all available on our GitHub page:

https://github.com/stanfordnlp/string2string
Geoffrey Hinton gave an interview to MIT Technology Review

https://www.technologyreview.com/2023/05/02/1072528/geoffrey-hinton-google-why-scared-ai/

Some quotes:

[On learning algorithm] “Our brains have 100 trillion connections,” says Hinton. “Large language models have up to half a trillion, a trillion at most. Yet GPT-4 knows hundreds of times more than any one person does. So maybe it’s actually got a much better learning algorithm than us.”

[On few-shot learning] “People seemed to have some kind of magic,” says Hinton. “Well, the bottom falls out of that argument as soon as you take one of these large language models and train it to do something new. It can learn new tasks extremely quickly.” Compare a pretrained large language model with a human in the speed of learning a task like that and the human’s edge vanishes, he says.

[Regarding hallucinations/confabulations] Hinton has an answer for that too: bullshitting is a feature, not a bug. “People always confabulate,” he says. Half-truths and misremembered details are hallmarks of human conversation: “Confabulation is a signature of human memory. These models are doing something just like people.” “We don’t expect them to blather the way people do,” says Hinton. “When a computer does that, we think it made a mistake. But when a person does that, that’s just the way people work. The problem is most people have a hopelessly wrong view of how people work.”

[On future] “I have suddenly switched my views on whether these things are going to be more intelligent than us. I think they’re very close to it now and they will be much more intelligent than us in the future,” he says. “How do we survive that?”

[On next steps for AI] Hinton believes that the next step for smart machines is the ability to create their own subgoals, interim steps required to carry out a task. What happens, he asks, when that ability is applied to something inherently immoral?

[On AI goals] “Well, here’s a subgoal that almost always helps in biology: get more energy. So the first thing that could happen is these robots are going to say, ‘Let’s get more power. Let’s reroute all the electricity to my chips.’ Another great subgoal would be to make more copies of yourself. Does that sound good?”

[On regulation] He thinks the international ban on chemical weapons might be one model of how to go about curbing the development and use of dangerous AI. “It wasn’t foolproof, but on the whole people don’t use chemical weapons,” he says.

[On "Don't look up" movie] “I think it’s like that with AI,” he says, and with other big intractable problems as well. “The US can’t even agree to keep assault rifles out of the hands of teenage boys,” he says.
И ещё из новостей:

In this repo, we release a permissively licensed open source reproduction of Meta AI's LLaMA large language model. In this release, we're releasing a public preview of the 7B OpenLLaMA model that has been trained with 200 billion tokens. We provide PyTorch and Jax weights of pre-trained OpenLLaMA models, as well as evaluation results and comparison against the original LLaMA models. Stay tuned for our updates.

https://github.com/openlm-research/open_llama
[CMU] Unlimiformer: Long-Range Transformers with Unlimited Length Input
Amanda Bertsch, Uri Alon, Graham Neubig, Matthew R. Gormley
Статья: https://arxiv.org/abs/2305.01625
Код: https://github.com/abertsch72/unlimiformer

Делу борьбы с limited attention span трансформеров посвящается!

Как известно, ограничение стандартного трансформера на размер контекста связано с квадратичной сложностью механизма внимания. И типичные трансформеры имеют размер контекста порядка 512-2048 токенов, в редких случаях побольше. У GPT-4 он 8192 токена, и есть пока не доступная массово версия на 32k (но вряд ли это классический механизм внимания). Для многих реальных датасетов этого недостаточно.

Было много подходов увеличить размер этого контекста и понизить вычислительную сложность трансформеров, про многие такие решения мы в своё время писали: Performer (https://t.me/gonzo_ML/404), Longformer (https://t.me/gonzo_ML/292), Big Bird (https://t.me/gonzo_ML/381) и многое другое. В массы, правда, почему-то эти решения не пошли.

Очередное решение радикально решает вопрос увеличения attention span, теперь он “бесконечный”. Это достигается за счёт использования retrieval-based механизма, который можно добавить к уже обученному трансформеру.

Работает это так для архитектуры encoder-decoder.

Входная последовательность разбивается на чанки с перекрытием, они кодируются энкодером трансформера, оставляется при этом только средняя половина выходной последовательности каждого чанка. Это нужно для сохранения контекста с обеих сторон.

Полученные эмбеддинги отправляются во внешнее векторное хранилище, например, типа FAISS (https://engineering.fb.com/2017/03/29/data-infrastructure/faiss-a-library-for-efficient-similarity-search/, https://github.com/facebookresearch/faiss).

В декодере перед cross-attention делается k-nearest neighbor (kNN) search во внешнем хранилище и для каждой головы каждого слоя внимания выбирается набор токенов, которые надо учесть. Таким образом вместо того, чтобы в декодере смотреть на все N (=размер контекста) токенов из энкодера, мы смотрим на N “лучших” токенов входной последовательности, поднятой из базы. А декодер всё так же имеет техническое ограничение на размер контекста в N токенов.

Никаких обучаемых параметров в kNN-search нету, и этот механизм можно встроить в любой уже обученный трансформер.

Это всё в каком-то смысле развитие идеи Memorizing Transformers (https://arxiv.org/abs/2203.08913), но там хранилища эмбеддингов подразумевались для каждой головы каждого слоя, и это было слишком много, поэтому в той работе ограничились одним слоем энкодера. Работа про Memorizing Transformers отличалась также и наличием обучаемых весов для гейта, который комбинировал локальное и kNN внимание, поэтому его нельзя было легко применить к уже обученной LM.

В текущей работе переформулировали механизм внимания так, что по новой формуле с другим порядком вычисления достаточно одного хранилища для всех голов и слоёв. В новой формулировке QK^T = (h_d * W_q * W^T_k) * h^T_e, имея скрытое состояние декодера h_d и сделав его проекцию в новое пространство под каждый слой и голову внимания (умножив на W_q и W^T_k), можно довольно просто поднять из векторного хранилища соответствующие скрытые состояние энкодера h_e. Вроде как такая формулировка встречается впервые в retrieval-based моделях.

Перечисленные изменения можно добавить в уже обученный трансформер и ничего в нём больше не менять. Но можно ещё и пофайнтюнить. Пробовали разные режимы, с малой и большой вычислительной стоимостью. При малой стоимости Unlimiformer добавляется только на тесте, а при большой он используется и в обучении.

Потестили на датасетах для суммаризации длинных документов. Добавляли Unlimiformer к BART_base (https://t.me/gonzo_ML/153) с контекстом 1024 токена и PRIMERA (https://aclanthology.org/2022.acl-long.360/) с контекстом 4096 токенов.

Подход работает и улучшает результат. Файнтюнинг добавляет качества и бьёт альтернативные улучшалки базовых моделей на Memorizing Transformers и SLED (https://arxiv.org/abs/2208.00748).
Интересный в общем подход, их серии “дёшёво и сердито”. Он добавляет вычислений на инференсе, к тому же надо сначала обработать всю длинную последовательность, но качество тоже заметно повышается.

Код на гитхабе позволяет просто использовать Unlimiformer с моделями Hugging Face.