transformer-based rl agents for nlp tasks
Project description
alectors
alectors is a library providing transformer-based rl agents for nlp tasks, that is extremely customizable, but also comes with sane defaults.
source code: https://erga.apotheke.earth/apotheke/alectors
license: GPLv3 or later
Why "alectors"?
The word lector has deep etymological roots in language. Derived from the Latin legere ("to read"), it originally referred to someone who read aloud, to an audience, students, or even in religious ceremonies.
The term nowdays survives mostly in an academic setting, where a lecturer is typically tied to teaching, or discussing ideas with an audience. Typical modern uses of the word are "lecturer" in English, "λέκτορας" in Greek, and "lektor" in Polish.
However, adding the prefix α- changes the word's meaning entirely. An alector (ἀλέκτωρ) means "cock" (rooster) in Greek. This juxtaposition s very funny, hence the name.
Description
Modern NLP solutions like GPTs and BERTs have made great strides in language processing and generation, however they fall short of actual decision making.
As an example, consider an LLM trying to play a game of chess.
While it may be able to make valid moves, and even provide a justification, it still lacks any true capacity to calculate the optimal position; it is a word generator, and so the best thing it can do is convince itself that it makes sense. It lacks a reward incentive during training, and even worse, rather LLMs rely on static token distributions without real-time feedback.
alectors tries to address this gap by shifting the focus to reinforcement learning in place of supervised pretraining. An alector learns to generate actions based on natural language.
The way we approach this is by using pretrained encoders in specialized language environments.
Mechanism
In essence, we can describe any environment using natural language; some environments lend themselves to this type of description better, and this description of the state is then given to a pretrained encoder, that parses it and spits out a layer of vector embeddings1.
This vector representation of the natural language description of the state is then passed to the agent, and used in traditional rl ways (ppo, sac, etc)
The agent therefore trains on natural language reinforcement learning, without the need of any pretraining/finetuning as is the case for LLMs.
Supported Architectures
The currently supported architecture is PPO. Plans exist to include SAC, GRPO, and maybe DDQN. As we add them to telestes they will be almost automatically imported here2.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file alectors-2.0.3.tar.gz.
File metadata
- Download URL: alectors-2.0.3.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.2 CPython/3.13.2 Linux/6.12.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbdfef66625babc6780eb666a3276c39dcc68fe623a82eec8d184bd55c93ad38
|
|
| MD5 |
e2c57c894cc502c11b19effcb70ce4c6
|
|
| BLAKE2b-256 |
f1b3244bede2fc98e7244c154d851efbe1507a33cd9883da90fc2c23659f94ab
|
File details
Details for the file alectors-2.0.3-py3-none-any.whl.
File metadata
- Download URL: alectors-2.0.3-py3-none-any.whl
- Upload date:
- Size: 16.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.2 CPython/3.13.2 Linux/6.12.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd6beef8b0a96e6740e872380e9276a1aa722d2f45420820ee32464a3b2458b4
|
|
| MD5 |
e737af00f3f4514d71c81ed6bb8200fb
|
|
| BLAKE2b-256 |
88053081e35162f7c73dbc4c6e420e2157f6a05a839d5978e7e90440afcbeccf
|