LatentMAS
A multi-agent reasoning framework that exchanges latent thoughts instead of long textual reasoning traces.
- Source repo
- Gen-Verse/LatentMAS
- Stars
- ★ 1.2k
- Last updated
- 4mo ago
- License
- Apache-2.0
- Primary language
- Python
- FA score
- 42/100 · Major gaps
At a glance
- How it runs
- Works with
- Portable with changes
- Cost
- Free, no paid service needed
- Setup effort
- High · needs real infrastructure
- You'll need
- Typical use
- A reasoning researcher comparing a single-model baseline, text-space collaboration, and latent-space collaboration on GSM8K.
- Not a fit if
- Teams without local GPUs who must run on CPU only
- Users who need fully offline runs without Hugging Face downloads
- Teams that require officially supported vLLM without patching its internals
- Source review
- 42/100 · Major gaps 8 safety controls not found
What does this agent do, and when should you use it?
LatentMAS is an experiment-oriented framework for multi-agent reasoning that moves collaboration from token space into a model's latent space. Agents pass latent thoughts through working memory rather than continually exchanging long textual traces. Experiments are launched through run.py, with models.py, data.py, prompts.py, and three method implementations: baseline.py, text_mas.py, and latent_mas.py. The repository covers GSM8K, AIME24/25, GPQA, ARC-Easy/Challenge, MBPP+, HumanEval+, and MedQA, with single-agent, text-based multi-agent, and latent-space multi-agent modes. Its standard path uses Hugging Face models; an optional hybrid vLLM flow uses vLLM for final text generation and a Hugging Face model for latent rollout and hidden-state alignment.
run.py selects baseline, text_mas, or latent_mas through --method, loads a task through --task, and uses prompts.py to construct prompts. models.py wraps Hugging Face execution, vLLM execution, and latent realignment behavior; the latent_mas route carries latent states across multi-step collaboration before producing text output. Users can choose sequential or hierarchical prompting with --prompt, tune --latent_steps from 0 to 80, and enable latent-to-embedding alignment with --latent_space_realign. The repository also includes example interaction logs for sequential MBPP+ and hierarchical HumanEval+ runs.
- A reasoning researcher comparing a single-model baseline, text-space collaboration, and latent-space collaboration on GSM8K.
- An ML engineer reproducing LatentMAS commands with Qwen/Qwen3-4B, Qwen/Qwen3-8B, or Qwen/Qwen3-14B.
- A developer evaluating multi-agent code generation on MBPP+ or HumanEval+ and inspecting the supplied interaction logs.
- An experiment team testing sequential versus hierarchical collaboration on AIME24/25, GPQA, ARC, or MedQA.
- A two-GPU user who wants vLLM for final generation while retaining Hugging Face latent rollouts.
How do you install or deploy this agent?
The documented setup requires Python 3.10, conda, and a shell. Set the cache location with: export HF_HOME=/path/to/huggingface; export TRANSFORMERS_CACHE=$HF_HOME; export HF_DATASETS_CACHE=$HF_HOME. Then run: conda create -n latentmas python=3.10 -y; conda activate latentmas; pip install -r requirements.txt. Models and datasets are downloaded into $HF_HOME. For vLLM support, also run: pip install vllm. No API key or other credential is specified.
How do you use this agent?
From the repository directory, a first baseline run is: python run.py --method baseline --model_name Qwen/Qwen3-14B --task gsm8k --max_samples -1 --max_new_tokens 2048. For text-based collaboration: python run.py --method text_mas --model_name Qwen/Qwen3-14B --task gsm8k --prompt sequential --max_samples -1 --max_new_tokens 2048. For latent collaboration: python run.py --method latent_mas --model_name Qwen/Qwen3-4B --task gsm8k --prompt sequential --max_samples -1 --max_new_tokens 2048. The hybrid vLLM configuration uses --use_vllm --use_second_HF_model --enable_prefix_caching --device2 cuda:1 and is documented as a two-GPU setup.
What are this agent's strengths and limitations?
- Uses latent thoughts and working memory for collaboration, rather than offering only a text-based multi-agent loop.
- Places baseline, TextMAS, and LatentMAS behind the same CLI for controlled method comparisons.
- Documents both a standard Hugging Face backend and an optional vLLM-based final-generation path.
- Names nine reasoning and code-generation task families and includes two full example logs.
- Its experiment overview reports roughly 50–80% fewer tokens and roughly 3×–7× wall-clock speedups versus standard Text-MAS or chain-of-thought baselines.
- Reproduction depends on Hugging Face model and dataset downloads, local cache configuration, and network access.
- The vLLM path modifies part of vLLM's internal package; the project notes that vLLM does not officially support KV-cache modification or latent-embedding prompting.
- vLLM and standard Hugging Face runs can differ numerically because of decoding strategies, and the documented recommendation for official results is the Hugging Face backend.
- The hybrid vLLM arrangement is documented as using two GPUs: one for vLLM and one for the auxiliary Hugging Face model.
- Whether to enable latent_space_realign is task- and model-dependent, so adopters need to tune that hyperparameter.
How does this agent compare with similar options?
The repository exposes three comparison paths: baseline for a single model, TextMAS for token/text-space multi-agent collaboration, and LatentMAS for latent-space collaboration. Its experiment overview compares LatentMAS token and timing results with standard Text-MAS and chain-of-thought baselines.
Key facts side by side with the most closely related agents.
| Agent | Source review | Form / cost | Stars | Updated | Language | Full support on |
|---|---|---|---|---|---|---|
| LatentMAS This agent | 42 · Major gaps | CLIFree | ★ 1.2k | 4mo ago | Python | — |
| AgentFlow | 31 · Major gaps | CLIFree + model costs | ★ 2.1k | 9mo ago | Python | OpenAI API |
| ART Agent Reinforcement Trainer | 34 · Major gaps | Library / SDKFreemium | ★ 11k | 1d ago | Python | — |
| CAMEL Multi-Agent Framework | 61 · Some gaps | Library / SDKFree + model costs | ★ 18k | 5d ago | Python | OpenAI API |
How does FollowAgents rate this agent?
Why each dimension lost points
Evidence shows: the repository provides no documentation on permission management, user confirmation, data flow transparency, sensitive data handling, dependency security, external effects, rollback, or source attribution. All trust criteria are absent, hence score 0.
Evidence shows: README and code structure are consistent, self-consistency scores 2. Dependencies are listed without version pins, dependency availability scores 1. Failure messages are not explicitly documented, but example logs are provided, scoring 1.
Evidence shows: README clearly identifies target audience (researchers) and scenarios (math, science reasoning, code generation), scoring 2. Capability boundaries are indicated via method descriptions and hyperparameters (e.g., latent_steps), scoring 2. Trigger precision is supported by command-line arguments and example commands, scoring 2. Environment fit is supported by offering HF and vLLM backend options, scoring 2.
Evidence shows: information architecture is clear with directory structure, scoring 2. Install notes are detailed, scoring 2. Naming is stable, scoring 2. Example logs and FAQ are provided, scoring 2. Known limitations are noted in vLLM section, scoring 2. License is Apache-2.0, scoring 3. Versioning/changelog is missing, scoring 1. Maintenance responsibility is not explicit, scoring 1.
Evidence shows: output usability is supported by example logs and result tables, scoring 2. Marginal value is demonstrated through efficiency gains (tokens and time), scoring 2. Cost-benefit is supported by efficiency gains and open-source license, scoring 2.
Evidence shows: claim traceability is supported by arXiv link and experiment tables, scoring 2. Cross-source corroboration is limited, scoring 1. Fact-inference separation is not clear, scoring 1.
- Not found in source: least-privilege scopingGrant only what the task needs: a dedicated account or read-only token, scoped to specific directories and repos.
- Not found in source: confirmation before actingTurn on (or add) a confirmation step before it acts, and try it in a sandbox or test environment before real data.
- Not found in source: data-flow disclosureWatch which external services it contacts (proxy or firewall logs) and keep sensitive data out until you know where it goes.
- Not found in source: sensitive-data handlingUse dedicated, low-privilege, revocable API keys — never production credentials — and keep secrets out of logs.
- Not found in source: dependency securityPin versions and run a dependency audit (npm audit, pip-audit) before installing; prefer running it in a container.
- Not found in source: disclosed external effectsEstablish which external systems it writes to, sends to or changes, and verify with test accounts or repos before production.
- Not found in source: rollback or recovery pathBack up first, or work on a git branch or snapshot, so its changes can be undone.
- Not found in source: verifiable attributionInstall from the official repo or registry and check the publisher and URL to avoid look-alike packages.
- Dependencies are not pinned, posing supply chain risks.
- vLLM integration modifies internal packages, which may be unstable.
- Publisher identity is unverified; evaluate with caution.