[bug]:
Author: smoyer64Created Sep 30, 2026Updated Sep 30, 2026
Labelsbug
What happened
Changing the order of the elements in the criteria map changes the outcome choice.
The criteria are independent parallel predicates against state, not a sequential stream, so sequence cross-attention is architecturally invalid and as far as I can tell, an incompatibility compared to jev.
This is an awesome OSS project and I certainly appreciate the effort going into it - my Python is very rusty, so I'm not sure how much I can help beyond filing concrete bug reports.
Steps to reproduce
Run laya-serve as follows:
$ ~/git/laya/.venv/bin/laya-serve
Fetching 5 files: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:00<00:00, 609.71it/s]
Download complete: | 0.00B
Reconstruction complete: | | 0.00B / 0.00B
/home/smoyer1/git/laya/.venv/lib/python3.12/site-packages/laya/router.py:456: RuntimeWarning: laya: this checkpoint ships invalid temperatures or values outside [0.5, 5]; using choice:11+=0.10058280825614929 -> 0.5. Treat confidence from the affected entries as uncalibrated.
agent = Agent(repo, **kwargs)
Fetching 5 files: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:00<00:00, 549.24it/s]
Download complete: | 0.00B
Reconstruction complete: | | 0.00B / 0.00B
Fetching 5 files: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:00<00:00, 1164.63it/s]
Download complete: | 0.00B
Reconstruction complete: | | 0.00B / 0.00B
[W930 16:14:28.268755526 CUDACachingAllocator.cpp:3934] memory allocation failed with OOM on device 0 while trying to allocate 12582912 bytes (free: 11337728, total: 3906732032).
[W930 16:14:28.268859131 CUDACachingAllocator.cpp:3934] memory allocation failed with OOM on device 0 while trying to allocate 12582912 bytes (free: 11337728, total: 3906732032).
[laya] Warning: could not place the model on cuda, so it is running on CPU.
Reason: CUDA out of memory. Tried to allocate 12.00 MiB. GPU 0 has a total capacity of 3.64 GiB of which 10.81 MiB is free. Including non-PyTorch memory, this process has 3.62 GiB memory in use. Of the allocated memory 3.44 GiB is allocated by PyTorch, and 132.95 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation. See documentation for Memory Management (https://docs.pytorch.org/docs/stable/notes/cuda.html#optimizing-memory-usage-with-pytorch-cuda-alloc-conf)
Inference will be roughly 10-15x slower (~200-500 ms rather than ~35 ms).
If this is a newer NVIDIA GPU (Blackwell / RTX 50-series), your PyTorch build
may not support its CUDA architecture:
pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu128
See https://pytorch.org/get-started/locally/
INFO: Started server process [67009]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)Given two test files that I've programmatically verified are equivalent JSON:
wire2.json:
{
"state": "Tool: fetch_web_page\nDescription: Downloads HTML content from a target URL and extracts clean Markdown text for LLM context window ingestion.\nParameters: url (string), raw (boolean)",
"questions": {
"glama_category": {
"type": "choice",
"instructions": "Which Glama category best fits this Model Context Protocol (MCP) tool?",
"criteria": {
"cloud_and_infrastructure": "AWS, Cloudflare, Fly.io, container runtime, and server provisioning.",
"communication": "Slack, Discord, email, messaging, and chat platform integrations.",
"data_and_databases": "SQL queries, database administration, vector search, ETL, and structured storage.",
"developer_tools": "Git operations, pull requests, CI/CD pipelines, issue tracking, and code management.",
"other": "Tools that do not fit into any of the standard categories.",
"search_and_retrieval": "Web scraping, web searching, URL fetching, document retrieval, and indexing.",
"utility_and_system": "Local file system operations, CLI execution, shell scripts, and environment configuration."
}
}
}
}wire3.json:
{
"state": "Tool: fetch_web_page\nDescription: Downloads HTML content from a target URL and extracts clean Markdown text for LLM context window ingestion.\nParameters: url (string), raw (boolean)",
"questions": {
"glama_category": {
"type": "choice",
"instructions": "Which Glama category best fits this Model Context Protocol (MCP) tool?",
"criteria": {
"developer_tools": "Git operations, pull requests, CI/CD pipelines, issue tracking, and code management.",
"data_and_databases": "SQL queries, database administration, vector search, ETL, and structured storage.",
"communication": "Slack, Discord, email, messaging, and chat platform integrations.",
"search_and_retrieval": "Web scraping, web searching, URL fetching, document retrieval, and indexing.",
"cloud_and_infrastructure": "AWS, Cloudflare, Fly.io, container runtime, and server provisioning.",
"utility_and_system": "Local file system operations, CLI execution, shell scripts, and environment configuration.",
"other": "Tools that do not fit into any of the standard categories."
}
}
}
}I get different results when submitting these files to laya-serve via curl as follows:
wire2.json:
$ curl http://localhost:8000/v1/systemone -H 'Content-Type: application/json' --data-binary "@./internal/classify/wire2.json" | jq .
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1963 100 817 100 1146 515 723 0:00:01 0:00:01 --:--:-- 1239
{
"model": "laya-rl-agent",
"answers": {
"glama_category": {
"type": "choice",
"choice": "cloud_and_infrastructure",
"probabilities": {
"cloud_and_infrastructure": 0.308,
"communication": 0.0226,
"data_and_databases": 0.0565,
"developer_tools": 0.292,
"other": 0.2064,
"search_and_retrieval": 0.0747,
"utility_and_system": 0.0398
},
"confidence": 0.1686,
"answer_confidence": 0.308,
"action": {
"act_probability": 1.0
}
}
},
"usage": {
"input_tokens": 218,
"output_tokens": 0,
"state_tokens": 42,
"state_tokens_dropped": 0,
"truncated": false,
"truncated_questions": []
},
"routing": {
"model": "english",
"repo": "convaiinnovations/laya",
"reason": "English Latin text",
"detection": {
"script": "latin",
"script_profile": {
"latin": 1.0
},
"language": "en",
"is_english": true,
"language_undecided": false,
"diacritic_rate": 0.0,
"non_latin_fraction": 0.0,
"mixed_segment": null
},
"workflow": null
}
}wire3.json:
$ curl http://localhost:8000/v1/systemone -H 'Content-Type: application/json' --data-binary "@./internal/classify/wire3.json" | jq .
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1954 100 808 100 1146 527 747 0:00:01 0:00:01 --:--:-- 1274
{
"model": "laya-rl-agent",
"answers": {
"glama_category": {
"type": "choice",
"choice": "developer_tools",
"probabilities": {
"developer_tools": 0.344,
"data_and_databases": 0.0807,
"communication": 0.0212,
"search_and_retrieval": 0.2015,
"cloud_and_infrastructure": 0.1651,
"utility_and_system": 0.053,
"other": 0.1346
},
"confidence": 0.1276,
"answer_confidence": 0.344,
"action": {
"act_probability": 1.0
}
}
},
"usage": {
"input_tokens": 218,
"output_tokens": 0,
"state_tokens": 42,
"state_tokens_dropped": 0,
"truncated": false,
"truncated_questions": []
},
"routing": {
"model": "english",
"repo": "convaiinnovations/laya",
"reason": "English Latin text",
"detection": {
"script": "latin",
"script_profile": {
"latin": 1.0
},
"language": "en",
"is_english": true,
"language_undecided": false,
"diacritic_rate": 0.0,
"non_latin_fraction": 0.0,
"mixed_segment": null
},
"workflow": null
}
}Relevant logs or traceback
Laya version
0.3.22
Python version
3.12.14
Operating system
Linux
Device or backend
None
Before submitting
- I searched the existing issues and this is not a duplicate.
- I reproduced this on the latest
main.
Source: NandhaKishorM/laya