-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5c0a4ab
commit 01686c9
Showing
8 changed files
with
300 additions
and
370 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
Structured Thoughts | ||
=================== | ||
|
||
In the Structured Thoughts programming model, prompts are akin to the building blocks of traditional computer programs. | ||
Prompts are compiled to automaton that ensure that the resulting completion can be parsed to extract structured data. | ||
Branching between prompts is controlled by the language model. | ||
The dataflow is statically defined and executed when instantiating the automaton of each prompt. | ||
Calls (to other prompts or python tools) are executed during the dataflow phase. | ||
|
||
Below, we show a single prompt program which implement Chain-of-Thoughts (CoT) to answer a multiple choice question. | ||
In this examples, the language model is presented with the `topic`, the `question`, and four `choices`. | ||
It can then think using one to ten `thought` (up 20 tokens for each). | ||
Eventually, the model must indicate the index of the correct choice. | ||
|
||
``` | ||
format thought { | ||
is text<20>; | ||
annotate f"a short text representing a single thought, it does not have to be a proper sentence."; | ||
} | ||
prompt main { | ||
is { | ||
topic is text<20>; | ||
question is text<50>; | ||
choices[4] is text<40>; | ||
work[1:10] is thought; | ||
answer is select(.choices); | ||
} | ||
channel { | ||
to .topic from ?topic; | ||
to .question from ?question; | ||
to .choices from ?choices; | ||
} | ||
return { | ||
from .answer; | ||
} | ||
annotate { | ||
_ as "You are answering a multiple choice questionnaire."; | ||
.topic as "the general category from which the question was taken"; | ||
.question as "the question that you have to answer"; | ||
.choices as "the four possible choices to answer the question, only one is correct"; | ||
.work as "show your work step-by-step"; | ||
.answer as "you pick the index of the choice that best answer the question"; | ||
} | ||
} | ||
``` | ||
|
||
We are developing the [MCQ](./library/mcq) library of program to illustrate thought patterns that are achievable using Structured Thoughts. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
Roadmap | ||
======= | ||
|
||
This is a roadmap of basic features that are needed to make AutoCog (and STA) usable. | ||
It only considers a few weeks worth of work but I rarely have brain-cycles to work on this project. | ||
|
||
Given that I am currently working alone on this project, I am not tracking work using issues and milestones. | ||
|
||
In the roadmap below, each minor versions consolidate the increment of the previous ones. | ||
Simply, all the `v0.4.X` are steps toward `v0.5`. | ||
These bugfix level milestones are subject to reordering (change of priority) and shifting (introducing new milestone or actual bugfixes). | ||
|
||
| Version | Features | Notes | Tracking | | ||
| ------- | -------- | ----- | -------- | | ||
| v0.4 | Structured Thoughts | release 1st version of ST | | | ||
| v0.4.1 | Tests & Fixes | Testing more LLMs and fix tokenizations issue | | | ||
| v0.4.2 | Roadmap & Doc | Needed some organization... | | | ||
| v0.4.3 | Low-Level llama-cpp-python | | | | ||
| v0.4.4 | FTA: Simplify, Choice Limit, and Norms | | | | ||
| v0.4.5 | Beam Search | Implementation within FTA | | | ||
| v0.5 | Language Docs | Description of the language and tutorial | | | ||
| v0.5.1 | Tests & Fixes | Expecting that it will be needed... | | | ||
| v0.5.2 | Unified FTA | FTA in one "loop" using llama-cpp-python low-level API | | | ||
| v0.5.3 | Elementary | Library of elementary "worksheet" (arithmetic: add/mul/div, literacy: spelling, grammar, comprehension) | | | ||
| v0.5.4 | MMLU-Exams | Library of MCQ Solver using different Thought Patterns | | | ||
| v0.5.5 | FTA to BNF | Translate FTA to llama.cpp BNF | | | ||
| v0.6 | Benchmarking | Evaluate speed and accuracy on Elementary and MMLU-Exams | | | ||
| v0.6.1 | Tooling Benchmark | | | | ||
| v0.7 | Finetuning | Selected foundation LLMs targetting improved performance at MMLU-Exams | | | ||
| v0.7.1 | Finetune Tooling | | | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
Setup | ||
===== | ||
|
||
## Install AutoCog | ||
|
||
As simple as `pip install -U git+https://github.com/LLNL/AutoCog`. | ||
|
||
But, you'll probably want to clone the repository to get the library of programs: | ||
``` | ||
git clone https://github.com/LLNL/AutoCog | ||
pip install -U ./AutoCog | ||
``` | ||
|
||
## LLM Setup | ||
|
||
### LLama.cpp and GGUF models | ||
|
||
We download model from [TheBloke](https://huggingface.co/TheBloke) on Hugging Face. | ||
For example, you can donwload LlaMa 2 with 7B parameters and tuned for Chat with: | ||
``` | ||
wget https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGUF/resolve/main/llama-2-7b-chat.Q4_K_M.gguf | ||
``` | ||
This is a 4 bits version, aka `Q4_K_M` in the name. It is the main model we use for testing. | ||
|
||
To run GGUF model, we use a [modified version](https://github.com/tristanvdb/llama-cpp-python/tree/choice-dev) of the `llama-cpp-python` package. | ||
It provides python bindings and will build `LLama.cpp`. | ||
Our changes permit us to implement `greedy` completion (returning logprob for all tokens). | ||
``` | ||
pip install -y git+https://github.com/tristanvdb/llama-cpp-python@choice-dev | ||
``` | ||
|
||
> TODO v0.5: connect to low-level API in `llama-cpp-python` so that we can use the default release | ||
### HuggingFace Transformers | ||
|
||
> TODO v0.6: connection for HuggingFace Transformers package (use to have it but not tested) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Tutorial | ||
======== | ||
|
||
|
Oops, something went wrong.