Submitted:
22 April 2024
Posted:
24 April 2024
You are already at the latest version
Abstract
Keywords:
1. Introduction
2. Related Work
3. A Decentralized Marketplace for Distributed Computing
4. Signatures & Digital IDs
Nostr Digital Identity And Reputation:
5. Protocol Design for Distributed Computing and AI Directories
5.1. Distributed Computing on the NOSTR Protocol
Basic Protocol Flow for Data Vending Machines (DMVs) [24]
- Customer publishes a job request (e.g. kind:5000, speech-to-text).
- Service Providers may submit job-feedback events (kind:7000, e.g. payment-required, processing, error, etc.).
- Upon completion, the service provider publishes the result of the job with a job-result event (kind:6000).
- At any point, if there is an amount pending to be paid as instructed by the service provider, the user can pay the included bolt11 invoice [25] of the job result event that the service provider has sent to the user.
Job Request (DVMs)
- {
- "kind": 5xxx // kind in range 5000 - 5999,
- "content": "",
- "tags": [
- ["i", " <data> ", "<input-type>, "<relay>", "<marker>"],
- ["output", "<mime-type>"],
- ["relays", "wss://..."],
- ["bid", "<msat-amount>"],
- ["t", "bitcoin"]
- ]
- }
Job Request (AI VMs)


- a source for the code: While the service provider may have its own code, there should be reference to a standard approach that guarantees consistency
- a source for the data: The customer splits and sends an encrypted URL to the service providers. The customer decides how to split the data. The way of splitting the data may be arbitrary.
- job details: expected execution type or hardware that is needed, rules related to time-out conditions.
- Declaration of validation process. This is how the customer will decide if the output is accurate or not.
Job Chaining
Job Result (kind: 6000-6999)

Job Feedback (kind:7000)
- {
- "kind": 7000,
- "content": "<empty-or-payload>",
- "tags": [
- ["status", " <status> ", "<extra-info>"],
- ["amount", "<requested-payment-amount>", "<bolt11>"],
- ["e", "job-request-id", "<relay-hint>"],
- ["p", "<customer’s-pubkey>"],
- ],
- ...
- }
Discoverability


6. Payments
6.1. Payments Implementation
Payment Request
- Relays is a list of relays for the wallet of the recipient to publish its payment (zap) receipt to.
- Amount is the amount in millisats the sender intends to pay, formatted as a string.
- Lnurl is the lnurl pay url of the recipient, encoded using bech32 [25] with the prefix lnurl.
- p is the hex-encoded pubkey of the recipient.
- e is an optional hex-encoded event id. Implementations must include this while paying an event rather than a public key.
- {
- "kind": 9734,
- "content": "Zap!",
- "tags": [
- ["relays", "<wss://relay-domain>", "wss://anotherrelay.com"],
- ["amount", "<msats-amount>"],
- ["lnurl", "<a-static-lightning-invoice>"],
- ["p", "<hex-encoded-pubkey-of-the-recipient>"],
- ["e", "<optional-hex-encoded-event-ID>"]
- ],
- "pubkey": "<NPUB>",
- "created_at": <timestamp>,
- "id": "<event-ID>",
- "sig": "<signature>"
- }
Payment Receipt
- Get the description for the invoice. This needs to be saved somewhere during the generation of the description hash invoice. It is saved automatically for you with CLN, which is the reference implementation used here.
- Parse the bolt11 description as a JSON nostr event. This SHOULD be validated based on the requirements in Appendix D, either when it is received, or before the invoice is paid.
- Create a nostr event of kind 9735 as described below, and publish it to the relays declared in the zap request.
- The content SHOULD be empty.
- The created_at date SHOULD be set to the invoice paid_at date for idempotency.
- tags MUST include the p tag (zap recipient) AND optional e tag from the zap request AND optional a tag from the zap request AND optional P tag from the pubkey of the zap request (zap sender).
- The zap receipt MUST contain a description tag which is the JSON-encoded invoice description.
- The zap receipt MUST have a bolt11 tag containing the description hash bolt11 invoice.
- SHA256(description) MUST match the description hash in the bolt11 invoice.
- The zap receipt MAY contain a preimage tag to match against the payment hash of the bolt11 invoice. This isn’t really a payment proof, there is no real way to prove that the invoice is real or has been paid. You are trusting the author of the zap receipt for the legitimacy of the payment.
- {
- "id": "<event-ID>",
- "pubkey": "<NPUB>",
- "created_at": <paid-at-date>,
- "kind": 9735,
- "tags": [
- ["p", "<payment-recipient)>"],
- ["P", "<optional-P-tag-from-the-pubkey-of-the-payment-request>"],
- ["e", "<optional-tag-same-as-payment-request-e-tag>"],
- ["bolt11", "<lightning-invoice>"],
- ["description", "<SHA256(description)-from-invoice>"],
- ["preimage", "<payment-preimage>"]
- ],
- "content": "",
- }
Receipt Validation
- The public key in the payment receipt event must be the same as the public key of the service provider.
- The invoice Amount contained in the bolt11 tag of the payment receipt must be equal to the amount tag of the payment request.
- The lnurl tag of the payment request should be equal the lnurl of the recipient.
7. Money-In AI-Out: Marketplace for Federated Learning and LLMs
Protocol Flow.
7.1. Customer
Handling Disconnections and Failures to Respond.
Validation of the Output (Algorithm 3).



Reassigning the Job to a Different Service Provider (Algorithm 2).


7.2. Service provider


Federated Averaging vs Distributed Low-Communication Training of LLMs (DiLoCo)
Inner Optimization (Algorithm 5)

Outer Optimization (Algorithm 6)

8. Conclusion
9. Funding
- https://tmf.cio.gov/ai/#our-expedited-ai-pilot-process
- https://new.nsf.gov/focus-areas/artificial-intelligence
- https://www.usgrants.org/business/artificial-intelligence-researchers
- https://www.nersc.gov/research-and-development/data-analytics/generative-ai-for-science-callfor-proposals-ay2024/
- https://new.nsf.gov/funding/opportunities/national-artificial-intelligence-research
- https://www.scaleai.ca/projects/
- https://www.cooperativeai.com/grants/cooperative-ai
- https://hessian.ai/entrepreneurship/laisf/
10. Notes
- I made some changes in the text see blue
- Validation to validation an trexei ston customer isws na einai ligo bottleneck. 8a kanoume k peiramata? pistevw a3izei na doume posi wra pernei afto, giati an gia ka8e result pou trexeis kaneis k validation locally isws na einai full douleia apo mono tou. i na exeis allon service provider gia validation :P Ideally the customer wants to know if the result is valid before completing the payment, maybe the validation has to be simple and smart, other service providers may be responsible for validation, we may include this as a discussion instead of into the code
- parakatw polu swsta to paper anaferetai se service providers failures k pws na ta diaxeirizetai to sistima. pistevw prepei na pros8esoume mia extra paragrafo gia to pws diaxeirizetai to sistima ta failures to customer. afti ti stigmi an pesei o customer ti simvainei sto sistima? The service provider may consider a time-out period as well if the custoemr stops responding and submitting payments after some time the service provider aborts and looks for other job requests from different customers to feedback pou sou girnaei o service provider pou apo8ikevetai? It should be the same as how a client like damus stores the feed, this has by default a customizable rate limit (see also workshop build a client from scratch by react), also there are customizable filters to keep only the relevant eventstopika se mia ram? 8a pesei isws polu douleia se afto ton komvo. 8a 8elei ligo rate limiting gia na min girisoun polla request mazi b) checkpointing gia na min pesei o komvos stin mesi tou training?
- Consider any changes related to the above into the code as well
- Discuss implementation and development for simulations
- Startup time
- scalability
- comparison with existing alternative options: quantify trade-offs
- https://github.com/mattn/algia
- https://github.com/fiatjaf/noscl?tab=readme-ov-file
- https://github.com/fiatjaf/nak
- development kit (ndkit): https://ndkit.com/
- nostr tools https://github.com/nbd-wtf/nostr-tools
- FEDAVG https://github.com/alexbie98/fedavg?tab=readme-ov-file
- DiLoCo https://github.com/xrsrke/pipegoose
References
- domain., P. NOSTR - Notes and Other Stuff Transmitted by Relays. https://github.com/nostr-protocol/nostr, 2023.
- Briugeman, A. Nostr Real Time Statistics. https://stats.nostr.band, 2023.
- domain., P. Bluesky Architecture. https://docs.bsky.app/docs/advanced-guides/federation-architecture, 2023.
- Kleppmann, M.; Frazee, P.; Gold, J.; Graber, J.; Holmgren, D.; Ivy, D.; Johnson, J.; Newbold, B.; Volpert, J. Bluesky and the AT Protocol: Usable Decentralized Social Media. arXiv preprint arXiv:2402.03239, arXiv:2402.03239 2024.
- Gilbert, S.; Lynch, N. Perspectives on the CAP Theorem. Computer 2012, 45, 30–36. [Google Scholar] [CrossRef]
- Wei, Y.; Tyson, G. Exploring the Nostr Ecosystem: A Study of Decentralization and Resilience. arXiv preprint arXiv:2402.05709, arXiv:2402.05709 2024.
- Poon, J.; Dryja, T. The bitcoin lightning network: Scalable off-chain instant payments. https://lightning.network/, 2016. [Google Scholar]
- Douillard, A.; Feng, Q.; Rusu, A.A.; Chhaparia, R.; Donchev, Y.; Kuncoro, A.; Ranzato, M.; Szlam, A.; Shen, J. DiLoCo: Distributed Low-Communication Training of Language Models. arXiv preprint arXiv:2311.08105, arXiv:2311.08105 2023.
- Nakamoto, S. Bitcoin: A peer-to-peer electronic cash system. Decentralized business review 2008. [Google Scholar]
- Dembo, A.; Kannan, S.; Tas, E.N.; Tse, D.; Viswanath, P.; Wang, X.; Zeitouni, O. Everything is a race and Nakamoto always wins. Proceedings of the 2020 ACM SIGSAC Conference on Computer and Communications Security, 2020, pp. 859–878.
- Liu, Y.; Kishore, K.N. Sovereign Individual System (SIS): An Autonomous Digital Platform for Sovereign Individuals. Proceedings of the Future Technologies Conference. Springer, 2023, pp. 142–153.
- domain., P. NIP-19: NOSTR - Notes and Other Stuff Transmitted by Relays. https://github.com/nostr-protocol/nips/blob/master/19.md, 2023.
- Pieter Wuille, Jonas Nick, T.R. Schnorr Signatures for secp256k1. https://bips.xyz/340, 2019.
- Deelman, E. Mapping Abstract Complex Workflows onto Grid Environments. Journal of Grid Computing 2003, 1, 25–39. [Google Scholar] [CrossRef]
- Taylor, I.; Shields, M.; Wang, D. Resource Management of Triana P2P Services. Grid Resource Management 2003. [Google Scholar]
- Anderson, D.; Korpela, E.; Walton, R. High-performance task distribution for volunteer computing. First International Conference on e-Science and Grid Computing (e-Science’05), 2005, pp. 8 pp.–203. [CrossRef]
- Anderson, D.P. BOINC: A Platform for Volunteer Computing. Journal of Grid Computing 2019, 18, 99–122. [Google Scholar] [CrossRef]
- The Gridcoin Network and Protocol Overview 2018.
- Yakovenko, A. Solana: A new architecture for a high performance blockchain v0. 8.13. Whitepaper 2018. [Google Scholar]
- Apps, N. Nostr Apps. https://www.nostrapps.com/, 2023.
- domain., P. Data Vending Machines. https://github.com/nostr-protocol/data-vending-machines, 2023.
- domain., P. VenData. https://vendata.io, 2023.
- Maxwell, G.; Poelstra, A.; Seurin, Y.; Wuille, P. Simple schnorr multi-signatures with applications to bitcoin. Designs, Codes and Cryptography 2019, 87, 2139–2164. [Google Scholar] [CrossRef]
- domain., P. NIP-90: NOSTR - Notes and Other Stuff Transmitted by Relays. https://github.com/nostr-protocol/nips/blob/master/90.md, 2023.
- Antonopoulos, A.M.; Osuntokun, O.; Pickhardt, R. Mastering the lightning network; " O’Reilly Media, Inc.", 2021.
- Andreas, M. Antonopoulos, Olaoluwa Osuntokun, R.P. Lightning Payment Requests. https://github.com/lnbook/lnbook/blob/develop/15_payment_requests.asciidoc, 2023.
- domain., P. NOSTR Implementation Possibillities, 89. https://github.com/nostr-protocol/nips/blob/master/89.md, 2023.
- O’Hare, J.J.; Fairchild, A.; Ali, U. Money & Trust in Digital Society: Bitcoin, Nostr, Stablecoins, Digital Objects and Generative AI in B2B Spatial Mixed Reality. arXiv preprint arXiv:2207.09460 2022. [Google Scholar]
- Robert, J.; Kubler, S.; Ghatpande, S. Enhanced Lightning Network (off-chain)-based micropayment in IoT ecosystems. Future Generation Computer Systems 2020, 112, 283–296. [Google Scholar] [CrossRef]
- domain., P. NOSTR Implementation Possibillities, 57. https://github.com/nostr-protocol/nips/blob/master/57.md, 2023.
- Zap, N. JeffG. https://nostr.how/en/zaps, 2023.
- domain., P. LNURL. https://github.com/GaloyMoney/lnurl-pay, 2023.
- domain., P. NIP-01: NOSTR - Notes and Other Stuff Transmitted by Relays. https://github.com/nostr-protocol/nips/blob/master/01.md, 2023.
- McMahan, B.; Moore, E.; Ramage, D.; Hampson, S.; y Arcas, B.A. Communication-efficient learning of deep networks from decentralized data. Artificial intelligence and statistics. PMLR, 2017, pp. 1273–1282.
- Bhagoji, A.N.; Chakraborty, S.; Mittal, P.; Calo, S. Analyzing Federated Learning through an Adversarial Lens. Proceedings of the 36th International Conference on Machine Learning; Chaudhuri, K.; Salakhutdinov, R., Eds. PMLR, 2019, Vol. 97, Proceedings of Machine Learning Research, pp. 634–643.
- Demartis, M. Adversarial Attacks in Federated Learning, 2022.
- Rathee, M.; Shen, C.; Wagh, S.; Popa, R.A. Elsa: Secure aggregation for federated learning with malicious actors. 2023 IEEE Symposium on Security and Privacy (SP). IEEE, 2023, pp. 1961–1979.
- Awan, S.; Luo, B.; Li, F. Contra: Defending against poisoning attacks in federated learning. Computer Security–ESORICS 2021: 26th European Symposium on Research in Computer Security, Darmstadt, Germany, October 4–8, 2021, Proceedings, Part I 26. Springer, 2021, pp. 455–475.
- Loshchilov, I.; Hutter, F. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101 2017, arXiv:1711.05101.
- Huo, Z.; Yang, Q.; Gu, B.; Huang, L.C. ; others. Faster on-device training using new federated momentum algorithm. arXiv preprint arXiv:2002.02090, arXiv:2002.02090 2020.
- Linus, R. BitVM: Compute Anything on Bitcoin. bitvm.org 2023. [Google Scholar]
- Rasley, J.; Rajbhandari, S.; Ruwase, O.; He, Y. Deepspeed: System optimizations enable training deep learning models with over 100 billion parameters. Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, 2020, pp. 3505–3506.
- Rajbhandari, S.; Rasley, J.; Ruwase, O.; He, Y. Zero: Memory optimizations toward training trillion parameter models. SC20: International Conference for High Performance Computing, Networking, Storage and Analysis. IEEE, 2020, pp. 1–16.
- Fan, T.; Kang, Y.; Ma, G.; Chen, W.; Wei, W.; Fan, L.; Yang, Q. Fate-LLM: A industrial grade federated learning framework for large language models. arXiv preprint arXiv:2310.10049, arXiv:2310.10049 2023.
- Lu, L.; Dai, C.; Tao, W.; Yuan, B.; Sun, Y.; Zhou, P. Exploring the Robustness of Decentralized Training for Large Language Models. arXiv preprint arXiv:2312.00843, arXiv:2312.00843 2023.
- Tang, Z.; Wang, Y.; He, X.; Zhang, L.; Pan, X.; Wang, Q.; Zeng, R.; Zhao, K.; Shi, S.; He, B. ; others. FusionAI: Decentralized Training and Deploying LLMs with Massive Consumer-Level GPUs. arXiv preprint arXiv:2309.01172, arXiv:2309.01172 2023.
- Agrawal, A.; Panwar, A.; Mohan, J.; Kwatra, N.; Gulavani, B.S.; Ramjee, R. Sarathi: Efficient LLM inference by piggybacking decodes with chunked prefills. arXiv preprint arXiv:2308.16369, arXiv:2308.16369 2023.
- Shen, H.; Chang, H.; Dong, B.; Luo, Y.; Meng, H. Efficient LLM inference on cpus. arXiv preprint arXiv:2311.00502, arXiv:2311.00502 2023.
- Spector, B.; Re, C. Accelerating LLM inference with staged speculative decoding. arXiv preprint arXiv:2308.04623, arXiv:2308.04623 2023.
- Cai, T.; Li, Y.; Geng, Z.; Peng, H.; Lee, J.D.; Chen, D.; Dao, T. Medusa: Simple LLM inference acceleration framework with multiple decoding heads. arXiv preprint arXiv:2401.10774, arXiv:2401.10774 2024.
- Del Corro, L.; Del Giorno, A.; Agarwal, S.; Yu, B.; Awadallah, A.; Mukherjee, S. Skipdecode: Autoregressive skip decoding with batching and caching for efficient LLM inference. arXiv preprint arXiv:2307.02628, arXiv:2307.02628 2023.
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).