You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Code for $\lambda$-Recursive Language Models: typed functional recursion for reliable long-context reasoning.
2
+
Code for **The $\mathbf{Y}$-Combinator for LLMs: \\ Solving Long-Context Rot with $\lambda$-Calculus**: a framework for long-context reasoning that replaces free-form recursive code generation with a typed functional runtime grounded in $\lambda$-calculus.
Standard LLM inference is limited by context windows and is opaque — models improvise decomposition unpredictably. $\lambda$-RLM solves this by:
8
+
Standard LLM inference is constrained by context windows and often relies on implicit, hard-to-predict decomposition strategies. $\lambda$-RLM addresses this by:
7
9
8
-
-**Pre-computing** the optimal decomposition plan before any LLM call (deterministic)
9
-
-**Mapping inference** to Lambda Calculus primitives: β-reduction at leaves, symbolic combinators for composition
10
-
-**Splitting** long inputs into parallel chunks where each fits in the model's context window
11
-
-**Composing**results via pre-verified operators (MERGE_COUNTS, SEARCH_UNION, SUMMARIZE_REDUCE, etc.)
10
+
-**Planning decomposition ahead of execution** with a deterministic recursive strategy
11
+
-**Expressing inference through functional structure**, with model calls at local steps and symbolic operators for composition
12
+
-**Breaking long inputs into manageable chunks** that fit within the model context window
13
+
-**Combining intermediate results**through structured operators such as `MERGE_COUNTS`, `SEARCH_UNION`, and `SUMMARIZE_REDUCE`
12
14
13
15
---
14
16
@@ -22,26 +24,21 @@ conda activate lambda-rlm
22
24
23
25
pip install -e .
24
26
```
25
-
We support access models through APIs, for example, you can request a [NVIDIA NIM API key](https://build.nvidia.com) to access available models.
27
+
We support access different avaialble models through APIs, for example, you can request a [NVIDIA NIM API key](https://build.nvidia.com)or a [TOGETHER AI API key](https://api.together.ai/)to access available models of the given API.
26
28
27
29
```bash
28
30
export NVIDIA_API_KEY="nvapi-..."
29
31
```
30
32
33
+
```bash
34
+
export TOGETHER_API_KEY="tgp_..."
35
+
```
31
36
32
-
### Supported Task Types
33
-
34
-
| Task | Composition Operator | Strategy |
35
-
|---|---|---|
36
-
|`aggregation`| MERGE_COUNTS | SPLIT → MAP → sum counts |
-`rlm/utils/parsing.py` — parsing of ```repl``` code blocks and FINAL markers; formatting of execution output back into the model history
91
+
-`rlm/clients/openai.py` — OpenAI-compatible client used with NVIDIA NIM
92
+
93
+
### Lambda-RLM
94
+
95
+
-`rlm/lambda_rlm.py` — LambdaRLM implementation, including task detection, planning, and deterministic execution through $\Phi$
96
+
83
97
## Benchmarking
84
98
85
99
The benchmark entry point is used for running experiments with same dataset and comparing the behavior, latency, and output quality under the same setup between Normal RLM (rlm) and Lambda-RLM (lambda_rlm)
86
100
87
-
### Supported datasets:
88
-
-`sniah` — Sequential-NIAH examples loaded from a local JSONL file or from the public GitHub JSONL source
89
-
-`oolong` — single-document QA examples loaded from `THUDM/LongBench-v2`
90
-
-`browsecomp` — multi-document QA examples loaded from `THUDM/LongBench-v2`
91
-
-`codeqa` — code repository understanding examples loaded from a local JSONL file or from `THUDM/LongBench-v2`
0 commit comments